77See the file 'doc/COPYING' for copying permission
88"""
99
10+ import os
11+
1012from lib .core .common import readInput
1113from lib .core .common import runningAsAdmin
1214from lib .core .data import conf
@@ -109,7 +111,7 @@ def osPwn(self):
109111 warnMsg = "invalid value, valid values are 1 and 2"
110112 logger .warn (warnMsg )
111113
112- if tunnel == 2 and kb .dbms != "Windows" :
114+ if tunnel == 2 and kb .os != "Windows" :
113115 errMsg = "icmpsh slave is only supported on Windows at "
114116 errMsg += "the moment. The back-end database server is "
115117 errMsg += "not. sqlmap will fallback to TCP (Metasploit)"
@@ -136,6 +138,21 @@ def osPwn(self):
136138 errMsg += "http://oss.coresecurity.com/projects/impacket.html"
137139 raise sqlmapMissingDependence , errMsg
138140
141+ sysIgnoreIcmp = "/proc/sys/net/ipv4/icmp_echo_ignore_all"
142+
143+ if os .path .exists (sysIgnoreIcmp ):
144+ fp = open (sysIgnoreIcmp , "wb" )
145+ fp .write ("1" )
146+ fp .close ()
147+ else :
148+ errMsg = "you need to disable ICMP replies by your machine "
149+ errMsg += "system-wide. For example run on Linux/Unix:\n "
150+ errMsg += "# sysctl -w net.ipv4.icmp_echo_ignore_all=1\n "
151+ errMsg += "If you miss doing that, you will receive "
152+ errMsg += "information from the database server and it "
153+ errMsg += "is unlikely to receive commands send from you"
154+ logger .error (errMsg )
155+
139156 if kb .stackedTest or conf .direct :
140157 web = False
141158
0 commit comments