#!/usr/bin/perl # # ipchain_logs_to_db # Copyright (C) 2000 by John Heidemann # $Id: ipchain_logs_to_db,v 1.2 2003/05/23 04:15:54 johnh Exp $ # # This program is distributed under terms of the GNU general # public license, version 2. See the file COPYING # in $dblib for details. # sub usage { print STDERR < 0 && $ARGV[0] eq '-?'); # maximal: print "#h month dayofmonth time host kernel packet log chain rule interface proto source dest length tos ipid fragment ttl ruleno\n"; print "#h monthday time chain rule interface proto srcippo destippo srcip srcpo destip destpo length tos ipid fragment ttl flags ruleno\n"; while () { chomp; my(@f) = split(/ /); $f[10] =~ s/PROTO=//; my($srcip, $srcpo) = split(/:/, $f[11]); my($destip, $destpo) = split(/:/, $f[12]); $f[13] =~ s/L=//; $f[14] =~ s/S=//; $f[15] =~ s/I=//; $f[16] =~ s/F=//; $f[17] =~ s/T=//; my($flags, $ruleno) = ('-', $f[18]); if ($ruleno !~ /^\(/) { $flags = $f[18]; $ruleno = $f[19]; }; $ruleno =~ s/\(\#(\d+)\)/$1/; my(@of) = ("$f[0]-$f[1]", $f[2], $f[7], $f[8], $f[9], $f[10], $f[11], $f[12], $srcip, $srcpo, $destip, $destpo, $f[13], $f[14], $f[15], $f[16], $f[17], $flags, $ruleno); print join(" ", @of, "\n"); } print "# | $prog " . join(" ", @orig_argv) . "\n"; exit 0;