Guest User

Winbox Java Class / winbox protocol handler

a guest
Feb 19th, 2013
165
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.IOException;
  2. import java.io.PrintStream;
  3.  
  4. public class Winbox
  5. {
  6.   public static void main(String[] args)
  7.   {
  8.     String input = args[0];
  9.  
  10.     int slashPos = input.indexOf("://");
  11.     int passPos = input.indexOf(":", slashPos + 3);
  12.     int ipPos = input.indexOf("@");
  13.  
  14.     String username = input.substring(slashPos + 3, passPos);
  15.     String password = input.substring(passPos + 1, ipPos);
  16.     String ip = input.substring(ipPos + 1).replace("/", "");
  17.  
  18.     System.out.println(username);
  19.     System.out.println(password);
  20.     System.out.println(ip);
  21.  
  22.     Runtime r = Runtime.getRuntime();
  23.     try
  24.     {
  25.       r.exec("c:\\winbox\\winbox.exe " + ip + " " + username + " " + password);
  26.     }
  27.     catch (IOException e)
  28.     {
  29.       e.printStackTrace();
  30.     }
  31.   }
  32. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×