Instructions to run main programs-
The python scripts can be run by the following command: sudo python3 <python_file_name> Most of the C code does not need to be run separately; The related python script will compile it. To replay the pcap file: sudo tcpreplay -v --mbps <speed> -i <interface_name> 1.pcap
- The folder 'IP and Port Filter' has the final code for our filter implementation.
- The 'Rate Limit' folder contains an effort to implement rate limiting.
- The 'Basic IP filter' and 'Basic Port Filter' were just intermediate phases of development.
''' IP related commands ''' Rules block I IP <ip_address> : blocks incoming traffic from source IP = <ip_address> Rules block O IP <ip_address> : blocks outgoing traffic for destination IP = <ip_address> Rules block IP <ip_address> : blocks incoming and outgoing from IP = <ip_address> Rules unblock I IP <ip_address> : if the specified IP is blocked then re-allows incoming traffic from source IP = <ip_address>, else displays a custom message Rules unblock O IP <ip_address> : if the specified IP is blocked then re-allows outgoing traffic to destination IP = <ip_address>, else displays a custom message Rules unblock IP <ip_address> : performs the above two commands Rules unblock I IP all : Clears out "Blocked Incoming IPs" map; No incoming packet is restricted Rules unblock O IP all : Clears out "Blocked Outgoing IPs" map; No outgoing packet is restricted Rules unblock IP all : Removes any IP-based filteration implemented (A pop-up for confirmation will appear. Enter Y to proceed and N to abort. ''' Port related commands ''' Rules block sp <Port> : blocks all data over the network from source port = <Port> Rules block dp <Port> : blocks all data over the network to destination port = <Port> Rules block u sp <Port> : blocks data to main host from source port = <Port> Rules block u dp <Port> : blocks data from main host to destination port = <Port> Rules unblock sp <Port> : if blocked, re-allows data reception from source port = <Port> over the network Rules unblock dp <Port> : if blocked, re-allows data transmission to destination port = <Port> over the network Rules unblock u sp <Port> : if blocked, re-allows data reception from source port = <Port> for main host Rules unblock u dp <Port> : if blocked, re-allows data transmission to destination port = <Port> for main host ''' Utility commands ''' show Rules : displays the contents of the latest saved version of Rules.txt show update : displays the unsaved version of Rules.txt after all the commands passed in the current session update Rules : saves the changes in Rules.txt undo changes : reverts back to last saved version of Rules.txt, nullifying all later unsaved updates exit : Closes ipRules