• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/local/bin/perl
2#
3# usage:
4#	setkey -D | perl thisfile > secrets.txt
5#	tcpdump -n -E "file secrets.txt"
6#
7while (<>) {
8	if (/^(\S+)\s+(\S+)/) {
9		$src = $1;
10		$dst = $2;
11		next;
12	}
13	if (/^\s+esp.*spi=(\d+)/) {
14		$spi = $1;
15		next;
16	}
17	if (/^\s+E:\s+(\S+)\s+(.*)$/) {
18		$algo = $1. "-hmac96";
19		($secret = $2) =~ s/\s+//g;
20
21		printf"0x%x@%s %s:0x%s\n", $spi, $dst, $algo, $secret;
22		next;
23	}
24}
25