awk , count the number of occurrences of each ip that cracks your password in secure.log | the number of occurrences of each ip address in access.log

Count the number of occurrences of each ip that cracks your password in secure.log

[root@oldboyedu-sh01-lnb files]# awk '/Failed password/{h[$(NF-3)]++}END{for(pol in h) print pol,h[pol]}' secure-20161219  |sort -rnk2|head
218.65.30.25 68652
218.65.30.53 34326
218.87.109.154 21201
112.85.42.103 18065
112.85.42.99 17164
218.87.109.151 17163
218.87.109.150 17163
218.65.30.61 17163
218.65.30.126 17163
218.65.30.124 17163

 

Count the number of occurrences of each ip address in the access.log

[root@oldboyedu-sh01-lnb files]# awk   '{h[$1]++}END{for(pol in h) print pol,h[pol]}' access.log |sort -rnk2 |head
58.220.223.62 12049
112.64.171.98 10856
114.83.184.139 1982
117.136.66.10 1662
115.29.245.13 1318
223.104.5.197 961
116.216.0.60 957
180.111.48.14 939
223.104.5.202 871
223.104.4.139 869
 
 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324787468&siteId=291194637