![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
my $result = do { if (defined($filterPassword)) { defined($filterIp) ? $filterPassword eq $pass and $filterIp eq $ip : $filterPassword eq $pass; } # if elsif (defined $filterIp) { $filterIp eq $ip; } else { 0; } }; # do if ($result) { push(@{$filteredLines{$ip}},$_); # oder was auch immer }
1
2
my @ipconsole = ($ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) or $exit = 1;
$exit = 1 if grep $_ > 255, @ipconsole;
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
#! /usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
my ($filterPassword, $filterIp, $file, $file2, $counter_file1, $counter_file2);
my $help = 0;
GetOptions(
"password=s" => \$filterPassword,
"ip=s" => \$filterIp,
"file=s" => \$file,
"file2=s" => \$file2,
"h" => \$help,
);
if ($help) {
# &PrintHelp....
exit 1;
} # if
unless (open (LOG, "<", $file)) {
die "Error: couldn't open '$file': $!\n";
} # unless
my %filteredLines;
my $counter_file1 = 0;
while (<LOG>) {
$counter_file1++;
chomp($_);
my (undef, $pass, $ip) = split(/ /, $_);
#if ($pass eq $filterPassword and $ip eq $filterIp) {
if (($pass eq $filterPassword )
or ($ip eq $filterIp) or ($pass eq $filterPassword and $ip eq $filterIp)) {
push(@{$filteredLines{$ip}},$_);
} # if
} # while
close (LOG);
{
local $/ = "\n===";
open(FILE2,"<$file2") or die $!;
my $counter_file2 = 0;
while(<FILE2>){
$counter_file2++;
next unless($_ =~ m/ip/s);
next unless($_ =~ m/ip/s);
my ($ip) = $_ =~ m/ip\s*?:\s+([^\s]+)/s;
my ($pass) = $_ =~ m/password\s*?:\s+([^\s]+)/s;
# if ($pass eq $filterPassword and $ip eq $filterIp) {
if (($pass eq $filterPassword ) or ($ip eq $filterIp) or ($pass eq $filterPassword and $ip eq $filterIp)) {{
if($filteredLines{$ip}){
print $_,"\n" for(@{$filteredLines{$ip}});
}
} # if
}
}
}
close FILE2;
print qq~
IPs in $file: $counter_file1
IPs in $file2: $counter_file2
~;
1
2
1113193722 password1 127.0.0.1 1113193718 55555
1113193722 password2 127.0.0.2 1113193718 66666
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
====================================
time: 20050101101221
ip : 127.0.0.1
password: password1
<html> hier der Text
</html>
===========================
time: 20050101101221
ip: 192.168.0.33
password: test
<body>
irgasdklgj
asvlkasjdv
slakdfj
============================
time: 2394870985235
ip: 127.0.0.2
password: password2
asvklhaskdjvhasdv
sdvasdvasdvsdv
1113193718
my ($pass) = $_ =~ m/password\s*?:\s+([^\s]+)/s;
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
#! /usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
my ($filterPassword, $filterIp, $file, $file2);
my $help = 0;
# z.B. program.pl -p password -i 127.0.0.1 -file datei.txt
# oder: program.pl -h
GetOptions(
"password=s" => \$filterPassword,
"ip=s" => \$filterIp,
"file=s" => \$file,
"file2=s" => \$file2,
"h" => \$help,
);
if ($help) {
# &PrintHelp....
exit 1;
} # if
# vielleicht hier noch ueberpruefen, ob $filterPassword und $filterIp gesetzt sind....
unless (open (LOG, "<", $file)) {
die "Error: couldn't open '$file': $!\n";
} # unless
my %filteredLines;
while (<LOG>) {
chomp($_);
my (undef, $pass, $ip) = split(/ /, $_);
if ($pass eq $filterPassword and $ip eq $filterIp) {
push(@{$filteredLines{$ip}},$_);
} # if
} # while
close (LOG);
{
local $/ = "\n===";
open(FILE2,"<$file2") or die $!;
while(<FILE2>){
next unless($_ =~ m/ip/s);
my ($ip) = $_ =~ m/ip\s*?:\s+([^\s]+)/s;
my ($pass) = $_ =~ m/password\s*?:\s+([^\s]+)/s;
if ($pass eq $filterPassword and $ip eq $filterIp) {
if($filteredLines{$ip}){
print $_,"\n" for(@{$filteredLines{$ip}});
}
} # if
}
}
close FILE2;
1
2
1113193722 password1 127.0.0.1 1113193718 55555
1113193722 password2 127.0.0.2 1113193718 66666
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
====================================
time: 20050101101221
ip : 127.0.0.1
password: password1
<html> hier der Text
</html>
===========================
time: 20050101101221
ip: 192.168.0.33
password: test
<body>
irgasdklgj
asvlkasjdv
slakdfj
============================
time: 2394870985235
ip: 127.0.0.1
password: test2
asvklhaskdjvhasdv
sdvasdvasdvsdv
![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |