File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020from lib .core .revision import getRevisionNumber
2121
2222# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23- VERSION = "1.0.4.16 "
23+ VERSION = "1.0.4.17 "
2424REVISION = getRevisionNumber ()
2525STABLE = VERSION .count ('.' ) <= 2
2626VERSION_STRING = "sqlmap/%s#%s" % (VERSION , "stable" if STABLE else "dev" )
Original file line number Diff line number Diff line change 66"""
77
88import os
9+ import re
10+ import socket
911import time
1012
1113from extra .icmpsh .icmpsh_m import main as icmpshmaster
@@ -54,15 +56,29 @@ def _selectLhost(self):
5456 if self .localIP :
5557 message += "[Enter for '%s' (detected)] " % self .localIP
5658
57- while not address :
58- address = readInput (message , default = self .localIP )
59+ valid = None
60+ while not valid :
61+ valid = True
62+ address = readInput (message , default = self .localIP or "" )
63+
64+ try :
65+ socket .inet_aton (address )
66+ except socket .error :
67+ valid = False
68+ finally :
69+ valid = valid and re .search (r"\d+\.\d+\.\d+\.\d+" , address ) is not None
5970
6071 if conf .batch and not address :
6172 raise SqlmapDataException ("local host address is missing" )
73+ elif address and not valid :
74+ warnMsg = "invalid local host address"
75+ logger .warn (warnMsg )
6276
6377 return address
6478
6579 def _prepareIngredients (self , encode = True ):
80+ self .localIP = getattr (self , "localIP" , None )
81+ self .remoteIP = getattr (self , "remoteIP" , None )
6682 self .lhostStr = ICMPsh ._selectLhost (self )
6783 self .rhostStr = ICMPsh ._selectRhost (self )
6884
You can’t perform that action at this time.
0 commit comments