- Registriert
- 05.03.04
- Beiträge
- 2.319
Hallo,
für alle die sich mit hosts auskennen hier ein Service der die Domain im aktuellen Fenster auf 0.0.0.0 leitet. (hosts add blocker)
Mit Automator einen Dienst erstellen und wie im Bild konfigurieren.

für alle die sich mit hosts auskennen hier ein Service der die Domain im aktuellen Fenster auf 0.0.0.0 leitet. (hosts add blocker)
Code:
tell application "Google Chrome"
set var to URL of active tab of first window
end tell
set {hostURL, catHosts} to {do shell script "echo " & quoted form of var & "|awk -F/ '{print $3}'", do shell script "cat /etc/hosts"}
set blockDomain to "0.0.0.0 " & hostURL
tell application "Google Chrome"
if catHosts contains blockDomain then
display alert "'hosts' already contains:" message blockDomain as critical
else
display dialog "Ban " & quoted form of hostURL & " in hosts?" with icon 1 with title "BanInHosts"
my hostWrite(blockDomain)
end if
end tell
on hostWrite(x)
do shell script "echo " & x & " >> /etc/hosts" with administrator privileges
end hostWrite
Mit Automator einen Dienst erstellen und wie im Bild konfigurieren.

Zuletzt bearbeitet: