#!/usr/bin/python import sys import re f = None for line in sys.stdin: line = line.strip() if line.startswith('00:'): if f is not None: f.close() f = open(prev_line, "wb") if re.match(r'[0-9a-f]0: ', line): f.write(''.join([chr(int(el, 16)) for el in line[4:].split()])) prev_line = line if f is not None: f.close()