Git Product home page Git Product logo

gisdev01 / security-ssid-abi Goto Github PK

View Code? Open in Web Editor NEW
28.0 8.0 5.0 17.79 MB

Sniff wifi probes from nearby devices (passive monitoring only) and logs to a Django App/DB (with GUI) and also into an InfluxDB time-series database (Using pcap or airmon-ng)

Python 65.24% HTML 27.62% JavaScript 2.04% Shell 0.10% CSS 4.82% Dockerfile 0.18%
ssid arp wigle wifi-interface django scapy pcap influxdb python3 nearby-devices

security-ssid-abi's Introduction

Security SSID ABI (SSID WiFi Listener)

Using a monitor-mode 2.4Ghz receiver, this Django app displays data that is catalogued from passively sniffing on SSID probes, ARPs, and MDNS (Bonjour) packets that are being broadcast by nearby wireless devices.

Some devices transmit ARPs, which sometimes contain MAC addresses (BSSIDs) of previously joined WiFi networks, as described in [[1]][ars]. This system captures these ARPs and displays them.

Components

2 major components and further python modules:

  • main.py uses Scapy to extract data from a live capture (via airmon-ng) or pcap file, and inserts this data into 2 databases: Client Summary and Access Point summary data is loaded into a SQLite or Postgres DB (managed by Django), which is the data that is displayed in the Django web app.

Beyond the summary Client Data, all 802.11 (aka Dot11) packet summaries are loaded into a second database: InfluxDB 1.8.

  • A Django web app provides an interface to view and analyse the data. This includes views of:
  1. All detected devices and the SSIDs / BSSIDs each has probed
  2. A view by network
  3. A view showing a breakdown of the most popular device manufacturers, based on client MAC address Ethernet OUIs
  • ./location_utils/wloc.py provides a QueryBSSID() function which looks up a given BSSID (AP MAC address) on Apple's WiFi location service. It will return the coordinates of the MAC queried for and usually an additional 400 nearby BSSIDs and their coordinates.

  • ./location_utils/wigle_lib.py provides a getLocation() function for querying a given SSID on the wigle.net database and returns GPS coordinates. Note: It must be configured with a valid username and password set in the settings.py file. Please respect the wigle.net ToS in using this module. This project-specific library has been created to work with the new Wigle API (V2: https://api.wigle.net/swagger#/Network_search_and_information_tools). Big thanks to the Wigle team for their great support and allowing this project to use their data.

*** Instructions

Install Anaconda 3 for Linux: https://www.anaconda.com/products/individual#linux

git clone [email protected]:GISDev01/security-ssid-abi.git
cd security-ssid-abi
conda env create -f environment.yml
source activate securityssidabi38

# Initialize the initial Django DB
./manage.py migrate --run-syncdb 
./manage.py createsuperuser
# Create creds to log in to the /admin Web GUI endpoint)

# Start the web interface by running 
# (change 127.0.0.1 to any IP for the Django web server to listen on)
./manage.py runserver 127.0.0.1:8000

To sniff traffic

sudo apt install aircrack-ng -y && sudo apt install git -y && sudo apt install libpq-dev
# We can only run the sniffer as root, because it opens a raw socket (via scapy sniff)
sudo -i

Bring up a wifi interface in monitor mode (usually mon0) so that airodump-ng shows traffic.

sudo airmon-ng check kill

Note: check what the connected wireless NIC device is named using iwconfig

iwconfig

Make sure the USB wireless NIC, such as an Alfa AWUS036 is passed-through to the VM Example value is: wlx00c0ca4f55b9 (or it could be something like wlan0)

sudo airmon-ng start wlx00c0ca4f55b9

  • Sometimes the OS and Wireless card like to act up and display a message like: "SIOCSIFFLAGS: Operation not possible due to RF-kill". In that case, this can help: sudo rfkill unblock wifi; sudo rfkill unblock all
  1. Optional (set to false by default in setting.py). Get InfluxDB up and running, and update the .\security_ssid\settings.py with the correct IP or hostname of the InfluxDB box.

Note: Fastest way to get it up and running for development is with Docker:

docker run -p 8086:8086 influxdb:1.8.0

  1. Start live sniffing with:

./run.sh -i mon0

(Note: the -i param here is to identify the interface name that airmon-ng is monitoring packets with, default value is actually mon0)

Optional: To solicit ARPs from iOS devices, set up an access point with DHCP disabled (e.g. using airbase-ng) and configure your sniffing interface to the same channel. Once associated, iOS devices will send up to three ARPs destined for the MAC address of the DHCP server on previously joined networks. On typical home WiFi routers, the DHCP server MAC address is the same as the WiFi interface MAC address, which can be used for accurate geolocation.

Optional: For debugging code locally, a .pcap (in this case, .cap) file can be generated with (as root or with sudo):

airodump-ng -w sample-data --output-format pcap mon0

Then you can run with (assuming sample-data.cap is in the root of this repo):

./run.sh -r sample-data.cap

To run Postgres in Docker for testing, as an alternative to sqlite

docker run -d -p 5432:5432 --name postgres95 -e POSTGRES_PASSWORD=postgres postgres:9.5

If needed, get in to the box with:

docker exec -it postgres95 bash

psql -U postgres

Dependencies

See requirements.txt for python modules and versions required. Externally, this application writes out to an InfluxDB data store (in addition to the local Django DB (sqlite)).

This repo has been recently developed on a Ubuntu 16.04 (64-bit) VM with Python 3.8, Django 4.x and Scapy 2.4.x. The web interface code has been updated and tested with Django running on Mac OS X Sierra with Python 3.8.

Network sniffing via airmon-ng has been tested on a Ubuntu 16.04 VM and Raspian (RasPi 3).

Credits


This repo was originally written by @hubert3 / hubert(at)pentest.com. Presented at Blackhat USA July 2012, the original code published on Github 2012-08-31. The implementation of wloc.py is based on work by François-Xavier Aguessy and Côme Demoustier [[2]][paper]. Mark Wuergler of Immunity, Inc. provided helpful information through mailing list posts and Twitter replies. Includes Bluff JS chart library by James Coglan.

  1. http://arstechnica.com/apple/2012/03/anatomy-of-an-iphone-leak/
  2. http://fxaguessy.fr/rapport-pfe-interception-ssl-analyse-donnees-localisation-smartphones/ [ars]: http://arstechnica.com/apple/2012/03/anatomy-of-an-iphone-leak/ [paper]: http://fxaguessy.fr/rapport-pfe-interception-ssl-analyse-donnees-localisation-smartphones/

(gisdev01) Starting in mid-2017 and then again in 2020, several updates and upgrades have been completed, including addition of InfluxDB functionality, summary functionality, Raspberry Pi support, and several front-end updates.

conda install Django
conda install matplotlib
conda install -c conda-forge influxdb
conda install -c conda-forge netaddr
conda install -c conda-forge google-api-core

# Not available in any conda channels
pip install django-picklefield

conda env export > environment.yml
conda env create -f environment.yml




security-ssid-abi's People

Contributors

dependabot[bot] avatar dwin999 avatar gisdev01 avatar hubert3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

security-ssid-abi's Issues

Add support for Postgres 9.5

Beyond SQLite, add support for Postgres 9.5. Just switching out the database in settings.py causes several errors.

TemplateSyntaxError at networks

Invalid block tag: 'localtime', expected 'empty' or 'endfor'

Request Method: 	GET
Request URL: 	http://127.0.0.1:8000/networks
Django Version: 	1.7.1
Exception Type: 	TemplateSyntaxError
Exception Value: 	

Invalid block tag: 'localtime', expected 'empty' or 'endfor'

Exception Location: 	/usr/local/lib/python2.7/dist-packages/django/template/base.py in invalid_block_tag, line 343
Python Executable: 	/usr/bin/python
Python Version: 	2.7.13
Python Path: 	

['/root/security-ssid-abi',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2']

Server time: 	Mon, 28 Aug 2017 03:15:23 -0400

Full output: https://pastebin.com/YV9Drjrn

Any idea's what is causing this?

No such file or directory: '/root/security-ssid-abi/mac_parser/manuf'

Do you know what could cause the following error:

Traceback (most recent call last):
  File "./main.py", line 6, in <module>
    from packet_processing import packet_processor
  File "/root/security-ssid-abi/packet_processing/packet_processor.py", line 15, in <module>
    mac_parser_ws = manuf.MacParser()
  File "/root/security-ssid-abi/mac_parser/manuf.py", line 68, in __init__
    self.refresh()
  File "/root/security-ssid-abi/mac_parser/manuf.py", line 83, in refresh
    with io.open(os.path.join(os.getcwd(), 'mac_parser', manuf_name), "r", encoding="utf-8") as read_file:
IOError: [Errno 2] No such file or directory: '/root/security-ssid-abi/mac_parser/manuf'

Thanks in advance!

Error when I try to source

Hi,

I get the following error when I try to issue the source activate securityssidabi38

Could not find conda environment: securityssidabi38

Any idea of what may be causing this issue?

Thanks,
Mak

asgiref install error

Attempted to follow the instructions provided for the install and ran into the following below error.

The user requested asgiref==3.2.7
django 3.1.13 depends on asgiref<4 and >=3.2.10

I attempted to manually install a version of asgiref within the guidelines above but I still keep getting the same error when running the sudo pip3 install -r requirements.txt.

Any help is appreciated!

Failed to establish a new connection

I get the following error when I run ./run.sh -i wlan0mon

Traceback (most recent call last):
  File "./main.py", line 6, in <module>
    from packet_processing import packet_processor
  File "/root/security-ssid-abi/packet_processing/packet_processor.py", line 9, in <module>
    from db import influx
  File "/root/security-ssid-abi/db/__init__.py", line 12, in <module>
    influxdb_client.create_database(settings.INFLUX_DB)
  File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 488, in create_database
    self.query("CREATE DATABASE \"%s\"" % dbname)
  File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 339, in query
    expected_response_code=expected_response_code
  File "/usr/local/lib/python2.7/dist-packages/influxdb/client.py", line 246, in request
    raise e
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.99.1.26', port=8086): Max retries exceeded with url: /query?q=CREATE+DATABASE+%22securityssid%22&db=securityssid (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fd307b0b110>: Failed to establish a new connection: [Errno 111] Connection refused',))

info

iwconfig
wlan0mon  IEEE 802.11  Mode:Monitor  Frequency:2.457 GHz  Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          
eth0      no wireless extensions.

lo        no wireless extensions.

Wigle api not working

I tried the username and password, also api name and password. Both return "Basic auth failure". Any idea's?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.