Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Library for SSH SOCKS binding (Dynamic Port Forwarding)?

I'm looking for a way to connect to my remote server using ssh binding inside my java application. I enter the command like below inside my terminal to connect my server:

ssh -D 1234 [email protected]

then I can configure my browser socks ip & port to:

socks ip: 127.0.0.1
socks port: 1234

& use my server to browse inside internet

now please help me to do this in my java application.

currently I use a library called JSCH in my program but I couldn't get my application to work. Do you have any Idea or sample code or whatever for this problem ?

(notice that both SOCKS v4 & v5 should be supported inside the java library)

like image 750
Mehdi Avatar asked Nov 13 '22 07:11

Mehdi


1 Answers

You would get multiple options

-http://mina.apache.org/sshd-project/documentation.html Trusted Apache project with good support in form of user community,docs & examples I think this is what you were asking for. https://svn.apache.org/repos/asf/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/PortForwardingTest.java

-http://www.jcraft.com/jsch/ Bad documentation but has been in existence for a long time.Sample code is pretty good.

http://code.google.com/p/ganymed-ssh-2/

Another lib with just sufficent documnetation.

like image 75
Rohitdev Avatar answered Nov 14 '22 22:11

Rohitdev