Te-k / harpoon

CLI tool for open source and threat intelligence
https://www.randhome.io/blog/2018/02/23/harpoon-an-osint-/-threat-intelligence-tool/
GNU General Public License v3.0
1.15k stars 185 forks source link

ImportError: cannot import name 'MODE_FD' #80

Closed njzy closed 6 years ago

njzy commented 6 years ago
root@yeti:~# pip3 install maxminddb==1.2.1
Collecting maxminddb==1.2.1
  Downloading https://files.pythonhosted.org/packages/9d/b0/eaad0edc7570e568e713730f9bc2f40888c1a25f96dc6bee0e7413b0025a/maxminddb-1.2.1.tar.gz (1.3MB)
    100% |████████████████████████████████| 1.4MB 35kB/s 
Building wheels for collected packages: maxminddb
  Running setup.py bdist_wheel for maxminddb ... done
  Stored in directory: /root/.cache/pip/wheels/59/98/84/fd6ed5ecd72ce1c566ffc269c63a179f63e7ce3c10df96ff7f
Successfully built maxminddb
Installing collected packages: maxminddb
Successfully installed maxminddb-1.2.1
root@yeti:~# harpoon 
Traceback (most recent call last):
  File "/usr/local/bin/harpoon", line 11, in <module>
    load_entry_point('harpoon==0.1.1', 'console_scripts', 'harpoon')()
  File "/usr/local/lib/python3.6/dist-packages/harpoon-0.1.1-py3.6.egg/harpoon/main.py", line 31, in main
    plugins = init_plugins()
  File "/usr/local/lib/python3.6/dist-packages/harpoon-0.1.1-py3.6.egg/harpoon/main.py", line 18, in init_plugins
    mod = __import__(plugin)
  File "/usr/local/lib/python3.6/dist-packages/harpoon-0.1.1-py3.6.egg/harpoon/commands/domain.py", line 8, in <module>
    import geoip2.database
  File "/usr/local/lib/python3.6/dist-packages/geoip2/database.py", line 11, in <module>
    from maxminddb import (MODE_AUTO, MODE_MMAP, MODE_MMAP_EXT, MODE_FILE, MODE_MEMORY, MODE_FD)
ImportError: cannot import name 'MODE_FD'

My installation steps are as follows: git clone https://github.com/Te-k/harpoon.git cd harpoon pip3 install -r requirements.txt pip3 install .

Te-k commented 6 years ago

Can you try with maxminddb 1.3.0 ? That's what I have on my system and it works. What is you geoip2 version ?

njzy commented 6 years ago

geoip version? image

maxminddb 1.3.0 has same issue too.

Te-k commented 6 years ago

Can you give pip list and python --version ? I have no clue what it can be tbh. What is your system ?

njzy commented 6 years ago

systeminfo

Linux yeti 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@yeti:~# cat /etc/issue
Ubuntu 18.04 LTS \n \l

pip list

root@yeti:~# pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
archiveis (0.0.4)
asn1crypto (0.24.0)
attrs (17.4.0)
Automat (0.6.0)
beautifulsoup4 (4.6.0)
blinker (1.4)
censys (0.0.8)
certifi (2018.1.18)
chardet (3.0.4)
click (6.7)
click-plugins (1.0.3)
cloud-init (18.2)
colorama (0.3.7)
command-not-found (0.3)
CommonMark (0.7.5)
configobj (5.0.6)
configparser (3.5.0)
consolemd (0.4.0)
constantly (15.1.0)
cryptography (2.1.4)
distro-info (0.18)
dnspython (1.15.0)
ez-setup (0.9)
FullContact.py (0.0.6)
future (0.16.0)
geoip2 (2.8.0)
harpoon (0.1.1)
httplib2 (0.9.2)
hyperlink (17.3.1)
idna (2.6)
incremental (16.10.1)
IPy (0.83)
Jinja2 (2.10)
jsonpatch (1.16)
jsonpointer (1.10)
jsonschema (2.6.0)
keyring (10.6.0)
keyrings.alt (3.0)
language-selector (0.1)
lxml (4.2.1)
MarkupSafe (1.0)
maxminddb (1.2.1)
mispy (0.2)
netaddr (0.7.19)
oauthlib (2.0.6)
OTXv2 (1.2)
PAM (0.4.2)
passivetotal (1.0.30)
pip (9.0.1)
pyaes (1.6.1)
pyasn (1.6.0b1)
pyasn1 (0.4.2)
pyasn1-modules (0.2.1)
pycrtsh (0.1)
pycrypto (2.6.1)
PyGithub (1.39)
Pygments (2.2.0)
pygobject (3.26.1)
pygreynoise (0.1)
pyhunter (0.3)
PyJWT (1.5.3)
pyOpenSSL (17.5.0)
pypermacc (0.1.1)
pysafe (0.1)
pyserial (3.4)
PySocks (1.6.8)
python-apt (1.6.0)
python-dateutil (2.7.3)
python-debian (0.1.32)
pythreatgrid (0.1.1)
pyxdg (0.25)
PyYAML (3.12)
requests (2.18.4)
requests-oauthlib (0.8.0)
requests-unixsocket (0.1.5)
rsa (3.4.2)
SecretStorage (2.3.1)
selenium (3.12.0)
service-identity (16.0.0)
setproctitle (1.1.10)
setuptools (39.0.1)
shodan (1.7.7)
simplejson (3.15.0)
six (1.11.0)
spyonweb (0.1)
ssh-import-id (5.7)
systemd-python (234)
Telethon (0.19.0.1)
tweepy (3.6.0)
Twisted (17.9.0)
ufw (0.35)
unattended-upgrades (0.1)
urllib3 (1.22)
virtualenv (15.1.0)
virustotal-api (1.1.10)
wheel (0.30.0)
XlsxWriter (1.0.5)
zope.interface (4.3.2)

python version

root@yeti:~# python --version
Python 3.6.5
Te-k commented 6 years ago

Indeed, it seems to be a problem with maxmindd < 1.4.0. With 1.3.0 and below :

>>> from maxminddb import (MODE_AUTO, MODE_MMAP, MODE_MMAP_EXT, MODE_FILE, MODE_MEMORY, MODE_FD)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'MODE_FD'
>>> 

With 1.4.0 :

>>> from maxminddb import (MODE_AUTO, MODE_MMAP, MODE_MMAP_EXT, MODE_FILE, MODE_MEMORY, MODE_FD)
>>> 

Can you update maxminddb (pip install maxminddb -U) and see if it is fixed ?

If yes, I will update the requirements.txt

njzy commented 6 years ago

Hi Tek maxminddb 1.4.0 is work

Te-k commented 6 years ago

Cool, I updated requirements.txt and added a line in the known bug wiki page. I close the issue then.