sensepost / snoopy-ng

Snoopy v2.0 - modular digital terrestrial tracking framework
Other
431 stars 127 forks source link

Snoopy unable to connect to remote server (401 error) and can't detect or create monitor mode wifi interface on Debian Jessie #57

Open thesle3p opened 9 years ago

thesle3p commented 9 years ago

Hi I am encountering a couple of errors when I try and use the wifi module(s) from Debian Jessie and a remote server of Arch Linux, it seems Snoopy won't recognize a monitor mode interface when previously created with airmon-ng nor is it able to create one using the mon=False swatch, also I am getting a 401 error when trying to connect to the remote server, Am I doing something wrong? Attached is the out put of snoopy from the client I get no output from the server other then the confirmation that the plugins and server is running:

when I run sudo snoopy -m wifi:iface=wlan0,mon=False:wifi_aps:wificlients -d test01 -l homebase -k -s http://:9001/ I get this: / **)( ( )( )( )( ( \/ ) ** \ ) ( )()( )()( )_/ \ / (/()_)()()() () Version: 2.0 Code: glenn@sensepost.com // @glennzw Visit: www.sensepost.com // @sensepost License: Non-commercial use

[+] Starting Snoopy with plugins: wifi [+] Waiting for plugin 'wifi' to indicate it's ready [+] Starting sniffing on interface 'mon0' [!!] Scapy exception whilst sniffing. Will back off for 5 seconds, and try restart 'plugins.wifi' plugin [!!] init() got an unexpected keyword argument 'stopperTimeout' [+] Plugin 'wifi' has indicated it's ready. [+] Done loading plugins, running... [!!] Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details). [!!] No suitable monitor interface available. Will check every 5 seconds, but not display this message again. [!!] Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details). ^CCaught Ctrl+C! Saving data and shutting down... [!!] Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details).

Snoopy.log contains this:

2015-06-11 01:26:21 + snoopy: Starting Snoopy with plugins: wifi 2015-06-11 01:26:21 + snoopy: Waiting for plugin 'wifi' to indicate it's ready 2015-06-11 01:26:21 D monitor_mode.py: Enabling monitor mode on 'wlan0' 2015-06-11 01:26:22 D monitor_mode.py: Enabled monitor mode 'mon0' 2015-06-11 01:26:22 + wifi.py: Starting sniffing on interface 'mon0' 2015-06-11 01:26:22 !! wifi.py: Scapy exception whilst sniffing. Will back off for 5 seconds, and try restart 'plugins.wifi' plugin 2015-06-11 01:26:22 !! wifi.py: init() got an unexpected keyword argument 'stopperTimeout' 2015-06-11 01:26:23 + snoopy: Plugin 'wifi' has indicated it's ready. 2015-06-11 01:26:23 + snoopy: Done loading plugins, running... 2015-06-11 01:26:23 D snoopy: Not syncing table 'bluetooth_details' - no 'sunc' column 2015-06-11 01:26:24 D snoopy: Unable to upload data to 'http://:9001/' - Exception:'HTTP Error 401: UNAUTHORIZED' 2015-06-11 01:26:24 !! snoopy: Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details). 2015-06-11 01:26:24 D snoopy: Not syncing table 'user_agents' - no 'sunc' column 2015-06-11 01:26:27 D monitor_mode.py: Disabling monitor mode on 'mon0' 2015-06-11 01:26:28 D monitor_mode.py: Enabling monitor mode on 'mon0' 2015-06-11 01:26:28 !! wifi.py: No suitable monitor interface available. Will check every 5 seconds, but not display this message again. 2015-06-11 01:26:28 D snoopy: Not syncing table 'bluetooth_details' - no 'sunc' column 2015-06-11 01:26:29 D snoopy: Unable to upload data to 'http://:9001/' - Exception:'HTTP Error 401: UNAUTHORIZED' 2015-06-11 01:26:29 !! snoopy: Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details). 2015-06-11 01:26:29 D snoopy: Not syncing table 'user_agents' - no 'sunc' column 2015-06-11 01:26:32 D snoopy: Not syncing table 'bluetooth_details' - no 'sunc' column 2015-06-11 01:26:32 D snoopy: Unable to upload data to 'http://:9001/' - Exception:'HTTP Error 401: UNAUTHORIZED' 2015-06-11 01:26:32 !! snoopy: Unable to upload 9 rows from table 'sessions'. Moving to next table (check logs for details). 2015-06-11 01:26:32 D snoopy: Not syncing table 'user_agents' - no 'sunc' column

glennzw commented 9 years ago

Looking at your command:

snoopy -m wifi:iface=wlan0,mon=False:wifi_aps:wifi_clients -d test01 -l homebase -k -s http://:9001/

  1. I'm not sure what wifi_aps:wifi_clients is doing there.
  2. The error about stopperTimeout suggests the patched Scapy hasn't been installed. Did you run install.sh? You can manually install it: pip install .snoopy-ng/setup/scapy-latest-snoopy_patch.tar.gz
  3. As for the 401, make sure your -d and -k values on your client match the output from snoopy_auth --list
stryngs commented 9 years ago

I receive the same 401 errors:

On server (192.168.1.1): snoopy-ng -v -m server

On client (192.168.1.100): snoopy -v -m wifi:iface=wlan0mon -s http://192.168.1.1:9001/ -d -l -k

