-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSHy without wsProxy #26
Comments
If you don't want to use wsProxy/node you can make the following modifications to the code as suggested in #4 This would enable you to use websocket proxies that operate via binary blobs ( such as websockify ). You may have issues multiplexing your connection to multiple SSH servers though unless your chosen websocket proxy also supports target servers in the URI. e.g. These changes would be done in index.html or wrapper.html // Opens the websocket!
ws = new WebSocket(wsproxyURL);
ws.binaryType = "arraybuffer";
// Send all recieved messages to SSHyClient.Transport.handle()
ws.onmessage = function(e) {
// ArrayBuffer to String
var enc = new TextDecoder("utf-8");
var clearMessage = enc.decode(e.data);
console.log(clearMessage);
transport.parceler.handle(clearMessage);
};
ws.sendB64 = function(e){
var enc = new TextEncoder();
this.send(enc.encode(e)); // String to ArrayBuffer conversion
console.log("sendB64", e);
transport.parceler.transmitData += e.length;
transport.settings.setNetTraffic(transport.parceler.transmitData, false);
}; |
Thanks for a quick reply.. So I just need to add this or also remove something? |
The idea is just to connect to localhost:22 |
Would be replacing websocket definition & the https://github.com/stuicey/SSHy/blob/master/index.html#L221 |
Uncaught TypeError: Cannot set property 'onopen' of undefined |
If you're using the wrapper you'll need to modify this in SSHyClient.js and rebuild the min files (instructions in readme). |
i am actually using index.html, but I copied a modified code as per your instructions to wrapper.html... It's still throwing errors |
What browser are you using? and can you check what websocket proxy URL is being passed to the function? |
I am using the latest Chrome.. Even when adding that I don't see anything else in the console but this: Uncaught TypeError: Cannot set property 'onopen' of undefined |
That doesn't sound right, if you're not getting any logs out for a Do you have your console sidebar configured to only show errors? |
No, it's showing everything.. It's not showing anything, because it's within function startSSHy(), which is not starting |
The stack trace indicates that the Do you want to attach the file and I'll have a look? |
You've added that code block in after |
Thanks, I moved it up at this point.. But now I get this error:
|
You'll need to change how the wsproxy URL is generated and set the new proxy URL appropriately. Currently it expects the proxy to be on either port 5999(ws://) or 6001(wss://). Additionally it appends the IP/port of your target to the uri. This likely won't work with other websocket proxies so you will need to configure this yourself based on whatever proxy you choose. |
Well y'all are a lot closer to SSHing online than I am. My page keeps trying to connect to:
I'm not even sure how that happened... Edit: |
You probably set the full webproxy url as https://github.com/stuicey/SSHy/blob/master/index.html#L74 This function constructs the URL in the form: |
Progress... I downloaded the latest commit, and I haven't touched anything either. Not quite sure if something else is wrong, or if I missed a step. Sorry if I'm being a difficult. |
Debugging through Chrome, and it seems to be complaining about this... ws = new WebSocket(wsproxyURL); //PROBLEM ACCORDING TO CHROME
ws.binaryType = "arraybuffer";
// Send all recieved messages to SSHyClient.Transport.handle()
ws.onmessage = function(e) {
// ArrayBuffer to String
var enc = new TextDecoder("utf-8");
var clearMessage = enc.decode(e.data);
console.log(clearMessage);
transport.parceler.handle(clearMessage);
};
ws.sendB64 = function(e){
var enc = new TextEncoder();
this.send(enc.encode(e)); // String to ArrayBuffer conversion
console.log("sendB64", e); |
The error suggests it can't resolve the domain name |
Hosts file? The only time I've touched that is to just setup my main domain. Unless if there is a hosts file in this project that I am unaware of, I have not. |
I am new to this so I am sorry for a stupid question, but is it possible to install wsproxy manually, without npm or avoid it altogether? I want to use SSH only to connect to my machine (where sshy is installed) from elsewhere...
Originally posted by @kidygetnada in #24 (comment)
Moving this to a new issue for search-ability
The text was updated successfully, but these errors were encountered: