Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4b74c2

Browse files
committed
Fixes #1810
1 parent 55b23e7 commit c4b74c2

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from 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"
2424
REVISION = getRevisionNumber()
2525
STABLE = VERSION.count('.') <= 2
2626
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")

lib/takeover/icmpsh.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"""
77

88
import os
9+
import re
10+
import socket
911
import time
1012

1113
from 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

0 commit comments

Comments
 (0)