Not compatible with Python 3.7
tmsteen opened this issue · comments
This line here breaks in Python versions starting with 3.7 due to updates to the socket
library.
From the documentation for the socket
library (https://docs.python.org/3/library/socket.html) the socket.getaddrinfo
method has this message:
Changed in version 3.7: for IPv6 multicast addresses, string representing an address will not contain %scope part.
In the current version, running on Python 3.7.2, you will get an error:
Traceback (most recent call last):
File "/usr/local/bin/mitm6", line 11, in <module>
load_entry_point('mitm6==0.2.1', 'console_scripts', 'mitm6')()
File "/usr/local/lib/python3.7/site-packages/mitm6-0.2.1-py3.7.egg/mitm6/mitm6.py", line 362, in main
File "/usr/local/lib/python3.7/site-packages/mitm6-0.2.1-py3.7.egg/mitm6/mitm6.py", line 284, in setupFakeDns
File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
If you go and edit the above mentioned line to remove the additional %...
the error goes away.
I do not know what this does to the overall functionality of the tool, otherwise I would have just included the PR. Unfortunately, building a good testing environment for this is difficult.
Which OS was this on? I don't get this error on Ubuntu 18 with python 3.7
This would have been in a Python3-Alpine container.
Is there any easy way I can test that? I'm not too familiar with using containers and Alpine.
Here is what I did, assuming you have Docker installed on your platform.
This is the Dockerfile
I used.
FROM python:3-alpine
RUN apk add --no-cache git \
gcc \
musl-dev \
linux-headers
WORKDIR /opt
RUN git clone https://github.com/fox-it/mitm6.git
WORKDIR /opt/mitm6/
RUN pip install -r requirements.txt
RUN python setup.py install
ENTRYPOINT ["mitm6"]
Build with:
docker build -t mitm6 <path with Dockerfile>
Then run with:
sudo docker run --net=host --name mitm6 --privileged -it mitm6 [args]
Let me know if you need me to test anything on my end.