maximcherny commented 9 years ago

Are you setting the -d & -k values or you are using the client command verbatim as per your previous comment?

stryngs commented 9 years ago

The -d, -l and -k values are being set.

Where on server I would do: snoopy_auth --list [+] Available drone accounts: test:BXE3FY4PEBUC6T8

Then on server, do: snoopy-ng -v -m server

Then on client, do: snoopy -v -m wifi:iface=wlan0mon -s http://192.168.1.1:9001/ -d test -l somewhere -k BXE3FY4PEBUC6T8

danielhuntley313 commented 9 years ago

Is there no fix for this? I have the same issue with the 401 error. I have triple checked that the drone name and key are correct.

snoopy_auth --list [+] Available drone accounts: test:PASSWORD

Then on server, do: snoopy-ng --verbose --plugin server

Then on client, do: snoopy --verbose --plugin wifi:iface=mon0 --server http://192.168.0.2:9001/ --drone test --location test --key PASSWORD

stryngs commented 9 years ago
0x0000:  4500 0146 b4e6 4000 4006 735e c0a8 c80d  E..F..@.@.s^....
0x0010:  c0a8 c80e 2329 8c14 e7e0 d159 e3bb 63da  ....#).....Y..c.
0x0020:  8019 00f9 3d3a 0000 0101 080a 0002 65de  ....=:........e.
0x0030:  0005 b28c 5757 572d 4175 7468 656e 7469  ....WWW-Authenti
0x0040:  6361 7465 3a20 4261 7369 6320 7265 616c  cate:.Basic.real
0x0050:  6d3d 224c 6f67 696e 2052 6571 7569 7265  m="Login.Require
0x0060:  6422 0d0a 436f 6e74 656e 742d 5479 7065  d"..Content-Type
0x0070:  3a20 7465 7874 2f68 746d 6c3b 2063 6861  :.text/html;.cha
0x0080:  7273 6574 3d75 7466 2d38 0d0a 436f 6e74  rset=utf-8..Cont
0x0090:  656e 742d 4c65 6e67 7468 3a20 3930 0d0a  ent-Length:.90..
0x00a0:  5365 7276 6572 3a20 5765 726b 7a65 7567  Server:.Werkzeug
0x00b0:  2f30 2e38 2e33 2050 7974 686f 6e2f 322e  /0.8.3.Python/2.
0x00c0:  372e 330d 0a44 6174 653a 2057 6564 2c20  7.3..Date:.Wed,.
0x00d0:  3232 204a 756c 2032 3031 3520 3030 3a30  22.Jul.2015.00:0
0x00e0:  393a 3333 2047 4d54 0d0a 0d0a 436f 756c  9:33.GMT....Coul
0x00f0:  6420 6e6f 7420 7665 7269 6679 2079 6f75  d.not.verify.you
0x0100:  7220 6163 6365 7373 206c 6576 656c 2066  r.access.level.f
0x0110:  6f72 2074 6861 7420 5552 4c2e 0a59 6f75  or.that.URL..You
0x0120:  2068 6176 6520 746f 206c 6f67 696e 2077  .have.to.login.w
0x0130:  6974 6820 7072 6f70 6572 2063 7265 6465  ith.proper.crede
0x0140:  6e74 6961 6c73                           ntials
stryngs commented 9 years ago

pong... Hello? Anyone alive on the project? I'd love to move forward on snoopy-ng, but it seems, by default, the server/client capabilities are broken.

thoughts?

maximcherny commented 9 years ago

Hi, it's probably a busy time of the year for all. In the meantime, you could try a prior commit or my headway branch which is known to work.

danielhuntley313 commented 9 years ago

Figured out the solution for my issue. I unfortunately run the install_rpi.sh script on the server after cloning the snoopy-ng repo. When this is done it reclones snoopy-ng repository inside the first snoopy-ng clone. It then runs install.sh inside this second snoopy-ng clone creating all the symlinks pointing to those copies. So when you run snoopy server it may be starting utilizing /root/snoopy-ng/snoopy.db but the snoopy_auth created keys in /root/snoopy-ng/snoopy-ng/snoopy.db .

Then again I may have been the only one stupid enough to run install_rpi.sh on a Kali Linux laptop after cloning the repo. I just figured it would be easier since install_rpi.sh covers some dependencies that install.sh does not take into account.

stryngs commented 9 years ago

maximcherny,

I tried your branch, and received the following: ~/snoopy-ng $ snoopy_auth -c foo Traceback (most recent call last): File "/usr/bin/snoopyauth", line 164, in auth = auth('sqlite:////root/snoopy-ng/snoopy.db') File "/usr/bin/snoopy_auth", line 30, in init self.metadata.reflect() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 2448, in reflect connection=conn)) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2354, in table_names conn = self.contextual_connect() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 2340, in contextual_connect self.pool.connect(), File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 210, in connect return _ConnectionFairy(self).checkout() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 371, in init rec = self._connection_record = pool._do_get() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 758, in _do_get return self._create_connection() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 174, in _create_connection return _ConnectionRecord(self) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 256, in init self.connection = self.connect() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/pool.py", line 316, in connect connection = self.__pool._creator() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 80, in connect return dialect.connect(_cargs, _cparams) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 280, in connect return self.dbapi.connect(_cargs, _cparams) sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None