blob: 9568ff40bd2ffc6570e9389796987eb077a58f29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
'''
Takes the output from a JS test, and creates a file from it. So if
you do JSON.stringify() of an array in JS, this script will take
that and make a proper file out of it
'''
import os, sys, re
data = open(sys.argv[1], 'r').read()
m = re.search('\[[\d, ]*\]', data)
data = eval(m.group(0))
string = ''.join([chr(item) for item in data])
out = open(sys.argv[1]+'.raw', 'wb')
print data[0:80]
print string[0:80]
out.write(string)
out.close()
|