1515
1616
1717import sys
18+ import nsmcouch
1819import string
1920import random
2021import os
@@ -49,12 +50,14 @@ def main():
4950 global webPort
5051 global uri
5152 global httpMethod
53+ global platform
5254 global https
5355 global myIP
5456 global myPort
5557 global verb
5658 global scanNeedCreds
5759 global dbPort
60+ platform = "MongoDB"
5861 dbPort = 27017
5962 mainMenu ()
6063
@@ -77,7 +80,8 @@ def mainMenu():
7780 print "1-Set options"
7881 print "2-NoSQL DB Access Attacks"
7982 print "3-NoSQL Web App attacks"
80- print "4-Scan for Anonymous MongoDB Access"
83+ print "4-Scan for Anonymous " + platform + " Access"
84+ print "5-Change Platform (Current: " + platform + ")"
8185 print "x-Exit"
8286
8387 select = raw_input ("Select an option: " )
@@ -108,14 +112,36 @@ def mainMenu():
108112
109113
110114 elif select == "4" :
111- massMongo ()
115+ massScan ()
116+
117+ elif select == "5" :
118+ platSel ()
112119
113120 elif select == "x" :
114121 sys .exit ()
115122
116123 else :
117124 raw_input ("Invalid selection. Press enter to continue." )
118-
125+
126+ def platSel ():
127+ global platform
128+ pSel = True
129+ print "\n "
130+ while pSel :
131+ print "1-MongoDB"
132+ print "2-CouchDB"
133+ pSel = raw_input ("Select a platform: " )
134+
135+ if pSel == "1" :
136+ platform = "MongoDB"
137+ return
138+
139+ elif pSel == "2" :
140+ platform = "CouchDB"
141+ return
142+ else :
143+ psel = True
144+ raw_input ("Invalid selection. Press enter to continue." )
119145
120146def options ():
121147 global victim
@@ -1555,8 +1581,9 @@ def accessCheck(ip,port,pingIt):
15551581 return [3 ,None ]
15561582
15571583
1558- def massMongo ():
1584+ def massScan ():
15591585 global victim
1586+ global platform
15601587 optCheck = True
15611588 loadCheck = False
15621589 ping = False
@@ -1566,9 +1593,9 @@ def massMongo():
15661593 commError = []
15671594 ipList = []
15681595 print "\n "
1569- print "MongoDB Default Access Scanner"
1596+ print platform + " Default Access Scanner"
15701597 print "=============================="
1571- print "1-Scan a subnet for default MongoDB access"
1598+ print "1-Scan a subnet for default " + platform + " access"
15721599 print "2-Loads IPs to scan from a file"
15731600 print "3-Enable/disable host pings before attempting connection"
15741601 print "x-Return to main menu"
@@ -1614,19 +1641,24 @@ def massMongo():
16141641
16151642 print "\n "
16161643 for target in ipList :
1617- result = accessCheck (target .rstrip (),27017 ,ping )
1644+
1645+ if platform == "MongoDB" :
1646+ result = accessCheck (target .rstrip (),27017 ,ping )
1647+
1648+ elif platform == "CouchDB" :
1649+ result = nsmcouch .couchScan (target .rstrip ,5984 ,ping )
16181650
16191651 if result [0 ] == 0 :
1620- print "Successful default access on " + target .rstrip () + "(Mongo Version: " + result [1 ] + ")."
1652+ print "Successful default access on " + target .rstrip () + "(" + platform + " Version: " + result [1 ] + ")."
16211653 success .append (target .rstrip ())
16221654 versions .append (result [1 ])
16231655
16241656 elif result [0 ] == 1 :
1625- print "MongoDB running but credentials required on " + target .rstrip () + "."
1657+ print platform + " running but credentials required on " + target .rstrip () + "."
16261658 creds .append (target .rstrip ()) #Future use
16271659
16281660 elif result [0 ] == 2 :
1629- print "Successful MongoDB connection to " + target .rstrip () + " but error executing command."
1661+ print "Successful " + platform + " connection to " + target .rstrip () + " but error executing command."
16301662 commError .append (target .rstrip ()) #Future use
16311663
16321664 elif result [0 ] == 3 :
@@ -1646,7 +1678,7 @@ def massMongo():
16461678 outCounter = 0
16471679 try :
16481680 fo = open (savePath , "wb" )
1649- fo .write ("IP Address,MongoDB Version\n " )
1681+ fo .write ("IP Address," + platform + " Version\n " )
16501682 for server in success :
16511683 fo .write (server + "," + versions [outCounter ] + "\n " )
16521684 outCounter += 1
@@ -1662,7 +1694,7 @@ def massMongo():
16621694 else :
16631695 select = True
16641696
1665- print "Discovered MongoDB Servers with No Auth:"
1697+ print "Discovered " + platform + " Servers with No Auth:"
16661698 print "IP" + " " + "Version"
16671699
16681700 outCounter = 1
0 commit comments