Did stuff
This commit is contained in:
parent
f20bcac9a9
commit
621021d43e
6 changed files with 60 additions and 21 deletions
33
X570PG4/magic.py
Normal file
33
X570PG4/magic.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
import os
|
||||
import io
|
||||
|
||||
def search_filetype(filePath, magicBytes):
|
||||
with io.open(filePath, mode="rb") as file:
|
||||
for line in file:
|
||||
if magicBytes in line:
|
||||
offset = file.tell()
|
||||
print(f"Found at {hex(offset)}!")
|
||||
|
||||
def extract_jpeg(filePath, offset):
|
||||
image = b''
|
||||
with io.open(filePath, mode="rb") as file:
|
||||
file.seek(offset)
|
||||
for line in file:
|
||||
if jpeg_sig not in line:
|
||||
image += line
|
||||
|
||||
f = open(f"test/{offset}.jpeg", "a")
|
||||
f.write(image)
|
||||
f.close()
|
||||
|
||||
xz_sig = b'\x5d\x00\x00'
|
||||
#tiff_sig = b'\x49\x49\x2A\x00'
|
||||
#jpeg_sig = b'\xFF\xD8\xFF\xE0'
|
||||
print("Searching for LZMA..")
|
||||
search_filetype("X570PG45.60", xz_sig)
|
||||
|
||||
#print("Searching for TIFF...")
|
||||
#search_filetype("X570PG45.60", tiff_sig)
|
||||
|
||||
#print("Searching for JPEG...")
|
||||
#search_filetype("X570PG45.60", jpeg_sig)
|
Loading…
Add table
Add a link
Reference in a new issue