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

« back to all changes in this revision

Viewing changes to parsers/web/squidguard2picviz.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
# This script is (c) Olivier Delhomme 2008
 
4
#
 
5
 
 
6
print "header {\n";
 
7
print "    title = \"SquidGuard picviz analysis\";\n";
 
8
print "}\n";
 
9
 
 
10
print "axes {\n";
 
11
print "    timeline t [label=\"Time\"];\n";
 
12
print "    ipv4     i [label=\"IPaddr\"];\n";
 
13
print "    string   u [label=\"URL\"];\n";
 
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
        $line =~ s/>//g;     # We escape our quotes
 
25
 
 
26
        # 2008-10-21 10:46:33 [15906] Request(default/media/-) http://img.youtube.com/vi/1skpHUfnaig/2.jpg 10.1.13.33/- - GET REDIRECT
 
27
        $line =~ m/^\S* (\d+:\d+):\d+ \S* \S* http:\/\/([\w\.-]*)\/\S* (\d+.\d+.\d+.\d+)\/- .*/;
 
28
 
 
29
        $time=$1;
 
30
        $ipaddr=$3;
 
31
        $url=$2;
 
32
 
 
33
        print "    t=\"$time\",i=\"$ipaddr\",u=\"$url\" ";
 
34
        print ";\n";
 
35
}
 
36
print "}\n";