diff options
author | Rob Austein <sra@hactrn.net> | 2011-09-05 19:27:42 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2011-09-05 19:27:42 +0000 |
commit | f397088e903e3fa696cf5d0c44b92b49d7642091 (patch) | |
tree | 73832cdcc9e4bbfed060e869e132e7340bd8d9c7 /scripts | |
parent | 26a4c0d605011ed5842a36d46cd4459d68e5eb66 (diff) |
Rudamentary script for extracting XML from pcap files.
svn path=/scripts/pcap-to-xml.sh; revision=3969
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/pcap-to-xml.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/pcap-to-xml.sh b/scripts/pcap-to-xml.sh new file mode 100644 index 00000000..73c30880 --- /dev/null +++ b/scripts/pcap-to-xml.sh @@ -0,0 +1,36 @@ +#!/bin/sh - +# $Id$ +# +# Copyright (C) 2011 Internet Systems Consortium ("ISC") +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +# Zeroeth cut at a packet decoder for RPKI up-down / left-right / +# publication traffic captured off the wire. Needs work, not suitable +# for general use, depends on a bunch of external programs that I +# happen to have installed...but has been useful to me. + +for p in *.pcap +do + tcptrace -e $p + for i in *.dat + do + j=${i%_contents.dat} + sed '1,/^
$/d' $i >$j.der + openssl cms -verify -noverify -inform DER -in $j.der | xmlindent > $j.xml + k=$(dumpasn1 -a $j.der 2>/dev/null | awk 'BEGIN {FS = "[ \t/:]+"} /signingTime/ {nr = NR + 2} NR == nr {print $6 "-" $5 "-" $4 "T" $7 ":" $8 ":" $9 "Z"}') + mv $j.der $k.$j.der + mv $j.xml $k.$j.xml + rm $i + done +done |