stamparm / maltrail

Malicious traffic detection system
MIT License
5.94k stars 1.02k forks source link

[Questions and Support] ModuleNotFoundError: No module named 'thirdparty.six.moves' #19244

Closed mrstephenhanson closed 3 months ago

mrstephenhanson commented 4 months ago

Question

Hello, I'm trying to install and run maltrail on Fedora 39, and am running into an issue that I've been unable to find a solution for. Has anyone had this issue or have any ideas on how to solve it?

Support

When trying to start sensor.py:

"sudo python3 sensor.py                                                           
Traceback (most recent call last):
  File "/home/oslo/Security/maltrail/sensor.py", line 33, in <module>
    from core.common import check_connection
  File "/home/oslo/Security/maltrail/core/common.py", line 23, in <module>
    from core.settings import config
  File "/home/oslo/Security/maltrail/core/settings.py", line 23, in <module>
    from thirdparty.six.moves import urllib as _urllib
ModuleNotFoundError: No module named 'thirdparty.six.moves'"

When following best practices, everything succeeds up to this point, #4:

sudo cp /opt/maltrail/maltrail-sensor.service /etc/systemd/system/maltrail-sensor.service
sudo cp /opt/maltrail/maltrail-server.service /etc/systemd/system/maltrail-server.service
sudo systemctl daemon-reload
sudo systemctl start maltrail-server.service
sudo systemctl start maltrail-sensor.service
sudo systemctl enable maltrail-server.service
sudo systemctl enable maltrail-sensor.service
systemctl status maltrail-server.service && systemctl status maltrail-sensor.service

Created symlink /etc/systemd/system/multi-user.target.wants/maltrail-server.service → /etc/systemd/system/maltrail-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/maltrail-sensor.service → /etc/systemd/system/maltrail-sensor.service.
× maltrail-server.service - Maltrail. Server of malicious traffic detection system
     Loaded: loaded (/etc/systemd/system/maltrail-server.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: failed (Result: exit-code) since Fri 2024-03-01 12:38:04 PST; 494ms ago
   Duration: 492ms
       Docs: https://github.com/stamparm/maltrail#readme
             https://github.com/stamparm/maltrail/wiki
   Main PID: 11035 (code=exited, status=1/FAILURE)
        CPU: 65ms

Mar 01 12:38:04 oslobara python3[11035]: Traceback (most recent call last):
Mar 01 12:38:04 oslobara python3[11035]:   File "/opt/maltrail/server.py", line 21, in <module>
Mar 01 12:38:04 oslobara python3[11035]:     from core.common import check_connection
Mar 01 12:38:04 oslobara python3[11035]:   File "/opt/maltrail/core/common.py", line 23, in <module>
Mar 01 12:38:04 oslobara python3[11035]:     from core.settings import config
Mar 01 12:38:04 oslobara python3[11035]:   File "/opt/maltrail/core/settings.py", line 23, in <module>
Mar 01 12:38:04 oslobara python3[11035]:     from thirdparty.six.moves import urllib as _urllib
Mar 01 12:38:04 oslobara python3[11035]: ModuleNotFoundError: No module named 'thirdparty.six.moves'
Mar 01 12:38:04 oslobara systemd[1]: maltrail-server.service: Main process exited, code=exited, status=1/FAILURE
Mar 01 12:38:04 oslobara systemd[1]: maltrail-server.service: Failed with result 'exit-code'.
MikhailKasimov commented 4 months ago

Hello!

Hm, interesting... How (in which way) MT was installed?

Just for test: Try to install MT via RPM-package: https://build.opensuse.org/projects/home:k_mikhail/packages/maltrail/repositories/Fedora_39/binaries and see, if problem also actual for it? Thank you!

stamparm commented 4 months ago

@mrstephenhanson you haven't installed it properly. thirdparty.six.moves is a standard part of the cloned repo.

let me show you an example:

cd /tmp
git clone --depth=1 https://github.com/stamparm/maltrail.git
cd maltrail
ls -la thirdparty.six
python3
from thirdparty.six.moves import urllib as _urllib

image

dermatty commented 3 months ago

Hmm, same problem here. With python3.11 ("python3.11 server.py") everything works, when using python3.12("python3.12 server.py") I get the above error message: No module named 'thirdparty.six.moves'. Found out that - for some reason - under python3.12 relative imports work differently and I had to replace the thirdparty.six.moves imports with:

for python3.12 this works:

from six.moves import urllib as _urllib

for python3.11 the following works

from thirdparty.six.moves import urllib as _urllib
mrstephenhanson commented 3 months ago

Thank you for the help!