Skip to content

Instantly share code, notes, and snippets.

@DogeVenci
Last active August 30, 2018 03:26
Show Gist options
  • Save DogeVenci/d73c3c81f1dca3035658fccfb362fb4d to your computer and use it in GitHub Desktop.
Save DogeVenci/d73c3c81f1dca3035658fccfb362fb4d to your computer and use it in GitHub Desktop.
[提取日志中ip地址并且自动查询归属地] #shell #ip #awk #regex
2018/08/16 19:05:59 udp:182.89.62.114:4183 accepted tcp:clients1.google.com:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:[2001:b28:f23f:f005::a]:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:443
2018/08/16 19:06:04 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:80
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:80
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:149.154.166.120:443
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:443
2018/08/16 19:06:15 udp:182.89.62.114:4183 accepted tcp:[2001:67c:4e8:f004::b]:443
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:[2001:67c:4e8:f004::b]:443
2018/08/16 19:06:15 udp:182.89.62.114:4346 accepted tcp:149.154.166.120:80
2018/08/16 19:06:32 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:443
2018/08/16 19:06:32 udp:182.89.62.114:4183 accepted tcp:149.154.166.120:80
2018/08/16 19:06:32 udp:182.89.62.114:4183 accepted tcp:[2001:67c:4e8:f004::b]:443
2018/08/16 19:06:32 udp:182.89.62.114:4346 accepted tcp:[2001:b28:f23d:f001::a]:443
2018/08/16 19:06:32 udp:182.89.62.114:4183 accepted tcp:149.154.175.50:443
2018/08/16 19:06:32 udp:182.89.62.114:4346 accepted tcp:149.154.175.50:80
2018/08/16 19:06:42 udp:182.89.62.114:4346 accepted tcp:91.108.56.130:443
2018/08/16 19:06:42 udp:182.89.62.114:4183 accepted tcp:[2001:b28:f23f:f005::a]:443
2018/08/16 19:06:42 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:80
2018/08/16 19:06:54 udp:182.89.62.114:4183 accepted tcp:149.154.167.51:443
2018/08/16 19:06:54 udp:182.89.62.114:4346 accepted tcp:149.154.167.51:80
2018/08/16 19:06:54 udp:182.89.62.114:4183 accepted tcp:[2001:67c:4e8:f002::a]:443
2018/08/16 19:06:54 udp:182.89.62.114:4183 accepted tcp:[2001:67c:4e8:f002::a]:443
2018/08/16 19:06:54 udp:182.89.62.114:4183 accepted tcp:149.154.167.51:80
2018/08/16 19:06:54 udp:182.89.62.114:4346 accepted tcp:149.154.167.51:443
2018/08/16 19:07:08 udp:182.89.62.114:4183 accepted udp:8.8.8.8:53
2018/08/16 19:07:08 udp:182.89.62.114:4183 accepted tcp:gist.github.com:443
2018/08/16 19:07:08 udp:182.89.62.114:4183 accepted tcp:gist.github.com:443
2018/08/16 19:07:14 udp:182.89.62.114:4183 accepted tcp:149.154.175.50:443
2018/08/16 19:07:14 udp:182.89.62.114:4183 accepted tcp:[2001:b28:f23d:f001::a]:443
2018/08/16 19:07:14 udp:182.89.62.114:4183 accepted tcp:149.154.175.50:80
2018/08/16 19:07:22 182.89.62.114:4423 accepted udp:47.75.188.99:19000
2018/08/16 19:07:26 182.89.62.114:4425 accepted udp:47.75.188.99:80
2018/08/16 19:07:29 182.89.62.114:4427 accepted udp:47.75.188.99:19000
2018/08/16 19:07:33 182.89.62.114:4432 accepted udp:47.75.188.99:80
2018/08/16 19:07:33 udp:182.89.62.114:4183 accepted tcp:[2001:b28:f23f:f005::a]:443
2018/08/16 19:07:33 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:443
2018/08/16 19:07:33 udp:182.89.62.114:4183 accepted tcp:91.108.56.130:80
awk '{print $3}' access.log |grep -Eo "([0-9]{1,3}[\.]){3}[0-9]{1,3}" |uniq |xargs -i curl ip.cn/{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment