calebstewart / python-htb

A Python API for Hack the Box platform interaction
63 stars 13 forks source link

Error while lab connect #4

Closed Brazier85 closed 4 years ago

Brazier85 commented 4 years ago

Hi, I get the following error when I try to connect htb:

[-] debug - was: False
now: True
htb ➜ lab connect
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/cmd2/cmd2.py", line 1657, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
  File "/usr/local/lib/python3.7/dist-packages/cmd2/cmd2.py", line 2064, in onecmd
    stop = func(statement)
  File "/usr/local/lib/python3.7/dist-packages/cmd2/decorators.py", line 223, in cmd_wrapper
    return func(cmd2_app, args)
  File "/usr/local/lib/python3.7/dist-packages/htb/__main__.py", line 746, in do_lab
    actions[args.action](args)
  File "/usr/local/lib/python3.7/dist-packages/htb/__main__.py", line 812, in _lab_connect
    for device in NetworkManager.NetworkManager.GetDevices():
  File "<string>", line 8, in GetDevices
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 550, in to_python
    val = fixups.base_to_python(val)
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 607, in base_to_python
    return [fixups.base_to_python(x) for x in val]
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 607, in <listcomp>
    return [fixups.base_to_python(x) for x in val]
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 620, in base_to_python
    return globals()[classname](val)
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 348, in __new__
    klass = device_class(obj.Get('org.freedesktop.NetworkManager.Device', 'DeviceType', dbus_interface='org.freedesktop.DBus.Properties'))
  File "/usr/local/lib/python3.7/dist-packages/NetworkManager.py", line 393, in device_class
    }[typ]
KeyError: dbus.UInt32(30, variant_level=1)
EXCEPTION of type 'KeyError' occurred with message: 'dbus.UInt32(30, variant_level=1)'
calebstewart commented 4 years ago

I forgot to mention this in the README. There's a bug in python-networkmanager that causes this to happen. I submitted a pull request upstream, but it hasn't been accepted. setup.py references my fork of python-networkmanager as a dependency, but if you already have the upstream installed, you'll get this.

You can either replace your installation of python-networkmanager with my fork, or install python-htb in a virtual environment.

Brazier85 commented 4 years ago

Thanks for the reply. I installed your fork and it works. Awesome work. Please keep it up.