📄 sshproxy.java
字号:
/*************************************************************************
FILE : SSHProxy.java
Author : Svetoslav Tchekanov (swetoslav@iname.com)
Description: SSHProxy class definition.
SSHProxy.class is the main class of SSH Proxy
Copyright notice:
Written by Svetoslav Tchekanov (swetoslav@iname.com)
Copyright(c) 2000
This code may be used in compiled form in any way you desire. This
file may be redistributed unmodified by any means PROVIDING it is
not sold for profit without the authors written consent, and
providing that this notice and the authors name is included. If
the source code in this file is used in any commercial application
then a simple email would be nice.
This file is provided "as is" with no expressed or implied warranty.
The author accepts no liability if it causes any damage to your
computer.
*************************************************************************/
//---------------------------------------------
import java.io.*;
import java.util.Properties;
import socksshttp.*;
//---------------------------------------------
public class SSHProxy
{
public static final int DEFAULT_PORT = 8888;
public static int s_nPort = DEFAULT_PORT;
public static boolean s_bUseSHttpProxy = false;
public static String s_ProxyHost = null;
public static int s_ProxyPort = 80;
public static boolean s_EnableLog = true;
public static Properties s_Prop = null;
//---------------------------------------------
public static boolean LoadProperties() {
String ErrorMsg = "";
FileInputStream fis;
s_Prop = new Properties();
String UseSHTTP = "NO";
String pHost = "";
String pPort = "";
String sPort = "";
try {
fis = new FileInputStream( "config.txt" );
s_Prop.load( fis );
}
catch( FileNotFoundException e ) {
ErrorMsg = "File not found \"config.txt\"";
}
catch( IOException e ) {
ErrorMsg = "IO Error loading \"config.txt\"";
}
s_nPort = Tools.LoadInt( "SOCKSPort", DEFAULT_PORT, s_Prop );
s_bUseSHttpProxy = Tools.LoadBoolean( "UseSHttpProxy", false, s_Prop );
s_ProxyPort = Tools.LoadInt ( "SHttpProxyPort", 0, s_Prop );
s_ProxyHost = Tools.LoadString( "SHttpProxyHost", "", s_Prop );
if( !s_bUseSHttpProxy ) {
Log.Println( "Use of SHTTP Proxy Disabled." );
}
else {
Log.Println( "USE of SHTTP Proxy Enabled." );
Log.Println( "SHTTP Proxy Host : " + s_ProxyHost );
Log.Println( "SHTTP Proxy Port : " + s_ProxyPort );
}
Log.Println( "---------------------------------------" );
if( s_ProxyPort <= 0 || s_ProxyHost == null ||
s_ProxyHost.length() <= 0 )
{
ErrorMsg = "Invalid settings for SHttpProxy ! Use of SHTTP Proxy disabled !";
s_bUseSHttpProxy = false;
}
s_EnableLog = Tools.LoadBoolean( "EnableLog", true, s_Prop );
if( s_EnableLog ) {
Log.Println( "Logging : On" );
}
else {
Log.Println( "Logging : Off" );
}
Log.Println( "---------------------------------------" );
Log.Println( "SOCKS Proxy Port : " + s_nPort );
Log.Println( "---------------------------------------" );
if( !ErrorMsg.equals("") ) {
Log.Error( ErrorMsg );
return false;
}
return true;
}
//---------------------------------------------
//---------------------------------------------
public static void main(String[] args)
{
Log.Println( "----------------------------------------------" );
Log.Println( " S S H P R O X Y " );
Log.Println( " SOCKS Proxy Server -> HTTP SSL tunnel Master " );
Log.Println( "----------------------------------------------" );
Log.Println( " Copyright (c) 1999 by Svetoslav Tchekanov " );
Log.Println( " ICQ #13435454 E-mail : swetoslav@iname.com " );
Log.Println( "----------------------------------------------" );
Log.Println( "Params : None " );
Log.Println( "Config File : \"config.txt\"" );
Log.Println( "\"config.txt\": EnableLog=<yes/no>" );
Log.Println( "\"config.txt\": SOCKSPort=<PortNumber>" );
Log.Println( "\"config.txt\": UseSHttpProxy=<yes/no>" );
Log.Println( "\"config.txt\": SHttpProxyHost=<hostname/IP>" );
Log.Println( "\"config.txt\": SHttpProxyPort=<PortNumber>" );
Log.Println( "----------------------------------------------" );
if( ! LoadProperties() ) return;
Log.EnableLog = s_EnableLog;
new CServer( s_nPort, s_bUseSHttpProxy,
s_ProxyHost, s_ProxyPort ).start();
}
//---------------------------------------------
}
//-------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -