-
-
Save webdevsuperfast/b21a5f076497117729777ca84e26bdcd to your computer and use it in GitHub Desktop.
Batch add block list in Adguard Home
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
list = [ | |
"https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts", | |
"https://v.firebog.net/hosts/static/w3kbl.txt", | |
"https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt", | |
"https://someonewhocares.org/hosts/zero/hosts", | |
"https://raw.githubusercontent.com/VeleSila/yhosts/master/hosts", | |
"https://winhelp2002.mvps.org/hosts.txt", | |
"https://v.firebog.net/hosts/neohostsbasic.txt", | |
"https://raw.githubusercontent.com/RooneyMcNibNug/pihole-stuff/master/SNAFU.txt", | |
"https://paulgb.github.io/BarbBlock/blacklists/hosts-file.txt", | |
"https://adaway.org/hosts.txt", | |
"https://v.firebog.net/hosts/AdguardDNS.txt", | |
"https://v.firebog.net/hosts/Admiral.txt", | |
"https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt", | |
"https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt", | |
"https://v.firebog.net/hosts/Easylist.txt", | |
"https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts", | |
"https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts", | |
"https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts", | |
"https://v.firebog.net/hosts/Easyprivacy.txt", | |
"https://v.firebog.net/hosts/Prigent-Ads.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts", | |
"https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt", | |
"https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt", | |
"https://hostfiles.frogeye.fr/multiparty-trackers-hosts.txt", | |
"https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/AmazonFireTV.txt", | |
"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt", | |
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt", | |
"https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt", | |
"https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt", | |
"https://v.firebog.net/hosts/Prigent-Crypto.txt", | |
"https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appendix_D.txt", | |
"https://phishing.army/download/phishing_army_blocklist_extended.txt", | |
"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt", | |
"https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts", | |
"https://urlhaus.abuse.ch/downloads/hostfile/", | |
"https://v.firebog.net/hosts/Prigent-Malware.txt", | |
"https://v.firebog.net/hosts/Shalla-mal.txt", | |
"https://zerodot1.gitlab.io/CoinBlockerLists/hosts_browser", | |
]; | |
for (i in list) { | |
l = list[i]; | |
console.log(l); | |
fetch("http://192.168.2.2/control/filtering/add_url", { | |
method: "POST", | |
body: JSON.stringify({ | |
name: l.substring(8, 30), | |
url: l, | |
whitelist: false, | |
}), | |
headers: { | |
"Content-Type": "application/json", | |
}, | |
}) | |
.then((res) => res.json()) | |
.then(console.log); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.poolmanager import PoolManager | |
import ssl | |
import requests | |
import json | |
## CHANGE HERE ## | |
# ip address of AdGuard Home | |
# "http(s)://<adguardHomeIp:<port>" | |
host = "http://192.168.2.2:80" | |
proxies = { | |
"http": "http://127.0.0.1:7890", | |
"https": "http://127.0.0.1:7890", | |
} | |
# user name | |
userName = "" | |
# password | |
password = "" | |
# block list | |
# taken from Wally3K's Firebog https://firebog.net/ | |
urls = [ | |
"https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts", | |
"https://v.firebog.net/hosts/static/w3kbl.txt", | |
"https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt", | |
"https://someonewhocares.org/hosts/zero/hosts", | |
"https://raw.githubusercontent.com/VeleSila/yhosts/master/hosts", | |
"https://winhelp2002.mvps.org/hosts.txt", | |
"https://v.firebog.net/hosts/neohostsbasic.txt", | |
"https://raw.githubusercontent.com/RooneyMcNibNug/pihole-stuff/master/SNAFU.txt", | |
"https://paulgb.github.io/BarbBlock/blacklists/hosts-file.txt", | |
"https://adaway.org/hosts.txt", | |
"https://v.firebog.net/hosts/AdguardDNS.txt", | |
"https://v.firebog.net/hosts/Admiral.txt", | |
"https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt", | |
"https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt", | |
"https://v.firebog.net/hosts/Easylist.txt", | |
"https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts", | |
"https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts", | |
"https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts", | |
"https://v.firebog.net/hosts/Easyprivacy.txt", | |
"https://v.firebog.net/hosts/Prigent-Ads.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts", | |
"https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt", | |
"https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt", | |
"https://hostfiles.frogeye.fr/multiparty-trackers-hosts.txt", | |
"https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt", | |
"https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/AmazonFireTV.txt", | |
"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt", | |
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/Alternate%20versions%20Anti-Malware%20List/AntiMalwareHosts.txt", | |
"https://osint.digitalside.it/Threat-Intel/lists/latestdomains.txt", | |
"https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt", | |
"https://v.firebog.net/hosts/Prigent-Crypto.txt", | |
"https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appendix_D.txt", | |
"https://phishing.army/download/phishing_army_blocklist_extended.txt", | |
"https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt", | |
"https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt", | |
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts", | |
"https://urlhaus.abuse.ch/downloads/hostfile/", | |
"https://v.firebog.net/hosts/Prigent-Malware.txt", | |
"https://v.firebog.net/hosts/Shalla-mal.txt", | |
"https://zerodot1.gitlab.io/CoinBlockerLists/hosts_browser", | |
] | |
allow_urls = [ | |
"https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt", | |
"https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/referral-sites.txt", | |
"https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/optional-list.txt", | |
] | |
############ End Edits ################# | |
# Open TLSv1 Adapter | |
class MyAdapter(HTTPAdapter): | |
def init_poolmanager(self, connections, maxsize, block=False): | |
self.poolmanager = PoolManager(num_pools=connections, | |
maxsize=maxsize, | |
block=block, | |
ssl_version=ssl.PROTOCOL_TLSv1) | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0'} | |
s = requests.Session() | |
s.mount(host, MyAdapter()) | |
x = s.post(host + "/control/login", json.dumps({"name": userName, "password" : password}), headers=headers, proxies=proxies) | |
print(x.text) | |
for u in urls: | |
filterObj = json.dumps({'url':u, "name":u,"whitelist":False}) | |
print(filterObj) | |
x = s.post(host + "/control/filtering/add_url", data = filterObj, headers=headers) | |
print(x.text) | |
for u in allow_urls: | |
filterObj = json.dumps({'url':u, "name":u,"whitelist":True}) | |
print(filterObj) | |
x = s.post(host + "/control/filtering/add_url", data = filterObj, headers=headers) | |
print(x.text) | |
# help from | |
# https://stackoverflow.com/questions/30946370/using-requests-to-login-to-a-website-that-has-javascript-login-form | |
# https://stackoverflow.com/questions/33818206/python-login-into-a-website-with-javascript-form |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment