This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfreport
executable file
·84 lines (72 loc) · 1.68 KB
/
freport
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/perl
#
# FTester log parser v1.0
# Copyright (C) 2001-2006 Andrea Barisani <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
use strict;
my (@log, @logd, @id, @authorized, @filtered, @orig, @nat);
open LOG, "$ARGV[0]" || die "Usage $0 ftest.log ftestd.log";
open LOGD, "$ARGV[1]" || die "Usage $0 ftest.log ftestd.log";
while (<LOG>) {
next unless /^[0-9]+\s-\s/;
next if /^IDS/;
my @fields = split /\s-\s/;
$log[($fields[0] - 1)] = $_;
}
while (<LOGD>) {
next unless /^[0-9]+\s-\s/;
next if /^IDS/;
my @fieldsd = split /\s-\s/;
$logd[($fieldsd[0] - 1)] = $_;
}
close LOG;
close LOGD;
chomp @log;
chomp @logd;
my $i = 0;
foreach (@log) {
if ($logd[$i] and ($log[$i] eq $logd[$i])) {
push (@authorized, $log[$i]);
}
elsif (!$logd[$i]) {
push (@filtered, $log[$i]);
}
else {
push (@orig, $log[$i]);
push (@nat, $logd[$i]);
}
$i++;
}
print("\n");
print("Authorized packets:\n");
print("-------------------\n");
print("\n");
foreach (@authorized) {
next if !($_);
print($_, "\n");
}
print("\n");
print("Modified packets (probably NAT):\n");
print("--------------------------------\n");
print("\n");
foreach (@orig) {
next if !($_);
print($_, "\n");
}
print(" >>>>>>>>\n");
foreach (@nat) {
next if !($_);
print($_, "\n");
}
print("\n");
print("Filtered or dropped packets:\n");
print("----------------------------\n");
print("\n");
foreach (@filtered) {
next if !($_);
print($_, "\n");
}
print("\n");