dirkjanm / mitm6

pwning IPv4 via IPv6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

global name 'IP' is not defined

daniel-infosec opened this issue · comments

After running mitm6 for a while, I begin seeing the following error:

Unhandled Error Traceback (most recent call last): File "mitm6.py", line 286, in <module> main() File "mitm6.py", line 283, in main reactor.run() File "/root/.pyenv/versions/mitm6v2/local/lib/python2.7/site-packages/Twisted-17.9.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 1243, in run self.mainLoop() File "/root/.pyenv/versions/mitm6v2/local/lib/python2.7/site-packages/Twisted-17.9.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 1252, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/root/.pyenv/versions/mitm6v2/local/lib/python2.7/site-packages/Twisted-17.9.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 851, in runUntilCurrent f(*a, **kw) File "mitm6.py", line 212, in parsepacket send_dns_reply(p) File "mitm6.py", line 137, in send_dns_reply ip = p[IP] exceptions.NameError: global name 'IP' is not defined

Restarting the application will result in this error reappearing. The only way I could fix it was reinstalling the application, but then the error reappeared.

I installed the application in a pyenv virtualenv, python version 2.7.9.

uname -a

Linux XXXXXX 4.0.0-kali1-amd64 #1 SMP Debian 4.0.4-1+kali2 (2015-06-03) x86_64 GNU/Linux

Seems like there is an import missing. Could you try to change line 2:

from scapy.all import sniff, ls, ARP, IPv6, DNS, DNSRR, Ether, conf

to this:

from scapy.all import sniff, ls, ARP, IPv6, DNS, DNSRR, Ether, conf, IP

And see if the error comes up again?

That appears to have resolved it. I also didn't get this error in python 3, so I just switched to that.

I'm curious why it would work at first and then fail repeatedly after a period of time.

Well that code only is used when someone attempts to use your machine as DNS server over IPv4, which isn't something that should happen a lot

Also thanks for confirming, I'll push a fix this weekend