stampery / mongoaudit

🔥 A powerful MongoDB auditing and pentesting tool 🔥
https://mongoaud.it
MIT License
1.32k stars 136 forks source link

Error exit with "TypeError: _socket_for_writes() takes exactly 2 arguments (1 given)" #45

Closed akira-kurogane closed 4 years ago

akira-kurogane commented 4 years ago

Whilst running either the basic (no-auth connection) or advanced (auth connection) tests I found mongoaudit error exit back to normal shell with this backtrace:

Traceback (most recent call last):
  File ".local/bin/mongoaudit", line 10, in <module>
    sys.exit(main())
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/__main__.py", line 64, in main
    App().main()
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/__main__.py", line 23, in __init__
    self.main()
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/__main__.py", line 58, in main
    self.loop.run()
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 286, in run
    self._run()
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 384, in _run
    self.event_loop.run()
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 788, in run
    self._loop()
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 825, in _loop
    self._watch_files[fd]()
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/raw_display.py", line 404, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/raw_display.py", line 502, in parse_input
    callback(processed, processed_codes)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 411, in _update
    self.process_input(keys)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/main_loop.py", line 511, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/container.py", line 595, in keypress
    *self.calculate_padding_filler(size, True)), key)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/widgets.py", line 220, in keypress
    return self.__super.keypress(size, key)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/decoration.py", line 622, in keypress
    return self._original_widget.keypress(maxvals, key)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/akira/.local/lib/python2.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/widgets.py", line 145, in keypress
    self.next_callback()
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/widgets.py", line 184, in next
    self.callbacks['next'](form=self, **(self.get_field_values()))
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/cards.py", line 101, in _next
    self.run_test(cred, title, tester, tests)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/cards.py", line 129, in run_test
    test_runner.run(self.app)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/widgets.py", line 271, in run
    self.tester.run(self.each, self.end)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/testers/testers.py", line 45, in run
    res = test.run()
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/testers/testers.py", line 161, in run
    test_result = TEST_FUNCTIONS[self.test_name](self)
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/testers/decorators.py", line 6, in userinfo_available
    return func(test) if test.tester.info else 3
  File "/home/akira/.local/lib/python2.7/site-packages/mongoaudit/testers/tls.py", line 25, in enabled
    with test.tester.conn._socket_for_writes() as socket_info:
TypeError: _socket_for_writes() takes exactly 2 arguments (1 given)

Environment is Ubuntu 19.10. Python 2.7.17rc1. mongoaudit installed via pip. Test connections were against a 4.2 MongoDB cluster of nodes all on localhost. Error occurs whether to a mongos or mongod. Authentication enabled but no TLS options on.

daili0802 commented 4 years ago

Running into same issue, environment is ubuntu server 18.04, python 2.7.15.

curtbraz commented 4 years ago

Same, multiple environments.

elecay commented 4 years ago

Per setup.py, the latest version of pymongo is being installed ('pymongo>=3.3.1'). In version 3.6 of pymongo, a session parameter was added to _socket_for_writes(). Of course, they can do that because this is a private method and shouldn't be used.

So, a quick fix could be installing manually a previous version of pymongo, like pip install pymongo==3.5.1.

I will push a permanent fix for this as soon as I can.

curtbraz commented 4 years ago

Ahh, makes sense! Sorry for the oversight but appreciate the super quick response!!

On Fri, Dec 6, 2019, 7:51 AM Sebastián Rajo notifications@github.com wrote:

Per setup.py, the latest version of pymongo is being installed ('pymongo>=3.3.1'). In version 3.6 of pymongo, a session parameter was added to _socket_for_writes(). Of course, they can do that because this is a private method and shouldn't be used.

So, a quick fix could be installing manually a previous version of pymongo, like pip install pymongo==3.5.1.

I will push a permanent fix for this as soon as I can.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stampery/mongoaudit/issues/45?email_source=notifications&email_token=AEIB6IDBDWNNRYV7TGD3FIDQXJDGHA5CNFSM4JE6YTKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGD7U7A#issuecomment-562559612, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB6IADVBQDQUZ5WYAQHBTQXJDGHANCNFSM4JE6YTKA .

daili0802 commented 4 years ago

Thank you very much elecay!