Skip to content

Instantly share code, notes, and snippets.

@Ky6uk
Created September 18, 2012 07:19
Show Gist options
  • Save Ky6uk/3741759 to your computer and use it in GitHub Desktop.
Save Ky6uk/3741759 to your computer and use it in GitHub Desktop.
Statistic for iptables ssh blocker
#!/bin/bash
declare -A hash
for i in $(zgrep Blocked /var/log/syslog* | awk '{print $12}' | cut -d'=' -f2);
do
if [ ! ${hash[$i]} ];
then
hash[$i]=1
else
hash[$i]=$( expr ${hash[$i]} + 1 )
fi
done
for i in ${!hash[@]};
do
echo -e "$i\t\t${hash[$i]}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment