+ Added tor checker (Messy, but will do for now)
This commit is contained in:
parent
7cdbea5522
commit
09a803e156
2 changed files with 49 additions and 2 deletions
30
.local/bin/personal/checktor
Executable file
30
.local/bin/personal/checktor
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
check() {
|
||||
[ ! -z $(pidof tor) ] && echo "On" || echo "Off"
|
||||
}
|
||||
|
||||
checkNotif() {
|
||||
[ ! -z $(pidof tor) ] && notify-send "Tor activated" || notify-send "Tor deactivated"
|
||||
}
|
||||
|
||||
checkWeb() {
|
||||
tor="$(curl --socks5-hostname localhost:9050 -s https://check.torproject.org | grep -c "Congratulation")"
|
||||
[ $tor -eq 0 ] && notify-send "Tor deactivated" || notify-send "Tor activated"
|
||||
}
|
||||
|
||||
toggle() {
|
||||
[ ! -z "$(pidof tor)" ] && $(sudo systemctl stop tor) || $(sudo systemctl start tor)
|
||||
}
|
||||
|
||||
restartTor() {
|
||||
sudo systemctl restart tor && notify-send "Tor restarting" || notify-send "Tor failed to restart"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-t ) $(toggle) ;;
|
||||
-c ) checkWeb ;;
|
||||
-r ) restartTor ;;
|
||||
-n ) checkNotif ;;
|
||||
* ) check ;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue