blob: 97da7673e4463231e03842323d91bbbac6d65b9b [file] [log] [blame]
Harald Welte04fe6b52020-06-20 21:05:31 +02001#!/usr/bin/python3
2
3# parses the output of strace and stroes the binary writes to a file
4
5import re, binascii
6from struct import *
7
8
9p = re.compile('read\(\d+, "(.*)", \d+\) = \d+')
10
11fi = open("e1_ts2_short.log", "r")
12fo = open("e1_ts2_short.bin", "wb")
13
14for line in fi:
15 m = p.match(line)
16 data = m.group(1)
17 snippets = [data[2+i:4+i] for i in range(0, len(data), 4)]
18 for s in snippets:
19 b = binascii.unhexlify(s)
20 fo.write(b)