🖥️inotifywait

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the inotifywait command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#  ██╗███╗   ██╗ ██████╗ ████████╗██╗███████╗██╗   ██╗██╗    ██╗ █████╗ ██╗████████╗
#  ██║████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝╚██╗ ██╔╝██║    ██║██╔══██╗██║╚══██╔══╝
#  ██║██╔██╗ ██║██║   ██║   ██║   ██║█████╗   ╚████╔╝ ██║ █╗ ██║███████║██║   ██║   
#  ██║██║╚██╗██║██║   ██║   ██║   ██║██╔══╝    ╚██╔╝  ██║███╗██║██╔══██║██║   ██║   
#  ██║██║ ╚████║╚██████╔╝   ██║   ██║██║        ██║   ╚███╔███╔╝██║  ██║██║   ██║   
#  ╚═╝╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝╚═╝        ╚═╝    ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝   ╚═╝   

inotifywait -e open art.jpg && s=$(stat -c %s art.jpg );h=$(($s/2));r=$((s-h)); dd if=/dev/urandom | grep -a -o -P "[\x01-\xD0]" | tr -d $'\n' | dd of=art.jpg bs=1 seek=$h count=$r 
# Digitally "shred" half a file after it is opened. 

#Block all brute force attacks in realtime (IPv4/SSH)
# Was to long with a loop, use a while loop for have it running 24/7
inotifywait -r -q --format %w /var/log/auth.log|grep -i "Failed pass"|tail -n 1|grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}';iptables -I INPUT -i eth0 -s "$(cat /var/log/auth.log|grep "authentication failure; l"|awk -Frhost= '{print $2}'|tail -n 1)" -j DROP

inotifywait -m -r -e close_write . | while read dir op file ; do [[ "$op" =~ CLOSE ]] && cp -va "${dir}${file}" ../saved/ ; done
# Use inotifywait on Linux to *try* to copy a file (outside the tree) after it's closed and before it's removed. Note: This may not be fast enough.

# Block all brute force attacks in realtime (IPv4/SSH) -> Was to long with a loop, use a while loop for have it running 24/7
inotifywait -r -q --format %w /var/log/auth.log|grep -i "Failed pass"|tail -n 1|grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}';iptables -I INPUT -i eth0 -s "$(cat /var/log/auth.log|grep "authentication failure; l"|awk -Frhost= '{print $2}'|tail -n 1)" -j DROP
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░