PNLS Backend is written using Python. All of the needed packages are stored inside of the requirements.txt.
Note
Code is formatted using Black and linted with flake8. You can use sh formatter.sh
command to format you code.
First start the Redis
server by running the following command in the terminal:
redis-server
This will start the Redis server in the default configuration at port 6379.
After, clone the project and move to the backend root folder.
cd Preferred-Network-List-Sniffer/sniffer
Create a virtual environment and install packages.
virtualenv -p python3 venv
source venv/bin/active
pip3 install -r requirements.txt
Run your Backend API written using FastAPI with Uvicorn. Because the uvicorn is called from inside the code, you only need to run following:
python3 pnls.py
Serve without hot reload will be available on localhost:3001/
.
Warning
In order to have ASGI server running, you first need to run a Redis server, otherwise the server will not start.
To start the sniffer microservice, run the following:
sudo python3 sniffer.py
Yes, for now, you need to run the sniffer with sudo
because the scapy
library, which is used for sniffing, needs the admin privilege in order to capture packets.