Skip to content

Commit 932a42c

Browse files
tcstooltcstool
authored andcommitted
Scan speed enhancements
1 parent a0ed906 commit 932a42c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

nosqlmap.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,11 +1338,11 @@ def stealDBs(myDB):
13381338
def accessCheck(ip,port,pingIt):
13391339

13401340
if pingIt == True:
1341-
test = os.system("ping -w 0.1 -c 1 " + ip + ">/dev/null")
1341+
test = os.system("ping -c 1 -n -W 1 " + ip + ">/dev/null")
13421342

13431343
if test == 0:
13441344
try:
1345-
conn = pymongo.MongoClient(ip,port)
1345+
conn = pymongo.MongoClient(ip,port,connectTimeoutMS=4000,socketTimeoutMS=4000)
13461346

13471347
try:
13481348
dbList = conn.database_names()
@@ -1365,7 +1365,7 @@ def accessCheck(ip,port,pingIt):
13651365
return 4
13661366
else:
13671367
try:
1368-
conn = pymongo.MongoClient(ip,port)
1368+
conn = pymongo.MongoClient(ip,port,connectTimeoutMS=2000)
13691369

13701370
try:
13711371
dbList = conn.database_names()
@@ -1442,25 +1442,25 @@ def massMongo():
14421442

14431443
print "\n"
14441444
for target in ipList:
1445-
result = accessCheck(target,27017,ping)
1445+
result = accessCheck(target.rstrip(),27017,ping)
14461446

14471447
if result == 0:
1448-
print "Successful default access on " + target + "."
1448+
print "Successful default access on " + target.rstrip() + "."
14491449
success.append(target)
14501450

14511451
elif result == 1:
1452-
print "MongoDB running but credentials required on " + target + "."
1452+
print "MongoDB running but credentials required on " + target.rstrip() + "."
14531453
success.append(target)
14541454

14551455
elif result == 2:
14561456
print "Successful MongoDB connection but error executing command."
14571457
success.append(target)
14581458

14591459
elif result == 3:
1460-
print "Couldn't connect to " + target + "."
1460+
print "Couldn't connect to " + target.rstrip() + "."
14611461

14621462
elif result == 4:
1463-
print target + " didn't respond to ping."
1463+
print target.rstrip() + " didn't respond to ping."
14641464

14651465

14661466
print "\n\n"

0 commit comments

Comments
 (0)