Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] listing Emails #20

Closed
Davdavidid opened this issue Jul 4, 2022 · 6 comments
Closed

[BUG] listing Emails #20

Davdavidid opened this issue Jul 4, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@Davdavidid
Copy link

Hello again,
i set up ThePhish from scratch and integrated theHive, MISP and Cortex correctly. When trying to fetch Emails though i get the following traceback. I tested 2 Email-Adresses, using the data i already used sucessfully on a docker build.

[ERROR]_[list_emails]: Error while trying to connect to IMAP server: Traceback (most recent call last):
File "/etc/ThePhish/app/list_emails.py", line 243, in main
connection = connect_to_IMAP_server()
File "/etc/ThePhish/app/list_emails.py", line 21, in connect_to_IMAP_server
connection.login(config['imapUser'], config['imapPassword'])
File "/usr/lib/python3.8/imaplib.py", line 601, in login
typ, dat = self._simple_command('LOGIN', user, self._quote(password))
File "/usr/lib/python3.8/imaplib.py", line 1205, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python3.8/imaplib.py", line 1030, in _command_complete
raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.IMAP4.error: LOGIN command error: BAD [b'Not enough arguments provided 8mb428246745wrb']

Work environment
| -------------------------- | ------------------------------------- |
| OS version (server) | Ubuntu 20.04.4 |
| OS version (client) | Ubuntu 20.04.4 |
| Python version | 3.8.10 |
| Type of email address used | Gmail, 365 |
| Browser type & version | Firefox, Chromium |
| Virtualized Env. | True |
| Dedicated RAM | 24 GB |
| vCPU | 8 |
| ThePhish version | latest |
| TheHive version | 4.1.22-1 |
| Cortex version | 3.1.6-1 |
| MISP version | 2.4.159 |
| Installed using Docker and Docker Compose | False |

To Reproduce

start ThePhish with:
cd /etc/ThePhish/app/
python3 thephish_app.py

navigate to localhost:8080 and click "List Emails"

Expected behavior

ThePhish connecting to inbox and getting Emails.

Screenshots
grafik

Solution
I tried to search for that problem but couldn't find something helpfull. Would be great if you have an idea on how to resolve this issue.

Thanks in advance

@Davdavidid Davdavidid added the bug Something isn't working label Jul 4, 2022
@emalderson
Copy link
Owner

Hi, are you sure that you have correctly configured the credentials to access the mailbox in the configuration file?

@Davdavidid
Copy link
Author

Just double checked both Mailbox-credentials (gmail, 365) with config files i got from a working docker installation and i'm positive it is correct. Also used a clean config backup with those credentials and still getting the same error (with only the letters at the end changing).

@Davdavidid
Copy link
Author

I did some more testing but couldn't get the system running. But I documented some more details from the installation process.

I first tried to install the requirements, following your documentation, with pip install -r requirements.txt but that skips after 1 process with:

ERROR: Could not find a version that satisfies the requirement bidict==0.21.2 (from -r requirements.txt (line 3)) (from versions: 0.1.5, 0.2.1, 0.3.0, 0.3.1, 0.9.0rc0, 0.9.0.post1, 0.10.0, 0.10.0.post1, 0.11.0, 0.12.0.post1, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.15.0.dev0, 0.15.0.dev1, 0.15.0rc1, 0.15.0, 0.16.0, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.17.5, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4)
ERROR: No matching distribution found for bidict==0.21.2 (from -r requirements.txt (line 3))

That's why i went with pip3 install -r requirements.txt which worked but would end with this message:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sdklib 1.10.3 requires urllib3==1.22, but you have urllib3 1.26.6 which is incompatible.
pymisp 2.4.159 requires requests<3.0.0,>=2.27.1, but you have requests 2.26.0 which is incompatible.
hatching-triage 0.1.7 requires click==8.0.3, but you have click 8.0.1 which is incompatible.
hatching-triage 0.1.7 requires requests==2.25.1, but you have requests 2.26.0 which is incompatible.
grr-api-client 3.4.6.post0 requires cryptography==3.3.2, but you have cryptography 37.0.2 which is incompatible.
grr-api-client 3.4.6.post0 requires requests==2.25.1, but you have requests 2.26.0 which is incompatible.
grr-api-client 3.4.6.post0 requires Werkzeug<=1.0.1,>=0.16.0, but you have werkzeug 2.0.1 which is incompatible.
checkdmarc 4.4.1 requires dnspython>=2.0.0, but you have dnspython 1.16.0 which is incompatible.

Successfully installed Flask-2.0.1 Flask-SocketIO-5.1.1 Jinja2-3.0.1 MarkupSafe-2.0.1 Werkzeug-2.0.1 attrs-21.2.0 beautifulsoup4-4.9.3 bidict-0.21.2 certifi-2021.5.30 charset-normalizer-2.0.4 click-8.0.1 cortex4py-2.1.0 d8s-dicts-0.6.0 d8s-hypothesis-0.6.0 d8s-lists-0.8.0 d8s-math-0.7.0 d8s-strings-0.5.0 d8s-uuids-0.6.0 dictdiffer-0.9.0 dnspython-1.16.0 emoji-1.4.2 eventlet-0.31.1 greenlet-1.1.1 hypothesis-6.15.0 idna-3.2 inflect-5.3.0 ioc-fanger-3.3.0 ioc-finder-6.0.1 itsdangerous-2.0.1 more-itertools-8.8.0 mpmath-1.2.1 number-tools-0.1.0 pyparsing-2.4.7 python-engineio-4.2.1 python-magic-0.4.24 python-socketio-5.4.0 requests-2.26.0 sortedcontainers-2.4.0 soupsieve-2.2.1 sympy-1.8 typing-3.7.4.3 urllib3-1.26.6

I thought i resolved those issues by manually installing the required parts with:

pip3 install dnspython
pip3 install urllib3==1.22
pip3 install click==8.0.3
pip3 install requests==2.25.1
pip3 install cryptography==3.3.2
pip3 install Werkzeug==0.16.0

After that the requirements.txt doesn't throw any errors but i guess there is still a problem. Sadly i'm not experiend enough to resolve this issue myself and would be happy if you could point me to the right direction.
Thanks in advance!

@emalderson
Copy link
Owner

ThePhish requires Python 3, so you must use pip3 to install the requirements. Moreover, if you have conflicts, this may be because you are trying to install it in your global environment. You should first create a virtual environment and activate it (as explained in the guide) and then install the requirements using pip3, so as to prevent any conflict.

@Davdavidid
Copy link
Author

Okay that's what i thought but since your guide states to use pip, i did that first. i installed it globally since this is the machines only purpose but i will try the venv.

@Davdavidid
Copy link
Author

Using venv and pip inside solved the problem. Thanks for your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants