sensepost / snoopy-ng

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

cant find netifaces on startup #54

Open localtracker opened 9 years ago

localtracker commented 9 years ago

exits as soon as it tries to import netifaces module. I am using snoopy standalong on my local computer without a server.

root@kali:~/Desktop/snoopy-ng-master# ./snoopy.py


/ )( ( )( )( )( _ ( \/ ) \ \ ) ( )()( )()( )_/ \ / (/()_)()()() () Version: 2.0 Code: glenn@sensepost.com // @glennzw Visit: www.sensepost.com // @sensepost License: Non-commercial use

Traceback (most recent call last): File "./snoopy.py", line 428, in main() File "./snoopy.py", line 353, in main plugins = common.get_plugins() File "/root/Desktop/snoopy-ng-master/includes/common.py", line 24, in get_plugins m = import(plug, fromlist="Snoop").Snoop File "/root/Desktop/snoopy-ng-master/plugins/rogueAP.py", line 17, in from includes.rogee import * File "/root/Desktop/snoopy-ng-master/includes/rogee.py", line 3, in import netifaces ImportError: No module named netifaces root@kali:~/Desktop/snoopy-ng-master#

maximcherny commented 9 years ago

Try?

pip install netifaces
localtracker commented 9 years ago

gives me an error midway in the install:

root@kali:~/Desktop/Scripts/snoopy-ng-master# pip install netifaces Downloading/unpacking netifaces Downloading netifaces-0.10.4.tar.gz Running setup.py egg_info for package netifaces /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe' warnings.warn(msg) usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help

error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'

warnings.warn(msg)

usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

or: -c --help [cmd1 cmd2 ...]

or: -c --help-commands

or: -c cmd --help

error: invalid command 'egg_info'


Command python setup.py egg_info failed with error code 1 in /root/Desktop/Scripts/snoopy-ng-master/build/netifaces

Even after this if I try to run snoopy, it gives me the same error it was the last time probably because building netifaces failed.

localtracker commented 9 years ago

Tried re-install


root@kali:~/Desktop/Scripts# git clone https://github.com/sensepost/snoopy-ng.git Cloning into 'snoopy-ng'... remote: Counting objects: 998, done. remote: Total 998 (delta 0), reused 0 (delta 0), pack-reused 998 Receiving objects: 100% (998/998), 2.35 MiB | 2.06 MiB/s, done. Resolving deltas: 100% (620/620), done. root@kali:~/Desktop/Scripts# cd snoopy-ng root@kali:~/Desktop/Scripts/snoopy-ng# ls includes LICENSE.html plugins scripts snoopy.py transforms install.sh LICENSE.txt README.md setup TODO.txt uat root@kali:~/Desktop/Scripts/snoopy-ng# bash install.sh Reading package lists... Done Building dependency tree
Reading state information... Done ntpdate is already the newest version. The following packages were automatically installed and are no longer required: greenbone-security-assistant libmicrohttpd10 openvas-cli openvas-manager xsltproc Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. [ ok ] Stopping NTP server: ntpd. [+] Setting time with ntp 27 Apr 01:06:49 ntpdate[5330]: adjust time server 91.189.89.199 offset -0.002847 sec [ ok ] Starting NTP server: ntpd. [+] Setting timzeone...

Current default time zone: 'Etc/UTC' Local time is now: Mon Apr 27 01:06:50 UTC 2015. Universal Time is now: Mon Apr 27 01:06:50 UTC 2015.

[+] Installing sakis3g... [+] Updating repository... Hit http://security.kali.org kali/updates Release.gpg Hit http://http.kali.org kali Release.gpg
Hit http://security.kali.org kali/updates Release Hit http://http.kali.org kali Release
Hit http://security.kali.org kali/updates/main Sources Hit http://http.kali.org kali/main Sources
Hit http://security.kali.org kali/updates/contrib Sources
Hit http://http.kali.org kali/contrib Sources
Hit http://security.kali.org kali/updates/non-free Sources
Hit http://http.kali.org kali/non-free Sources
Hit http://security.kali.org kali/updates/main amd64 Packages
Hit http://http.kali.org kali/main amd64 Packages
Hit http://security.kali.org kali/updates/contrib amd64 Packages
Hit http://http.kali.org kali/contrib amd64 Packages
Hit http://security.kali.org kali/updates/non-free amd64 Packages
Hit http://http.kali.org kali/non-free amd64 Packages
Ign http://security.kali.org kali/updates/contrib Translation-en_US
Ign http://http.kali.org kali/contrib Translation-en_US
Ign http://security.kali.org kali/updates/contrib Translation-en
Ign http://http.kali.org kali/contrib Translation-en
Ign http://security.kali.org kali/updates/main Translation-en_US
Ign http://http.kali.org kali/main Translation-en_US
Ign http://security.kali.org kali/updates/main Translation-en
Ign http://http.kali.org kali/main Translation-en
Ign http://security.kali.org kali/updates/non-free Translation-en_US
Ign http://http.kali.org kali/non-free Translation-en_US
Ign http://security.kali.org kali/updates/non-free Translation-en
Ign http://http.kali.org kali/non-free Translation-en
Reading package lists... Done
[+] Installing required packages... Reading package lists... Done Building dependency tree
Reading state information... Done Note, selecting 'libxslt1-dev' instead of 'libxslt-dev' autossh is already the newest version. build-essential is already the newest version. iw is already the newest version. libpcap0.8-dev is already the newest version. libxslt1-dev is already the newest version. pyrit is already the newest version. python-bluez is already the newest version. python-dateutil is already the newest version. python-dev is already the newest version. python-flask is already the newest version. python-gps is already the newest version. python-psutil is already the newest version. python-serial is already the newest version. python-setuptools is already the newest version. python-sqlalchemy is already the newest version. python2.7-dev is already the newest version. sqlite3 is already the newest version. libxml2-dev is already the newest version. ppp is already the newest version. python-requests is already the newest version. tcpdump is already the newest version. The following packages were automatically installed and are no longer required: greenbone-security-assistant libmicrohttpd10 openvas-cli openvas-manager xsltproc Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Searching for pip Best match: pip 1.1 pip 1.1 is already the active version in easy-install.pth Installing pip-2.7 script to /usr/local/bin

Using /usr/lib/python2.7/dist-packages Processing dependencies for pip Finished processing dependencies for pip Searching for smspdu Best match: smspdu 1.0 Processing smspdu-1.0-py2.7.egg smspdu 1.0 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages/smspdu-1.0-py2.7.egg Processing dependencies for smspdu Finished processing dependencies for smspdu Uninstalling requests: Successfully uninstalled requests Downloading/unpacking https://pypi.python.org/packages/source/r/requests/requests-0.14.2.tar.gz Downloading requests-0.14.2.tar.gz (361Kb): 361Kb downloaded Running setup.py egg_info for package from https://pypi.python.org/packages/source/r/requests/requests-0.14.2.tar.gz /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data' warnings.warn(msg) /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: -c --help [cmd1 cmd2 ...] or: -c --help-commands or: -c cmd --help

error: invalid command 'egg_info'
Complete output from command python setup.py egg_info:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'include_package_data'

warnings.warn(msg)

/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'

warnings.warn(msg)

usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

or: -c --help [cmd1 cmd2 ...]

or: -c --help-commands

or: -c cmd --help

error: invalid command 'egg_info'


Command python setup.py egg_info failed with error code 1 in /tmp/pip-ANrF3N-build Exception information: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 104, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 245, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1009, in prepare_files req_to_install.run_egg_info() File "/usr/lib/python2.7/dist-packages/pip/req.py", line 225, in run_egg_info command_desc='python setup.py egg_info') File "/usr/lib/python2.7/dist-packages/pip/init.py", line 256, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-ANrF3N-build

Storing complete log in /root/.pip/pip.log

This is when I tried reinstalling snoopy..

maximcherny commented 9 years ago
pip install --upgrade setuptools

or

easy_install -U setuptools
localtracker commented 9 years ago

Ok that got it installed right with no errors. However, when I input

snoopy -v -m wifi:iface=mon0,mon=True -m sysinfo -m heartbeat -d myDrone -l house

I am getting these errors:

[+] Starting Snoopy with plugins: wifi, sysinfo, heartbeat [+] Capturing local only. Saving to 'sqlite:///snoopy.db' [+] 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. [+] Waiting for plugin 'sysinfo' to indicate it's ready [+] Plugin sysinfo will check device status every 1800 seconds. [+] Plugin 'sysinfo' has indicated it's ready. [+] Waiting for plugin 'heartbeat' to indicate it's ready [+] Plugin 'heartbeat' has indicated it's ready. [+] Done loading plugins, running... [+] Plugin heartbeat had a beat ❤ [+] 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' [+] 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' [+] 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' [!!] Restarting module '/root/Desktop/Scripts/snoopy-ng/plugins/wifi.pyc' after 5 failed attempts [+] 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' [!!] Restarting module '/root/Desktop/Scripts/snoopy-ng/plugins/wifi.pyc' after 5 failed attempts [+] Plugin sysinfo generated new data. ^CCaught Ctrl+C! Saving data and shutting down...

I also tried, snoopy -m wifi:iface=mon0 -d myDr -l house

[+] Starting Snoopy with plugins: wifi [+] Capturing local only. Saving to 'sqlite:///snoopy.db' [+] 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... [+] 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' ^CCaught Ctrl+C! Saving data and shutting down...

Also, as soon as I ran snoopy the first time to sniff after install, my network manager icon in the taskbar went missing though I still had connectivity and all devices were up.

maximcherny commented 9 years ago

What's your setup like? Are there multiple network interfaces?

localtracker commented 9 years ago

well yeah, am running an external wlan adaptor in conjunction with my ethernet and onboard wlan.

eth1 Link encap:Ethernet HWaddr 3c:07:54:02:7e:fa
inet addr:10.83.135.206 Bcast:10.83.143.255 Mask:255.255.240.0 inet6 addr: fe80::3e07:54ff:fe02:7efa/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:67824 errors:0 dropped:0 overruns:0 frame:0 TX packets:53886 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:59075544 (56.3 MiB) TX bytes:9220071 (8.7 MiB) Interrupt:16

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:33423 errors:0 dropped:0 overruns:0 frame:0 TX packets:33423 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:8248713 (7.8 MiB) TX bytes:8248713 (7.8 MiB)

wlan1 Link encap:Ethernet HWaddr e4:ce:8f:4b:8b:6a
UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

wlan3 Link encap:Ethernet HWaddr 00:c0:ca:5a:35:b4
UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

maximcherny commented 9 years ago

Assuming wlan3 is your external interface that supports monitor mode, try:

airmon-ng start wlan3
snoopy -v -m wifi:iface=mon0,mon=False -m sysinfo -m heartbeat -d myDrone -l house
localtracker commented 9 years ago

gives the exact same error

localtracker commented 9 years ago

hey,

hope its not too much trouble but I wanted to ask how do I get a script that I am writing to query ssid against wigle and return the lat/lon values? I have a probe request sniffer that logs probe requests, how can I query the found ssid's inside the script and return results from wigle? and the other thing was what did you use to create maltego transforms for snoopy-ng? How can I take data for example in a sqlite database and access it with transforms in maltego? My script is probe requests only and I am aiming for some functionality like snoopy. hope its ok to ask you all of this?

glennzw commented 9 years ago

That scapy error indicates the install.sh did not complete (or was not run). The install.sh file installs a patched version fo scapy to include the stopperTimeout capability. Either run the install.sh, or just the line to install scapy:

pip install ./snoopy-ng/setup/scapy-latest-snoopy_patch.tar.gz

mattbrun commented 9 years ago

Hi guys, I've the same problem with scapy on Kali Linux 2 for PC:

...
[!!] Scapy exception whilst sniffing. Will back off for 5 seconds, and try restart 'plugins.wifi' plugin
[!!] __init__() got an unexpected keyword argument 'stopperTimeout'
...

The output of sudo bash install.sh gives me

...
[+] Installing patched version of scapy...
Unpacking ./setup/scapy-latest-snoopy_patch.tar.gz
  Running setup.py (path:/tmp/pip-pQFJAU-build/setup.py) egg_info for package from file:///home/user1/Work/soft/sec/intelligence/snoopy-ng/setup/scapy-latest-snoopy_patch.tar.gz

Installing collected packages: scapy
  Found existing installation: scapy 2.2.0
    Not uninstalling scapy at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for scapy

    changing mode of /usr/local/bin/scapy to 755
    changing mode of /usr/local/bin/UTscapy to 755
Successfully installed scapy
Cleaning up...
[+] Creating symlinks to this folder for snoopy.py.
...

If I try to install it manually as @glennzw suggested I basically get the same error

$ sudo pip install ./setup/scapy-latest-snoopy_patch.tar.gz
Unpacking ./setup/scapy-latest-snoopy_patch.tar.gz
  Running setup.py (path:/tmp/pip-axnZ0A-build/setup.py) egg_info for package from file:///home/user1/Work/soft/sec/intelligence/snoopy-ng/setup/scapy-latest-snoopy_patch.tar.gz

Installing collected packages: scapy
  Found existing installation: scapy 2.2.0
    Not uninstalling scapy at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for scapy

    changing mode of /usr/local/bin/scapy to 755
    changing mode of /usr/local/bin/UTscapy to 755
Successfully installed scapy
Cleaning up...

I tried to remove/purge scapy from the system in order to let the snoopy install script do its work, but it prompts me to remove other packages as well, and I don't want this to happen...

$ sudo apt-get remove python-scapy 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  isc-dhcp-server libgtksourceview2.0-0 libgtksourceview2.0-common libladr4 prover9 python-async python-clamd python-cluster python-concurrent.futures python-d2to1 python-darts-lib-utils-lru python-esmre python-geoip python-git
  python-gitdb python-gtksourceview2 python-guess-language python-halberd python-nltk python-ntlm python-pdfminer python-phply python-pybloomfiltermmap python-pygithub python-pypdf python-ruamel.ordereddict python-smmap python-stopit
  python-svn python-tblib python-vulndb python-webkit python-xdot tinyproxy
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  dhcpig fern-wifi-cracker ghost-phisher inguma kali-linux-full mana-toolkit python-scapy w3af w3af-console wifitap wol-e
0 upgraded, 0 newly installed, 11 to remove and 1 not upgraded.
After this operation, 66,2 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

The solution I see here is

  1. Remove scapy with apt-get, remembering the other removed packages;
  2. Manually install the patched scapy version;
  3. Re-install the removed packages from step 1.

Do you have any better idea? Thanks for your help and for your work!

Regards, Matteo

mattbrun commented 9 years ago

So, eager to see snoopy running I tried to proceed with the process on a testbed Rpi2 with Kali Linux 2. The good news is that doing sudo apt-get purge python-libpcap and then sudo pip install --upgrade ./setup/scapy-latest-snoopy_patch.tar.gz the correct scapy lib is installed and snoopy runs. The bad news is that if I try to reinstall the programs which were removed with apt-get purge, then the patched scapy version is overritten by the programs python-scapy dependency, and snoopy doesn't work anymore...

In order to make the process a little bit less painful, I'd suggest to include the scapy patched version into the repo, and import it from there. Since I'm not a python developer, I'm not sure if this is reasonably sound to do for this project.

M.