~ubuntu-branches/ubuntu/trusty/picviz/trusty

« back to all changes in this revision

Viewing changes to parsers/auth/ssh-auth2pcv.pl

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2009-03-30 10:42:08 UTC
  • Revision ID: james.westby@ubuntu.com-20090330104208-j095obwkp574t1lm
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
print "header {\n";
 
4
print "    title = \"Syslog picviz analysis\";\n";
 
5
print "}\n";
 
6
print "engine {\n";
 
7
print "    relative = \"1\";\n";
 
8
print "}\n";
 
9
print "axes {\n";
 
10
print "    timeline time [label=\"Time\"];\n"; # Time
 
11
print "    string   auth [label=\"Auth type\"];\n"; # Machine
 
12
print "    ipv4     src [label=\"Source\"];\n"; # Service
 
13
print "    string   login [label=\"Login\"];\n"; # PAM Module
 
14
print "}\n";
 
15
 
 
16
print "data {\n";
 
17
 
 
18
while ($line = <>) {
 
19
 
 
20
        $line =~ s/\"/\\"/g; # We escape our quotes
 
21
        $line =~ s/&//g; # We escape our quotes
 
22
        $line =~ s/<//g; # We escape our quotes
 
23
        $line =~ s/>//g; # We escape our quotes
 
24
 
 
25
# Aug 18 (20:45:53) jazz sshd[26424]: (Accepted publickey) for (toady) from (192.168.1.23) port 63379 ssh2
 
26
# Aug 18 (20:49:47) jazz sshd[26444]: (Accepted keyboard-interactive/pam) for (toady) from (192.168.1.42) port 1115 ssh2
 
27
# Aug 18 (21:02:38) jazz sshd[26592]: error: PAM: (Authentication failure) for (toady) from (192.168.1.42)
 
28
 
 
29
        if ($line =~ m/\w+  ?\d+ (\d+:\d+:\d+) [\w-.]+ sshd.*: (.*) for (\w+) from (\d+.\d+.\d+.\d+)/) {
 
30
                $time=$1;
 
31
                $authtype=$2;
 
32
                $login=$3;
 
33
                $src=$4;
 
34
 
 
35
                if ($authtype =~ m/[fF]ail/) {
 
36
                        print "    time=\"$time\",auth=\"$authtype\",src=\"$src\",login=\"$login\" [color=\"red\"];\n";
 
37
                } else {
 
38
                        print "    time=\"$time\",auth=\"$authtype\",src=\"$src\",login=\"$login\";\n";
 
39
                }
 
40
        }
 
41
}
 
42
 
 
43
print "}\n";
 
44