Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String Login(String usr, char[] pwd) throws Exception {
- InetAddress ip = InetAddress.getLocalHost();
- NetworkInterface network = NetworkInterface.getByInetAddress(ip);
- byte[] mac = network.getHardwareAddress();
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < mac.length; i++) {
- sb.append(String.format("%02x%s", mac[i], (i < mac.length - 1) ? ":" : ""));
- }
- mac_address = sb.toString();
- String urlencode_pwd = URLEncoder.encode(pwdEncode(String.valueOf(pwd)), "utf-8");
- String data =
- "action=login&username="
- + usrEncode(usr)
- + "&password="
- + urlencode_pwd
- + "&drop=0&pop=1&type=2&n=117&mbytes=0&minutes=0&ac_id=1&mac="
- + mac_address;
- String response = HttpPost("http://172.16.154.130:69/cgi-bin/srun_portal", data);
- if (response.contains("login_ok")) {
- isLinked = true;
- return "success";
- } else {
- isLinked = false;
- return response;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement