hectorm / hblock

Improve your security and privacy by blocking ads, tracking and malware domains.
https://hblock.molinero.dev
MIT License
1.56k stars 104 forks source link

--regex what am I doing wrong? #125

Closed bcookatpcsd closed 1 year ago

bcookatpcsd commented 1 year ago

I cannot seem to get the --regex to match..

 grep mixpanel.com hblock.hosts

hblock.hosts:local-zone: "api-compatible.mixpanel.com." inform_deny
hblock.hosts:local-zone: "api-eu.mixpanel.com." inform_deny
hblock.hosts:local-zone: "api-js.mixpanel.com." inform_deny
hblock.hosts:local-zone: "api-secure.mixpanel.com." inform_deny
hblock.hosts:local-zone: "api.mixpanel.com." inform_deny
hblock.hosts:local-zone: "decide.mixpanel.com." inform_deny
hblock.hosts:local-zone: "switchboard.mixpanel.com." inform_deny

ok, mixpanel is in the blocklist output..

 cat /etc/hblock/allow.list

 ^.*mixpanel\.com$

.. looks to be the regex that would match all mixpanel.com entries..

hblock --output /etc/unbound/hblock.hosts --regex -F none -T local-zone: "%D." inform_deny -f
[INFO] Downloading sources
 * https://raw.githubusercontent.com/list0
 * https://raw.githubusercontent.com/list1
[INFO] Applying denylist
[INFO] Sanitizing blocklist
[INFO] Applying allowlist
[INFO] Filtering redundant subdomains
[INFO] Sorting blocklist
[INFO] Applying format template
[INFO] 889019 blocked domains!
grep mixpanel.com hblock.hosts
local-zone: "api-compatible.mixpanel.com." inform_deny
local-zone: "api-eu.mixpanel.com." inform_deny
local-zone: "api-js.mixpanel.com." inform_deny
local-zone: "api-secure.mixpanel.com." inform_deny
local-zone: "api.mixpanel.com." inform_deny
local-zone: "decide.mixpanel.com." inform_deny
local-zone: "switchboard.mixpanel.com." inform_deny

image

 cat /etc/hblock/allow.list

 ^.*mixpanel\.com$

api-compatible.mixpanel.com
api-eu.mixpanel.com
api-js.mixpanel.com
api-secure.mixpanel.com
api.mixpanel.com
decide.mixpanel.com
switchboard.mixpanel.com

run the same command with the --regex argument

hblock --output /etc/unbound/hblock.hosts --regex -F none -T 'local-zone: "%D." inform_deny' -f

and no domains

 grep mixpanel.com hblock.hosts

(nothing)

grep is GNU 3.8, I'm running Void (glibc)

hblock is 3.4.1

Open to suggestions..

Thank you in advance.

bcookatpcsd commented 1 year ago

.. as I re-re-re-read what I wrote.. before hitting submit

.. after trying for more than an acceptable amount of time, and then finally deciding to actually ask for help in whatever I am missing..

there is a space before the regex:

(space)^.*mixpanel.com$

vs

^.*mixpanel.com$

That seems to be the problem

hectorm commented 1 year ago

I assume you found the problem and there is no bug in hBlock, but if I am wrong please reopen the issue.