|
|
import re |
|
|
|
|
|
data = open(r"c:\Users\MattyMroz\Desktop\PROJECTS\ONEOCR\ocr_data\oneocr.dll", "rb").read() |
|
|
|
|
|
|
|
|
print("=== All BCrypt function references ===") |
|
|
for m in re.finditer(b'BCrypt\w+', data): |
|
|
offset = m.start() |
|
|
name = m.group().decode('ascii') |
|
|
print(f" [0x{offset:08x}] {name}") |
|
|
|
|
|
|
|
|
print() |
|
|
for fn in [b"BCryptGenerateSymmetricKey", b"BCryptImportKey", b"BCryptCreateHash"]: |
|
|
pos = data.find(fn) |
|
|
print(f" {fn.decode()}: {'FOUND at 0x' + format(pos, '08x') if pos != -1 else 'NOT FOUND'}") |
|
|
|
|
|
|
|
|
print() |
|
|
print("=== Looking for MAGIC_NUMBER = 1 constant context ===") |
|
|
for pattern in [b"magic_number == MAGIC_NUMBER"]: |
|
|
pos = data.find(pattern) |
|
|
while pos != -1: |
|
|
|
|
|
ctx_start = max(0, pos - 100) |
|
|
ctx_end = min(len(data), pos + 100) |
|
|
ctx = data[ctx_start:ctx_end] |
|
|
|
|
|
for m in re.finditer(b'[\x20-\x7e]{4,}', ctx): |
|
|
print(f" [0x{ctx_start + m.start():08x}] {m.group().decode('ascii')}") |
|
|
pos = data.find(pattern, pos + 1) |
|
|
if pos == -1: |
|
|
break |
|
|
|
|
|
|
|
|
print() |
|
|
print("=== Extended crypto region dump 0x02724b00-0x02724d00 ===") |
|
|
for i in range(0x02724b00, 0x02724d00, 16): |
|
|
chunk = data[i:i+16] |
|
|
hex_part = " ".join(f"{b:02x}" for b in chunk) |
|
|
ascii_part = "".join(chr(b) if 32 <= b < 127 else "." for b in chunk) |
|
|
print(f" {i:08x}: {hex_part:<48s} {ascii_part}") |
|
|
|
|
|
|
|
|
|
|
|
print() |
|
|
print("=== Finding code references to Crypto.cpp ===") |
|
|
crypto_path = b"C:\\__w\\1\\s\\CoreEngine\\Native\\ModelParser\\Crypto.cpp" |
|
|
pos = data.find(crypto_path) |
|
|
if pos != -1: |
|
|
|
|
|
|
|
|
print(f" Crypto.cpp string at: 0x{pos:08x}") |
|
|
|
|
|
|
|
|
print() |
|
|
print("=== Looking for block length values near crypto code ===") |
|
|
bl_str = data.find(b"B\x00l\x00o\x00c\x00k\x00L\x00e\x00n\x00g\x00t\x00h\x00") |
|
|
if bl_str != -1: |
|
|
print(f" BlockLength wide string at: 0x{bl_str:08x}") |
|
|
ml_str = data.find(b"M\x00e\x00s\x00s\x00a\x00g\x00e\x00B\x00l\x00o\x00c\x00k\x00L\x00e\x00n\x00g\x00t\x00h\x00") |
|
|
if ml_str != -1: |
|
|
print(f" MessageBlockLength wide string at: 0x{ml_str:08x}") |
|
|
|