blob: 5755037f92a6e883702217c17b8e008d52b3f74d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/usr/bin/python
import sys
import re
import binascii
def extract_pppdump(input, output):
fi = open(input, "r")
fo = open(output, "wb")
p = re.compile("PPPDUMP:(.*)")
for line in fi.readlines():
m = p.match(line)
if m == None:
continue
hex = m.group(1).strip()
data = binascii.unhexlify(hex)
fo.write(data)
fi.close()
fo.close()
# command line parsing
if len(sys.argv) != 3:
print "Usage: extractdump.py [input] [output]"
sys.exit()
extract_pppdump(sys.argv[1], sys.argv[2])
|