Closed ghost closed 6 years ago
Hey @Asuwiel
Thanks for the report. The scripts os_ident.py
, mqtt_check.py
, ping.py
, nmapAnswerMachine.py
and ping6.py
are not yet ported so it make sense errors are thrown.
However, smbrelayx.py
and ntlmrelayxy.py
should be working. Please send me the repro steps to trigger the errors you described.
For the smbrelayx.py
file, I can't call any arguments. I have this message, no matter what I enter
python examples/smbrelayx.py --help 1 ↵
Traceback (most recent call last):
File "examples/smbrelayx.py", line 66, in <module>
from impacket.examples.ntlmrelayx.clients.smbrelayclient import SMBRelayClient
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/anw4re/.virtualenvs/hacking/lib/python3.6/site-packages/impacket-0.9.18.dev0-py3.6.egg/impacket/examples/ntlmrelayx/clients/__init__.py", line 94, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
For the file ntlmrelayx.py
, I get the message when I run it without argument. Even with arguments, the error occurs.
python examples/ntlmrelayx.py
Impacket v0.9.18-dev - Copyright 2018 SecureAuth Corporation
Traceback (most recent call last):
File "examples/ntlmrelayx.py", line 275, in <module>
from impacket.examples.ntlmrelayx.clients import PROTOCOL_CLIENTS
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/anw4re/.virtualenvs/hacking/lib/python3.6/site-packages/impacket-0.9.18.dev0-py3.6.egg/impacket/examples/ntlmrelayx/clients/__init__.py", line 94, in <module>
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
How did you install impacket?.. I'm not getting those errors when running those scripts. However, I'm not using virtualenv now, just setting PYTHONPATH to the cloned repo and calling the examples. Maybe there's something wrong there.
I cloned the repo, did python setup.py install
but in a virtualenv.
With PYTHONPATH set, Everything is working properly
Awesome.. I think I can reproduce it.
Can you try doing the same but instead of python setup.py install
run pip install .
I tried to install impacket with pip install .
and I didn't encounter any problems
Awesome.. so the problem is when running python setup.py install
. I will investigate. I think this is related with a similar problem @dirkjanm had to face in Python2 with ntlmrelayx.py
when the package installed is compressed.
Yes this looks like the same issue I had back then with python2 and eggs, maybe some of the behavior changed in py3 and this way of importing errors out.
Yes, that's the problem. If I decompress the egg, I have no more problems.
Hello,
I quickly tested the scripts in the example folders and found the following errors.
ImpactPacket.py: 57: set_bytes_from_string TypeError: cannot use a str to initialize an array with typecode 'B'
ICMP6.py: 227: __build_echo_message TypeError: cannot use a str to initialize an array with typecode 'B'
mqtt_check.py: 61: print version.BANNER 73: except Exception, e: 93: except Exception, e:
nmapAnswerMachine.py: 4: ModuleNotFoundError: No module named 'uncrc32' 68: print "Initializing %s" % self.class.name 106: print "Got packet for %s" % self.class.name 367: print "Got command: %r" % cmd 664: if options[i+1] == '1': opt.set_ts_echo(0xffffffffL) 769: print self 805: raise Exception, "Couldn't find fingerprint data for %r" % emmulating 857: print "IP ID Delta: %d" % self.ip_ID_delta 858: print "IP ID ICMP Delta: %s" % self.ip_ID_ICMP_delta 895: print "TCP ISN Delta: %f" % self.tcp_ISN_delta 896: print "TCP ISN Standard Deviation: %f" % self.tcp_ISN_stdDev 912: print "TCP TS Delta: %f" % self.tcp_TS_delta 917: self.ip_ID %= 0x10000L 926: self.ip_ID_ICMP %= 0x10000L 936: self.tcp_ISN %= 0x100000000L 938: return answer % 0x100000000L 943: self.tcp_TS %= 0x100000000L 949: print "--> Packet sent:" 997: print """ 1025: print "Emulating: %r" % Fingerprint 1026: print "at %s / %s / %s" % (IFACE, MAC, IP)
ping6.py: 32: print version.BANNER 35: print "Use: %s " % sys.argv[0]
55: print "PING %s %d data bytes" % (dst, len(payload))
80: print "%d bytes from %s: icmp_seq=%d " % (rip.child().get_size()-4,dst,rip.get_echo_sequence_number())
ping.py: 34: print "Use: %s " % sys.argv[0]
85: print "Ping reply for sequence #%d" % ricmp.get_icmp_id()
mqtt.py: 273: except Exception, e 350: except Exception, e 413: print '%s -> %s' % (publish['Topic']['Name'], publish['Message'])
ntlmrelayx.py: 94: TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
smbrelayx.py: 66: TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
os_ident.py: 33: return
self.value
279: TCPOption(TCPOption.TCPOPT_WINDOW, 012), #\003\003\012 SyntaxError: invalid token 2050: print "\"%s\" matches with an accuracy of %.2f%%" \ 2061: print "IOError: %s", err