Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FirewallPython

This code is an example of a simple firewall implementation in Python. It utilizes the pydivert library to capture and filter network packets on a specific port. The firewall is designed to block certain packets based on their content, block IP addresses that exceed a certain packet rate or number of blocked packets, and monitor and restart a specified process if it is not running.

The necessary libraries are imported: pydivert for capturing packets, threading for running packet capture and process monitoring concurrently, subprocess for restarting processes, time for time-related operations, psutil for process-related operations, ctypes for setting the console window title, and json for handling JSON file operations.

to run the script under windows install python 3.11 (is the one i used for this code) and from a CMD or powershell install the dependencies:

pip install pydivert

pip install psutil

for running it i used a CMD windows with admin rights, locate the FirewallPython.py file, and just write FirewallPython.py and the firewall should start running without any problems startingfirew

Blocking Hex packets:

pack1

pack2

About

D2GS Firewall in Python for Windows Server 2019/or other

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages