1 package test; 2 import socks.*; 3 import socks.server.*; 4 import java.net.Socket ; 5 6 7 8 public class UPSOCKS implements UserValidation{ 9 String user, password; 10 11 UPSOCKS(String user,String password){ 12 this.user = user; 13 this.password = password; 14 } 15 16 public boolean isUserValid(String user,String password,Socket s){ 17 System.err.println("User:"+user+"\tPassword:"+password); 18 System.err.println("Socket:"+s); 19 return (user.equals(this.user) && password.equals(this.password)); 20 } 21 22 public static void main(String args[]){ 23 String user, password; 24 25 if(args.length == 2){ 26 user = args[0]; 27 password = args[1]; 28 }else{ 29 user = "user"; 30 password = "password"; 31 } 32 33 UPSOCKS us = new UPSOCKS(user,password); 34 UserPasswordAuthenticator auth = new UserPasswordAuthenticator(us); 35 ProxyServer server = new ProxyServer(auth); 36 37 server.setLog(System.out); 38 server.start(1080); 39 } 40 } 41 | Popular Tags |