Cortex-Analyzers icon indicating copy to clipboard operation
Cortex-Analyzers copied to clipboard

Cortex Analysers fails : No module named 'requests'

Open lissymaria opened this issue 4 years ago • 4 comments

Request Type

Bug

Work Environment

(replace with N/A if not applicable)

Question Answer
TheHive version 4
OS version (server) RedHat
OS version (client) Seven
Cortex Analyzer Name OTXQuery, Pulsedive, VirusTotal etc
Cortex Version 3.1.0-1
ElasticSearch client 7.9.1

Description

Most of the Analysers are failed to run with the following error messages. Traceback (most recent call last): File "/xxx/Cortex-Analyzers/analyzers/OTXQuery/otxquery.py", line 4, in import requestsModuleNotFoundError: No module named 'requests'

Traceback (most recent call last): File "/opt/Cortex-Analyzers/analyzers/Abuse_Finder/abusefinder.py", line 9, in from abuse_finder import domain_abuse, ip_abuse, \ModuleNotFoundError: No module named 'abuse_finder'

Installed both Python2.7 and Python 3.6. When I tried to install dependencies manually, it shows that requirements are already satisfied.

When we upgrade the pip version python 27 breaks.

Sample error log ImportError: /opt/rh/python27/root/usr/lib64/python2.7/lib-dynload/_io.so: undefined symbol: _PyErr_ReplaceException Traceback (most recent call last): File "/opt/rh/python27/root/usr/bin/pip", line 5, in from pkg_resources import load_entry_point File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/pkg_resources.py", line 16, in import sys, os, time, re, imp, types, zipfile, zipimport File "/opt/rh/python27/root/usr/lib64/python2.7/zipfile.py", line 6, in import io File "/opt/rh/python27/root/usr/lib64/python2.7/io.py", line 51, in import _io

lissymaria avatar Mar 12 '21 11:03 lissymaria

Hi, from the error I cannot understand properly what's going on. Can you please specify how have you installed cortex [package or docker] and if you have copied analyzer locally or are running them with docker?

dadokkio avatar Mar 12 '21 13:03 dadokkio

I have installed cortex package not docker version.

lissymaria avatar Mar 13 '21 08:03 lissymaria

Ok..in any analyzer folder there is a requirements.txt file with specific dependencies for the analyzer.. you need to install them with: pip3 install -r requirements.txt

dadokkio avatar Mar 13 '21 08:03 dadokkio

I ran the above command and it gave the following output

Requirement already satisfied: cortexutils in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (2.1.0) Requirement already satisfied: future in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (0.18.2) Requirement already satisfied: requests in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (2.25.1) Requirement already satisfied: virustotal-api in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from -r requirements.txt (line 4)) (1.1.11) Requirement already satisfied: idna<3,>=2.5 in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 3)) (2.10) Requirement already satisfied: chardet<5,>=3.0.2 in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 3)) (4.0.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 3)) (1.26.3) Requirement already satisfied: certifi>=2017.4.17 in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 3)) (2020.12.5)

lissymaria avatar Mar 15 '21 10:03 lissymaria