Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Using Python 2 only? #53

Open
liar666 opened this issue Oct 27, 2017 · 4 comments
Open

Using Python 2 only? #53

liar666 opened this issue Oct 27, 2017 · 4 comments

Comments

@liar666
Copy link

liar666 commented Oct 27, 2017

Hi,

After installing a clean python3 virtualenv I get:

~$ amsterdam -d ams-test -i wlan0 setup
Traceback (most recent call last):
File "/home/gmuller/amsterdam-test/bin/amsterdam", line 46, in
ams = Amsterdam(args.name, args.iface, basepath)
File "/home/gmuller/amsterdam-test/lib/python3.6/site-packages/amsterdam/amsterdam.py", line 47, in init
self.check_environment()
File "/home/gmuller/amsterdam-test/lib/python3.6/site-packages/amsterdam/amsterdam.py", line 112, in check_environment
self.name.decode('ascii')
AttributeError: 'str' object has no attribute 'decode'

According to:
https://stackoverflow.com/questions/26014209/python-3-4-str-attributeerror-str-object-has-no-attribute-decode#comment40743496_26014209

The problem is that the code is written for python2...

Would have been great to read a wraning about that somewhere, before installing the whole Python3 env...
e.g. on pages:
https://www.stamus-networks.com/2016/06/02/amsterdam-1-0-selks-and-docker/
or
https://github.com/StamusNetworks/Amsterdam

Thanks for the job anyway, ELK+Suricata+Scirius+Evebox all look fabulous!

@liar666
Copy link
Author

liar666 commented Oct 27, 2017

I've reinstalled everything with python2.7.

I can confirm this is a requirement. Would be great to specify that somewhere.

Also, when I ran

$ amsterdam -d ams-first -i wlan0 -setup
Traceback (most recent call last):
  File "/home/gmuller/amsterdam-python2/bin/amsterdam", line 21, in <module>
    from amsterdam import Amsterdam, AmsterdamException, AMSTERDAM_VERSION
  File "/home/gmuller/amsterdam-python2/local/lib/python2.7/site-packages/amsterdam/__init__.py", line 2, in <module>
    from .amsterdam import *
  File "/home/gmuller/amsterdam-python2/local/lib/python2.7/site-packages/amsterdam/amsterdam.py", line 28, in <module>
    from docker import Client
ImportError: cannot import name Client

After some research, I found that you're using theold docker API. The solution is to remove recent one:

$ pip uninstall docker
$ pip install docker-py

Would be great (at least for newbies like me) if that could be written somewhere.

@tsikerdekis
Copy link

I am getting a subsequent error based on this guide and I was wondering anyone encountered it as well.

amsterdam -d ams-test -i wlo0 setup
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
"int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int or float.

@iBreaker
Copy link

➜ /data/compare-traffic3 amsterdam -d ams -i ens9f3 setup
Traceback (most recent call last):
File "/usr/bin/amsterdam", line 46, in
ams = Amsterdam(args.name, args.iface, basepath)
File "/usr/lib/python2.7/site-packages/amsterdam/amsterdam.py", line 47, in init
self.check_environment()
File "/usr/lib/python2.7/site-packages/amsterdam/amsterdam.py", line 119, in check_environment
self.api_version = Client().version()['ApiVersion']
File "/usr/lib/python2.7/site-packages/docker/api/daemon.py", line 76, in version
return self._result(self._get(url), json=True)
File "/usr/lib/python2.7/site-packages/docker/utils/decorators.py", line 47, in inner
return f(self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 139, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 582, in urlopen
timeout_obj = self._get_timeout(timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 309, in _get_timeout
return Timeout.from_float(timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 154, in from_float
return Timeout(read=timeout, connect=timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 97, in init
self._connect = self._validate_timeout(connect, 'connect')
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
"int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int or float.

@pevma
Copy link
Member

pevma commented Nov 30, 2017

What OS are you guys using ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants