This repository is a playground for testing different Python scripts using Pyshark. The primary focus is on utilizing a web server to capture and display network packets.
Before you can use any of these scripts, you will need to install Pyshark.
Note: It may be necessary to change the interface in the sample files
The setup instructions for Pyshark can be found at the following repo: https://github.com/KimiNewt/pyshark.git
Additional Note: This project is still in its early stages. Use with caution.
-
Clone the Repository
git clone https://github.com/rbodnar75/pyshark-projects-playground.git cd pyshark-projects-playground
-
Install Dependencies Ensure you have Docker installed on your system. Then, build the Docker image:
docker build -t packetcapture .
-
Run the Docker Container
docker run -p 8000:8000 packetcapture
The web server is built using Flask and is configured to capture packets and display them on a web page. To start the server, follow the instructions under Installation.
The server continuously captures packets using Pyshark and updates the packetcapture.html
file with the latest packet information. The packet details include:
- MAC Address
- Source IP
- Destination IP
- Source Port
- Destination Port
- Protocol
Open your web browser and navigate to http://localhost:8000
. You will see the captured packets displayed on the web page. The page refreshes every 10 seconds to show the latest captured packets.
Here is a sample of what the captured packets might look like on the web interface:
Sample Files/index.html
: The main interface for the Flask application that sets up the web server and handles packet capturing.Sample Files/static/styles/css
: Needed for correctly formatting the HTML output.Sample Files/capture_packets.py
: Script for capturing packets and saving them in JSON and PCAP formats.Sample Files/Dockerfile
: Dockerfile for setting up the environment and running the application.Sample Files/packetcapture.html
: A sample HTML template for the displayed captured packets.
This project is licensed under the MIT License.
For more information, visit the repository.