Skip to content

Instantly share code, notes, and snippets.

@etcwilde
Last active January 27, 2017 00:11
Show Gist options
  • Save etcwilde/a36256d951b0182f72d34982772c6ce9 to your computer and use it in GitHub Desktop.
Save etcwilde/a36256d951b0182f72d34982772c6ce9 to your computer and use it in GitHub Desktop.
Fun Shell Scripts
#!/bin/sh
# Who is trying to access your server without permission?
sudo journalctl -u sshd \
| awk '/Failed password for/ {print $11}' \
| while read address; do whois "$address" \
| grep -m 1 -i "Country: " \
| sed "s/[Cc]ountry:/$address/"; done \
| awk '{print $2 " --> " $1}' \
| uniq -c \
| sort -r
for ((I=0;J=--I;))do clear;for ((D=$LINES;S=++J**3%$COLUMNS,--D;))do printf "%*s. \n" $S;done;sleep 0.5;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment