Can't add multiple blocklists?

Before you used to be able to paste a large amount of blocklists into the settings at once, aka https://v.firebog.net/hosts/lists.php?type=tick

Now, since it has a comment field, that doens't look possible. Is there another way to mass invite?

You can mass-insert into the database with any database tool that supports SQLite3.

Ok, sounds good.

Now, I know I can do this, but what about your average end user. A lot of people that use this are JUST getting into the homelab scene.

Either way, its a difference, may want to at least call it out somewhere

It depends on the angle you're looking at this. For the average user, the initially installed lists should be sufficient. At least, they should slowly add blocking lists. Adding a massive number of blocked queries is almost guaranteed to break numerous things all over the place. You have to be comfortable digging into issues and whitelist accordingly to balance this. I don't think this is something a new user wants to do.

I perfectly respect that it boils down to personal taste, however, I should also mention that I'm using Pi-hole for many years by now and I'm still 100% at the initial list of adlists. I never had the need to add any (let alone mass-add) additional list.

1 Like

Ahh, I can see your point of view.

I forget not everyone is as paranoid as me when it comes to blocking

If you have a list, in text format, such as (example - don't use this - it's pihole's default), named /home/pi/adlists.list

https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://mirror1.malwaredomains.com/files/justdomains
http://sysctl.org/cameleon/hosts
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://hosts-file.net/ad_servers.txt

create a script file (/home/pi/adlists.sql)

CREATE TEMP TABLE i(txt);
.separator ~
.import /home/pi/adlists.list i
INSERT OR IGNORE INTO adlist (address) SELECT txt FROM i;
DROP TABLE i;

and run

sudo sqlite3 /etc/pihole/gravity.db < /home/pi/adlists.sql

edit
after the correct advise of @DL6ER (thank you for this), changed the sql script to include IGNORE, this to avoid problems with duplicate entries, the database doesn't allow duplicates.
/edit

1 Like

Quick question: And

CREATE TEMP TABLE i(txt);
.separator ~
.import /home/pi/whitelist.txt i
INSERT OR IGNORE INTO whitelist (address) SELECT txt FROM i;
DROP TABLE i;

and running

sudo sqlite3 /etc/pihole/gravity.db < /home/pi/whitelists.sql

to import white list entries accordingly?

whitelist table doesn't exist anymore (not used, will be removed soon) in the latest beta5. all entries (whitelist, regex_blacklist, …) are in the same table domainlist.
entries get a type
so far I've only been able to define the following types

  • 0: whitelist
  • 3: regex_blacklist

@DL6ER: overview of types please, anywhere?

so the correct script is (bash script):
for whitelist:

while read allow
do
	sudo sqlite3 /etc/pihole/gravity.db "insert or ignore into domainlist (domain, type, enabled) values (\"$allow\", 0, 1);"
	done < /home/pi/whitelist.txt

for regex:

while read regex
do
	sudo sqlite3 /etc/pihole/gravity.db "insert or ignore into domainlist (domain, type, enabled) values (\"$regex\", 3, 1);"
	done < /home/pi/regex.list

warning: copy paste from discourse may screw up some characters, compare the copied result with the screen!

See here (there's a small typo online which I need to fix online):

Or see maybe here or here. FTL doesn't know these IDs. It's using the views.

7 posts were split to a new topic: Python script to add adlists in bulk