summaryrefslogtreecommitdiffstats
path: root/tests/setkey2esp-secrets.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:41:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:41:34 +0000
commitf7b5fc832288fae3f5a0f3d24b96782252aabbaf (patch)
tree711bd849ca1348d3c97dc9bbbd157b80e9c410aa /tests/setkey2esp-secrets.pl
parentInitial commit. (diff)
downloadtcpdump-upstream.tar.xz
tcpdump-upstream.zip
Adding upstream version 4.99.3.upstream/4.99.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/setkey2esp-secrets.pl')
-rwxr-xr-xtests/setkey2esp-secrets.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/setkey2esp-secrets.pl b/tests/setkey2esp-secrets.pl
new file mode 100755
index 0000000..92fa385
--- /dev/null
+++ b/tests/setkey2esp-secrets.pl
@@ -0,0 +1,24 @@
+#!/usr/local/bin/perl
+#
+# usage:
+# setkey -D | perl thisfile > secrets.txt
+# tcpdump -n -E "file secrets.txt"
+#
+while (<>) {
+ if (/^(\S+)\s+(\S+)/) {
+ $src = $1;
+ $dst = $2;
+ next;
+ }
+ if (/^\s+esp.*spi=(\d+)/) {
+ $spi = $1;
+ next;
+ }
+ if (/^\s+E:\s+(\S+)\s+(.*)$/) {
+ $algo = $1. "-hmac96";
+ ($secret = $2) =~ s/\s+//g;
+
+ printf"0x%x@%s %s:0x%s\n", $spi, $dst, $algo, $secret;
+ next;
+ }
+}