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

Skip to content

Commit 26cf6c2

Browse files
committed
Adjusted impacket import check
1 parent ed1f2da commit 26cf6c2

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

extra/icmpsh/icmpsh_m.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
import socket
2626
import sys
2727

28-
from impacket import ImpactDecoder
29-
from impacket import ImpactPacket
28+
try:
29+
from impacket import ImpactDecoder
30+
from impacket import ImpactPacket
31+
except ImportError, _:
32+
pass
3033

3134
def main(src, dst):
3235
# Make standard input a non-blocking file

plugins/generic/takeover.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from lib.core.data import conf
1313
from lib.core.data import kb
1414
from lib.core.data import logger
15+
from lib.core.exception import sqlmapMissingDependence
1516
from lib.core.exception import sqlmapMissingMandatoryOptionException
1617
from lib.core.exception import sqlmapMissingPrivileges
1718
from lib.core.exception import sqlmapNotVulnerableException
@@ -126,6 +127,15 @@ def osPwn(self):
126127
errMsg += "sniff and craft ICMP packets"
127128
raise sqlmapMissingPrivileges, errMsg
128129

130+
try:
131+
from impacket import ImpactDecoder
132+
from impacket import ImpactPacket
133+
except ImportError, _:
134+
errMsg = "sqlmap requires 'impacket' third-party library "
135+
errMsg += "in order to run icmpsh master. Download from "
136+
errMsg += "http://oss.coresecurity.com/projects/impacket.html"
137+
raise sqlmapMissingDependence, errMsg
138+
129139
if kb.stackedTest or conf.direct:
130140
web = False
131141

0 commit comments

Comments
 (0)