hb="=B+ $(nvram get adblock_blacklist) $(nvram get adblock_enable) $(nvram get adblock_path) $(nvram get adblock_limit) =BC+ $(nvram get adblock_blacklist_custom | only ) =BCF+"
hb="=B+ $(nvram get adblock_blacklist | tr '>' '\n' | grep -E ^1 | cut -d/ -f3- | sort | cut -f1 -d'<') $(nvram get adblock_enable) $(nvram get adblock_path) $(nvram get adblock_limit) =BC+ $(nvram get adblock_blacklist_custom | only ) =BCF+"
for i in $(nvram get adblock_blacklist_custom | only | grep -E ^/ ); do hb="$hb $(cat ${i} | only )"; done
echo $hb | tr " " "\n" | grep -Ev '^($|#|!)'
}
@ -301,7 +301,7 @@ download() {
} || {
grep -q -E '^https?://' "$D/${uriname}.list" && {
# List of lists
logn "[$COUNT][$URL] List-of-lists (List of URLs) format >> Parsing..."
logn "[$COUNT][$URL] Group-of-lists (List of URLs) format >> Parsing..."
grep -E '^https?://' "$D/${uriname}.list" | awk '{print $1}'| while read u; do
SUBLIST=$((SUBLIST+1))
urinamed=$(echo "$u" | md5sum | awk '{print $1}')
@ -417,9 +417,9 @@ download() {
subsed="$subsed ${i}"
done
# Whitelist domains defined in list-of-lists content
# Whitelist domains defined in Group-of-lists content
[[ -f $PREFIX/white.url ]] && {
logd "Whitelisting domains found in list-of-lists URLs"
logd "Whitelisting domains found in Group-of-lists URLs"
for i in $(grep -Eo '((([a-zA-Z]{1,2})|([0-9]{1,2})|([a-zA-Z0-9]{1,2})|([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]))\.)+[a-zA-Z]{2,6}\s*/\s*' $PREFIX/white.url | tr "/" " "); do
{ title: 'Individual blacklisted domains and/or the path to external file/s containing domain references only.<br>Domains defined with a prepending <b>+<\/b> will have any found subdomain pruned from the blockfile.<br>Prepend <b>#<\/b> to quote a line.', name: 'adblock_blacklist_custom', type: 'textarea', placeholder: 'baddomain.com /mnt/usb/list-of-bad-domains.list /mnt/usb/list-of-blacklisted-urls.list +prune-subdomains.com', value: nvram.adblock_blacklist_custom }
{ title: 'Individual domains and/or path to external file/s.<br>Domains defined with a prepending <b>+<\/b> will have any found subdomain pruned from the blockfile.<br>Prepend <b>#<\/b> to comment.', name: 'adblock_blacklist_custom', type: 'textarea', placeholder: 'baddomain.com /mnt/usb/list-of-bad-domains.list /mnt/usb/list-of-blacklisted-urls.list +prune-subdomains.com', value: nvram.adblock_blacklist_custom, id: 'domain-blacklist' }
{ title: 'Individual domains and/or the path to external file/s containing domain references only.<br>Domains defined with a prepending <b>%<\/b> will not have the own subdomains blocked.<br>Prepend <b>#<\/b> to quote a line.', name: 'adblock_whitelist', type: 'textarea', placeholder: 'gooddomain.com\ /mnt/usb/list-of-good-domains.list /mnt/usb/file-cointaining-list-of-urls.list %onlythis-nosubdomains.com', value: nvram.adblock_whitelist }
{ title: 'Individual domains and/or path to external file/s.<br>Domains defined with a prepending <b>%<\/b> will not have the own subdomains blocked.<br>Prepend <b>#<\/b> to comment.', name: 'adblock_whitelist', type: 'textarea', placeholder: 'gooddomain.com\ /mnt/usb/list-of-good-domains.list /mnt/usb/file-cointaining-list-of-urls.list %onlythis-nosubdomains.com', value: nvram.adblock_whitelist, id: 'domain-whitelist' }
<li><b>Enable</b> - Used to activate/deactivate the adblock function. When enable is set the script runs after a save, a manual Load/Update, it autostart at boot and set autoupdate to run daily at a random time between 3am and 6am (excluding mins 59,00,01).</li>
<li><b>Blockfile size limit</b> - Defined in Bytes, it's an automatically calculated hard limit for the dnsmasq.adblock file. This limit can be overwritten manually. Removing the number and saving will trigger an internal calculation performed at the next run.</li>
<li><b>Custom path</b> - Optional, allows to save the potentially large adblock files on permanent storage like USB/CIFS/etc. This indirectly also means lower RAM usage and additional list control to avoid downloads/processing when not necessary.</li>
<li><b>Blacklist URL & List-of-lists</b> - Supported blacklist can come in multiple format. as long as they are text and with maximum one domain reference per line. Empty lines and lines starting with "#" or "!" are always ignored. A particular note on the List-of-lists format where the content of the defined list contains references to external URLs e.g.<br><code>[https://provider.com/badaddresses.txt] --> containing a list of URLs</code>.</li>
<li><b>Blacklist Custom</b> - Optional, space or newline separated: domain1.com domain2.com domain3.com. It also accepts external files as a source e.g. <code>/mnt/usb/blacklist</code>, with one domain per line. Prepending a '+' to the domain will force a removal of all the child domains from the blocklist file keeping only the custom defined one (blocking all its subdomains).</li>
<li><b>Whitelist</b> - Optional, space or newline separated: domain1.com domain2.com domain3.com. It also accepts external files as a source e.g. <code>/mnt/usb/whitelist</code>, with one domain per line. Please note by default given a domain, any of its subdomains will be whitelisted. To have a domain strictly whitelisted (subdomains blocked) prepend a <B>%</B> to the domain.</li>
<li><b>Blacklist URL & Group-of-lists</b> - Supported blacklist can come in multiple format. as long as they are text and with maximum one domain reference per line. Empty lines and lines starting with "#" or "!" are always ignored. A particular note on the Group-of-lists format where the content of the defined list contains references to external URLs e.g.<br><code>[https://provider.com/badaddresses.txt] --> containing a list of URLs</code>.</li>
<li><b>Blacklist Custom</b> - Optional, newline separated: domain1.com domain2.com domain3.com. It also accepts external files as a source e.g. <code>/mnt/usb/blacklist</code>, with one domain per line. Prepending a '+' to the domain will force a removal of all the child domains from the blocklist file keeping only the custom defined one (blocking all its subdomains).</li>
<li><b>Whitelist</b> - Optional, newline separated: domain1.com domain2.com domain3.com. It also accepts external files as a source e.g. <code>/mnt/usb/whitelist</code>, with one domain per line. Please note by default given a domain, any of its subdomains will be whitelisted. To have a domain strictly whitelisted (subdomains blocked) prepend a <B>%</B> to the domain.</li>
<li><b>Files</b> - Do not defined your custom files within the adblock folder as this is periodically cleaned up
<li><b>Caution</b> - Configuring large blocklists in adblock is not ideal. Add one list at the time and monitor the RAM usage. There are multiple protections in place but the most important is to trim down your final blocklist if too many resources are needed, this is reflected in the <code>Blockfile size limit</code> field</li>
<li><b>Hold-time</b> - There's a 30 min hold-time between consecutive updates to avoid false positive calls. This can be manually overridden performing an unload + update</li>