![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |
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
====================================
time: 20050101101221
ip : 127.0.0.1
password: password1
<html> hier der Text
</html>
===========================
dann der 2te Eintrag, wie oben, halt mit anderen Daten.
usw.
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
5
6
7
8
====================================
time: 20050101101221
ipadress : 127.0.0.1
password: password1
<html> hier der Text
</html>
===========================
1
2
3
if ((!$pass && $ip eq $filterIp)
|| ($pass eq $filterPassword && ! $ip)
|| ($pass eq $filterPassword and $ip eq $filterIp)) {
if ($help || !($filterPassword && $ip)) {
1
2
3
4
my $counter_file2 = 0;
while(<FILE2>){
next unless($_ =~ m/ip/s);
$counter_file2++;
1
2
3
if ((!$pass && $ip eq $filterIp)
|| ($pass eq $filterPassword && ! $ip)
|| ($pass eq $filterPassword and $ip eq $filterIp)) {
if ($help || !($filterPassword && $ip)) {
![]() |
|< 1 2 3 4 >| | ![]() |
34 Einträge, 4 Seiten |