Answer the question
In order to leave comments, you need to log in
Python hex or binary data man
Good afternoon!
In flash, it is possible to convert an object as an array of bytes and then any mockery of these bytes and an array (somehow +\- any number to a byte)
I'm trying to solve a similar problem in python, that is, read the file byte by byte, subtract its position from the byte (yes -yes, it sounds crazy, but somehow it works on flash)
Something similar was achieved through
But extra 3 zeros are written to the file ... I don’t know what to do ((
f = open('ac.swf', 'rb+')
ff = open('aaaa.swf', 'wb+')
data = f.read()
for i,el in enumerate(data):
el = unpack('<b', el)
ff.write(pack('i', el[0]-i))
Answer the question
In order to leave comments, you need to log in
Are you unpacking a byte and packing it into an integer? Maybe in bytes and pack?
They said above correctly - you pack not what you unpacked.
If the file is small, then it is probably more convenient to immediately read it into an array, process it, and then write the array.
For example like this:
data = file('ac.swf','rb').read()
bytearr = unpack('<%db'%len(data), data)
# Process array bytearr: enumerate(bytearr)...
file('aaaa.swf','wb').write(pack('<%db'%len(bytearr), bytearr))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question