/minidetector

Primary LanguagePythonMIT LicenseMIT

Mini Detector

A small network assets detector example

The mini detector sniff network packets (using scapy) and store all the mac-ip couples into a table in a postgres database.

It was written as a base for job interviews questions, you may use it for inspiration, but you really don't want to use it in production :)

How to install

If you just want to run it: python setup.py install

If you want to develop as well: python setup.py develop

Pre-requisites

The project expects to run on a server that runs a postgres server. In addition, the postgres should have a db called "minidetector", owned by a user called "detector".

In order to setup the database on MacOS, run: ./setup_scripts/initialize_db_macos.sh

How to run

(venv) amit@computer /Users/amit/work/minidetector$ python -m minidetector.main
INFO:root:Added entity <Entity id=5 MAC=4c:32:75:93:8f:fb IP=10.0.0.3>
INFO:root:Added entity <Entity id=6 MAC=00:b8:c2:26:9d:bc IP=52.1.192.91>
INFO:root:Added entity <Entity id=7 MAC=00:b8:c2:26:9d:bc IP=104.103.211.85>
INFO:root:Added entity <Entity id=8 MAC=00:b8:c2:26:9d:bc IP=176.223.141.167>
INFO:root:Added entity <Entity id=9 MAC=00:b8:c2:26:9d:bc IP=3.123.217.208>
INFO:root:Added entity <Entity id=10 MAC=00:b8:c2:26:9d:bc IP=10.0.0.138>
INFO:root:Added entity <Entity id=11 MAC=9c:30:5b:25:1b:d5 IP=10.0.0.2>
INFO:root:Added entity <Entity id=12 MAC=00:b8:c2:26:9d:bc IP=143.204.194.95>

You may use the --help flag to see all available flags.