/** * Constructs a Socks5 instance without any parameter. */ private void init() { acceptableMethods = new ArrayList<>(); acceptableMethods.add(new NoAuthenticationRequiredMethod()); acceptableMethods.add(new GssApiMethod()); acceptableMethods.add(new UsernamePasswordMethod()); }
userManager.addUser("fucksocks", "fucksocks"); ((UsernamePasswordMethod) method).setAuthenticator(new UsernamePasswordAuthenticator (userManager));
userManager.addUser("fucksocks", "fucksocks"); ((UsernamePasswordMethod) method).setAuthenticator(new UsernamePasswordAuthenticator (userManager));
/** * Constructs a Socks5 instance without any parameter. */ private void init() { acceptableMethods = new ArrayList<>(); acceptableMethods.add(new NoAuthenticationRequiredMethod()); acceptableMethods.add(new GssApiMethod()); acceptableMethods.add(new UsernamePasswordMethod()); }
private void initAuth(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { String authValue = arguments.getValue(Arrays.asList("-a", "--auth"), null); if (authValue != null) { UserManager userManager = new MemoryBasedUserManager(); for (String user : authValue.split(",")) { String[] userPassword = user.split(":"); String username = userPassword[0]; String password = userPassword[1]; userManager.create(new User(username, password)); } builder.setSocksMethods(new UsernamePasswordMethod()).setUserManager(userManager); } else { builder.setSocksMethods(new NoAuthenticationRequiredMethod()); } }
private void initAuth(Arguments arguments, SocksServerBuilder builder) throws IllegalArgumentException { String authValue = arguments.getValue(Arrays.asList("-a", "--auth"), null); if (authValue != null) { UserManager userManager = new MemoryBasedUserManager(); for (String user : authValue.split(",")) { String[] userPassword = user.split(":"); String username = userPassword[0]; String password = userPassword[1]; userManager.create(new User(username, password)); } builder.setSocksMethods(new UsernamePasswordMethod()).setUserManager(userManager); } else { builder.setSocksMethods(new NoAuthenticationRequiredMethod()); } }
public static SocksProxyServer newUsernamePasswordAuthenticationServer(int port, User... users) { SocksProxyServer proxyServer = new BasicSocksProxyServer(Socks5Handler.class, port); proxyServer.setBufferSize(BUFFER_SIZE); proxyServer.setTimeout(TIMEOUT); UsernamePasswordAuthenticator authenticator = new UsernamePasswordAuthenticator(); for (User user : users) { authenticator.addUser(user.getUsername(), user.getPassword()); } proxyServer.setSupportMethods(new UsernamePasswordMethod(authenticator)); return proxyServer; }
public static SocksProxyServer newUsernamePasswordAuthenticationServer(int port, User... users) { SocksProxyServer proxyServer = new BasicSocksProxyServer(Socks5Handler.class, port); proxyServer.setBufferSize(BUFFER_SIZE); proxyServer.setTimeout(TIMEOUT); UsernamePasswordAuthenticator authenticator = new UsernamePasswordAuthenticator(); for (User user : users) { authenticator.addUser(user.getUsername(), user.getPassword()); } proxyServer.setSupportMethods(new UsernamePasswordMethod(authenticator)); return proxyServer; }