This repository has been archived on 2024-05-28. You can view files and clone it, but cannot push or open issues or pull requests.
2023-11-14 16:25:09 -05:00

16 lines
468 B
Python
Executable File

# this script extract image from binary file
with open('cutecom.log', 'rb') as f:
data = f.read()
print(type(data))
# find ff d8 as begin and ff d9 as end
start, end = 0, 0
for i in range(50):
start = data.find(b'\xff\xd8', end)
print(f"start: {start}")
end = data.find(b'\xff\xd9', start)
print(end)
# extract image
with open(f'image{i}.jpg', 'wb') as f2:
f2.write(data[start:end + 2])