Skip to content

Instantly share code, notes, and snippets.

@c7h c7h/user.pl
Created Dec 9, 2015

Embed
What would you like to do?
logfile evaluation
#!/usr/bin/perl
my $user_c = 0;
my $user_min = 0;
my @ip = ();
while(<>) {
if (m/(^\w+).*(\d{2}:\d{2})/) {
if ($1 eq 'christoph'){
$user_c++; # user_zaehler erhöhen
$user_min =+ $2
}
}
if (m/((?:\d{1,3}\.){3}\d{1,3})/){
#ip-addressen
push @ip, $1;
}
}
#fertig
print "IP-Adressen:\n";
foreach (@ip){
print $_."\n";
}
print "ipsarray @ip";
print "\n";
print "user christoph war $user_c mal angemeldet ($user_min lang)\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.