Skip to content

etheodoraki/AdBlocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple adblocking mechanism

[ACE414] Services and Systems Security

Assignment 7

*************************
chmod +x adblock.sh
sudo ./adblock.sh -help
*************************

Options:

1.

./adblock.sh -domains 

: Configure adblock rules based on the domain names of domainNames.txt file Reads each domain name from the file "domainNames.txt" line by line. For each domain name finds it's IP addresses using nslookup . Writes every IP address to the "IPAddresses.txt" file. Reads every IP address from the "IPAddresses.txt" file element by elemen. Checks if the IP is in IPv6 form or not and adds new rule(block) for each new IP using ip6tables -A INPUT -s ${iptobeblocked} -j REJECT or iptables -A INPUT -s ${iptobeblocked} -j REJECT respectively. !note: this option must be selected before the option 2(-ips), because otherwise the "IPAddresses.txt" file will be empty.

2.

./adblock.sh -ips 

: Configure adblock rules based on the IP addresses of IPAddresses.txt file Reads every IP address from the "IPAddresses.txt" file element by element. Checks if the IP is in IPv6 form or not and adds new rule(block) for each new IP using ip6tables -A INPUT -s ${iptobeblocked} -j REJECT or iptables -A INPUT -s ${iptobeblocked} -j REJECT respectively.

3.

./adblock.sh -save 

: Save rules to adblockRules file using the iptables-save command, saves the rules to adblockRules in current directory

4.

    ./adblock.sh -load 

: Load rules from adblockRules file using the iptables-restore command, loads the rules written on adblockRules file

5.

    ./adblock.sh -list 

: List curent rules of all tables using the iptables -L -v -n|more and ip6tables -L -v -n|more commands respectively, displays all tables rules

6.

    ./adblock.sh -reset 

: Reset rules to default settings - ACCEPT all sets accept all to all connections deletes all existing rules with iptables(and ip6tables) -flush

7.

    ./adblock.sh -help 

: Display options menu and exit

Notes:

After cofiguring the adblock rules and visiting some sites: I can only see in-video ads on Youtube, but on some sites some ads were not blocked, like pop-ups or some static images. This happens because we haven't block all the ips needed. We blocked 300 IP addresses so it is very possible to still accept some advertising domains.

Releases

No releases published

Packages

No packages published

Languages