Leser: 17
1
2
3
4
5
6
7
8
9
10
2010-11-18 22:52:40 [INFO] Sign placed by Shanuson at 335 65 -1638
2010-11-18 22:52:40 [INFO] Line 1 : You are
2010-11-18 22:52:40 [INFO] Line 2 : a
2010-11-18 22:52:40 [INFO] Line 3 : stupid
2010-11-18 22:52:40 [INFO] Line 4 : Asshole
2010-11-18 22:57:45 [INFO] Sign placed by Shanuson at 396 65 -1612
2010-11-18 22:57:45 [INFO] Line 1 : Bridge
2010-11-18 22:57:45 [INFO] Line 2 : Under
2010-11-18 22:57:45 [INFO] Line 3 : Construction
2010-11-18 22:57:45 [INFO] Line 4 : Shanuson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/usr/bin/perl # Minecraft Audit # by m1ndgames for # Hexagon.de.tf ############################# use warnings; use strict; my $logfilepath = "/minecraft/bin/logs/"; my @logfiles = `ls $logfilepath*.log`; open(BADWORDS, "<", "badwords.db"); foreach(@logfiles) { open(CURRENTLOG, $_) or die $!; foreach(<CURRENTLOG>) { my $line = $_; if ($line =~ /Sign/) { print $line; } elsif ($line =~ /Line/) { foreach (<BADWORDS>) { if ($line =~ /$_/) { print $_; } } } elsif ($line =~ /Antigrief/) { # print $line; } } }
1
2
2010-11-18 22:52:40 [INFO] Sign placed by Shanuson at 335 65 -1638
2010-11-18 22:52:40 [INFO] Line 4 : Asshole
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/perl use warnings; use strict; use FindBin '$Bin'; my $wordsfile="$Bin/badwords.db"; my $logfilepath = "/minecraft/bin/logs/"; my @logfiles = glob("$logfilepath*.log"); open(my $fh, '<', $wordsfile) or die("Error open $wordsfile ($!)"); my @barwords=<$fh>; close($fh); chomp(@barwords); for my $file (@logfiles) { open(my $fh, '<', $file) or die ("Error open $file ($!)"); while(my $line=<$fh>) { if($line=~/Sign|Antigrief/) { print $line; } elsif($line=~/Line/ && grep{$line=~/$_/}@barwords) { print $line; } } }
1 2 3 4 5 6 7 8 9 10 11 12
while(my $line=<$fh>) { my $sign = ''; if ($line=~/Sign|Antigrief/) { $sign = $line; } elsif ($line=~/Line/ && grep {$line=~/$_/} @barwords) { if ($sign) { print $sign; $sign = ''; } print $line; } }
1 2 3 4 5 6 7 8 9 10 11 12
my $sign = ''; while(my $line=<$fh>) { if ($line=~/Sign|Antigrief/) { $sign = $line; } elsif ($line=~/Line/ && grep {$line=~/$_/} @barwords) { if ($sign) { print $sign; $sign = ''; } print $line; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#!/usr/bin/perl # Minecraft Logfile Audit # by m1ndgames for # Hexagon.de.tf ############################# use warnings; use strict; use FindBin '$Bin'; my @staff = ("m1ndgames", "Hexzel"); my $badwordsfile = "$Bin/badwords.db"; my $logfilepath = "/minecraft/bin/logs/"; my @logfiles = glob("$logfilepath*.log"); open( my $fh, '<', $badwordsfile ) or die("Error open $badwordsfile ($!)"); my @badwords = <$fh>; close($fh); chomp(@badwords); my @signreport; my @griefreport; for my $file (@logfiles) { open( my $fh, '<', $file ) or die("Error open $file ($!)"); my @logs = <$fh>; close($fh); foreach ( @logs ) { my $line = $_; if ( $line =~ /Line/ && grep { $line =~ /$_/ } @badwords ) { my $badline = $line; if ($badline =~ /(.+) \[INFO\] Line . : (.+)/) { my $date = $1; my $sign = $2; foreach ( @logs ) { if ($_ =~ /$date \[INFO\] Sign placed by (.+) at (.+)/) { push(@signreport,"$date - $1 placed Sign \"$sign\" at location: $2\n"); } } } } elsif ($line =~ /(.+) \[INFO\] Antigrief incident coordinates : (.+)/) { my $date = $1; my $location = $2; foreach ( @logs ) { if ($_ =~ /$date \[INFO\] Antigrief alarm : (.+)/) { push(@griefreport,"$date - Grief Alarm: $1 - Coordinates: $location\n"); } } } } } foreach(@signreport) { my $line = $_; if (grep { $line =~ /$_/ } @staff ) { shift; } else { print $_; } } foreach(@griefreport) { my $line = $_; if (grep { $line =~ /$_/ } @staff ) { shift; } else { print $_; } }
2010-11-19T12:08:06 topegKlar!Wenn das so sein soll, muss "$sign" aber außerhalb der Schleife definiert werden: