aboutsummaryrefslogtreecommitdiff
path: root/potpourri/pcap-to-xml.sh
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-04-05 22:42:12 +0000
committerRob Austein <sra@hactrn.net>2014-04-05 22:42:12 +0000
commitfe0bf509f528dbdc50c7182f81057c6a4e15e4bd (patch)
tree07c9a923d4a0ccdfea11c49cd284f6d5757c5eda /potpourri/pcap-to-xml.sh
parentaa28ef54c271fbe4d52860ff8cf13cab19e2207c (diff)
Source tree reorg, phase 1. Almost everything moved, no file contents changed.
svn path=/branches/tk685/; revision=5757
Diffstat (limited to 'potpourri/pcap-to-xml.sh')
-rw-r--r--potpourri/pcap-to-xml.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/potpourri/pcap-to-xml.sh b/potpourri/pcap-to-xml.sh
new file mode 100644
index 00000000..73c30880
--- /dev/null
+++ b/potpourri/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