是否容易印刷IP_Address:port# ? 由于我刚到塞德的指挥所去,港口被 stripped除。
input file example
Apr 6 14:20:41 TCP 178.255.83.1:80 in
preferred output like this
Apr 6 14:20:41 TCP 178.255.83.1:80 in United Kingdom
egrep -w TCP|UDP $Denied_IPs |
sed s/:[^:]* in/ in/; s/:[^:]* out/ out/ |
awk {cmd="echo "$5" | code | fgrep Country: | cut -c 16-43";
cmd | getline rslt;
close(cmd);
print $1" "$2" "$3" "$4" "$5" "$6" "rslt} >> "$IP2COUNTRY"