📄 sslexplorerconnect.java
字号:
import com.sslexplorer.vpn.embed.EmbeddedVPNClient;
import com.sslexplorer.vpn.embed.LogonCredentialsPrompt;
import java.io.*;
import java.net.*;
//import com.maverick.ssh.*;
//import com.sshtools.net.*;
public class SSLExplorerConnect {
public static void main(String[] args) {
try {
// These system properties need to be set unless you are connecting
// to a server that have a certificate issued by a certificate authority
System.setProperty("com.maverick.ssl.allowUntrustedCertificates", "true");
System.setProperty("com.maverick.ssl.allowInvalidCertificates", "true");
BufferedReader reader = new BufferedReader(
new InputStreamReader(System.in));
// Enter the hostname of the SSL-Explorer gateway
System.out.print("SSL-Explorer Hostname (<hostname>[:<port>]): ");
String hostname = reader.readLine();
int idx = hostname.indexOf(':');
int port = 443;
if (idx > -1) {
port = Integer.parseInt(hostname.substring(idx + 1));
hostname = hostname.substring(0, idx);
}
// Enter the username of the SSL-Explorer account
System.out.print("SSL-Explorer Username [Enter for " + System.getProperty("user.name") +
"]: ");
String username = reader.readLine();
if (username == null || username.trim().equals(""))
username = System.getProperty("user.name");
// Enter the users password for the SSL-Explorer
System.out.print("SSL-Explorer Password: ");
String password = reader.readLine();
// Create an Embedded VPN Client instance
EmbeddedVPNClient vpnclient = new EmbeddedVPNClient(hostname, port, username, password);
vpnclient.connect();
// Enter the hostname of the SSL-Explorer gateway
System.out.print("Target Hostname (<hostname>[:<port>]): ");
String targetHostname = reader.readLine();
idx = hostname.indexOf(':');
int targetPort = 443;
if (idx > -1) {
targetPort = Integer.parseInt(hostname.substring(idx + 1));
targetHostname = hostname.substring(0, idx);
}
// Create a tunnel to any hostname/port within the network perimeter
Socket socket = vpnclient.createTunnel(targetHostname, targetPort);
InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
//
System.out.println("You now have I/O streams connected to your " +
"target host / port, what you do with them is up to you!");
// use the Socket for the tunnelled application such as J2SSH Maverick
/*SshConnector con = SshConnector.getInstance();
SshClient ssh = con.connect(new SocketWrapper(socket),
"foobar");
com.maverick.ssh.PasswordAuthentication pwd = new com.maverick.ssh.PasswordAuthentication();
pwd.setPassword("xxxxx");
ssh.authenticate(pwd);*/
// When finished and you don't require any further tunnels, disconnect
vpnclient.disconnect();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -