- 论坛徽章:
- 307
|
- #!/usr/bin/perl
- use strict;
- use warnings;
- my %hData = ();
- while (<DATA>){
- my ($IP, $rem) = split (' ', $_, 2);
- my ($method, $state) = ($1, $2) if ($rem =~ /"(\w+)[^"]+.*?(\d+)/);
- $state == 200 ? $hData{'200'}{$IP}++ : $hData{'N200'}++;
- $hData{'GET'}{$IP}++ if ($method eq 'GET');
- }
- print "$_\n" for keys %{$hData{'200'}}; #Q1
- my @aSort = sort {$hData{'GET'}{$b} <=> $hData{'GET'}{$a}} keys %{$hData{'GET'}}; #Q2
- splice (@aSort, 5);
- print "\n$_" for @aSort;
- print "\n\n", $hData{'N200'}; #Q3
- __DATA__
- 93.193.91.75 - - [25/May/2014:15:26:51 +0200] "GET /static/img/hpi-claim_01.png HTTP/1.1" 200 3114 "https://sample-server/isec/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"
- 93.193.91.75 - - [25/May/2014:15:26:51 +0200] "GET /static/img/Logo.png HTTP/1.1" 200 7930 "https://sample-server/isec/" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"
- 93.193.91.75 - - [25/May/2014:15:26:51 +0200] "GET /static/img/startseite_blau.png HTTP/1.1" 200 654957 "https://sample-server/static/css/extra.css" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"
- 37.24.149.124 - - [25/May/2014:15:26:53 +0200] "GET /isec/accounts/ HTTP/1.1" 200 5338 "https://sample-server/isec/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
- 37.24.149.124 - - [25/May/2014:15:26:53 +0200] "GET /isec/my_admin/jsi18n/ HTTP/1.1" 200 4553 "https://sample-server/isec/accounts/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
- 37.201.226.131 - - [25/May/2014:15:26:53 +0200] "GET /isec/search/ HTTP/1.1" 200 5083 "https://sample-server/isec/checkMe/?browser=Chrome&ver=35.0.1916.114&sys=Windows%207&plugins=Java:1.7.0.55,Flash:13.0.0.214,VLC%20Player:2.1.3.0,Silverlight:5.1.30214.0" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
- 37.24.149.124 - - [25/May/2014:15:26:53 +0200] "GET /static/js/affected.js HTTP/1.1" 200 2452 "https://sample-server/isec/accounts/" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
- 37.201.226.131 - - [25/May/2014:15:26:53 +0200] "GET /isec/my_admin/jsi18n/ HTTP/1.1" 200 4394 "https://sample-server/isec/search/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36"
- 85.183.238.26 - - [25/May/2014:15:26:54 +0200] "GET / HTTP/1.1" 302 6988 "http://www.pcwelt.de/news/Gratis-Check_verraet__ob_Ihre_Daten_sicher_sind-Identity_Leak_Checker-8725246.html?r=563613162754286&lid=331276&pm_ln=11" "Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0"
- 85.183.238.26 - - [25/May/2014:15:26:54 +0200] "GET /isec/ HTTP/1.1" 200 5890 "http://www.pcwelt.de/news/Gratis-Check_verraet__ob_Ihre_Daten_sicher_sind-Identity_Leak_Checker-8725246.html?r=563613162754286&lid=331276&pm_ln=11" "Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0"
- 85.183.238.26 - - [25/May/2014:15:26:55 +0200] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 12249 "https://sample-server/isec/" "Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0"
- 85.183.238.26 - - [25/May/2014:15:26:55 +0200] "GET /static/prettify/prettify.css HTTP/1.1" 200 852 "https://sample-server/isec/" "Mozilla/5.0 (Windows NT 6.1; rv:29.0) Gecko/20100101 Firefox/29.0"
复制代码 |
|