Created
April 22, 2023 07:32
-
-
Save bodqhrohro/12eaaacbde88c32a7e1e4d4c6ed81da2 to your computer and use it in GitHub Desktop.
Simple anal probe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Spies on me | |
[Service] | |
ExecStart=/data/progs/shell/analprobe.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DISPLAY=:0 | |
wnd_focus=$(xdotool getwindowfocus) | |
wnd_title=$(xprop -id "$wnd_focus" WM_NAME) | |
wnd_class=$(xprop -id "$wnd_focus" WM_CLASS) | |
active_vt=$(fgconsole) | |
dpms_state=$(xset q |grep Monitor) | |
title_regex='(".*")' | |
class_regex='(".*"), (".*")' | |
dpms_regex='([^ ]+)$' | |
if [[ "$wnd_title" =~ $title_regex ]]; then | |
wnd_title=${BASH_REMATCH[1]} | |
else | |
wnd_title='""' | |
fi | |
if [[ "$wnd_class" =~ $class_regex ]]; then | |
wnd_class="${BASH_REMATCH[1]},${BASH_REMATCH[2]}" | |
else | |
wnd_class='"",""' | |
fi | |
if [[ "$dpms_state" =~ $dpms_regex ]]; then | |
dpms_state="${BASH_REMATCH[1]}" | |
else | |
dpms_state='On' | |
fi | |
echo $(date '+%d-%m-%Y,%H:%M:%S,')"$active_vt,$dpms_state,$wnd_class,$wnd_title" >> ~/.var/log/anallog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Probe my anus every 5 seconds | |
Wants=dbus.service | |
[Timer] | |
OnBootSec=5 | |
OnUnitActiveSec=5 | |
AccuracySec=1 | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment