added iptables recent tracking script
This commit is contained in:
parent
cc2dc2c0e4
commit
862612a8e9
1 changed files with 14 additions and 0 deletions
14
iptables-show-recent.sh
Executable file
14
iptables-show-recent.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# Author: Oliver Ladner <oli@lugh.ch>
|
||||
# License: LGPL
|
||||
#
|
||||
# Shows recent connections tracked by the iptables "recent" module.
|
||||
# Requirements:
|
||||
# - iptables with rules for the "recent" module
|
||||
# - Shell cmds: geoiplookup
|
||||
|
||||
for ip in $(cat /proc/net/xt_recent/DEFAULT | awk {'print $1'} | sed 's/src=//'); do
|
||||
IP=$(geoiplookup $ip | sed 's/GeoIP Country Edition:.*, //')
|
||||
COUNT=$(cat /proc/net/xt_recent/DEFAULT | grep "$ip" | awk {'print $7'})
|
||||
echo -e "$COUNT\t$ip\t($IP)"
|
||||
done | sort -rn
|
||||
Loading…
Add table
Add a link
Reference in a new issue