Created
September 29, 2023 05:31
-
-
Save mipsparc/767ab4cf59e9e074557cfb5a8ec8138c to your computer and use it in GitHub Desktop.
バイナリファイル内に特定の繰り返しが、(16bitにalignしていなくても)何個出現するかを探索する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bitstring | |
import collections | |
f = open("result.bin", "rb").read() | |
b = bitstring.BitArray(bytes=f) | |
def check(b): | |
l = [] | |
for i in b.findall("0x7E"): | |
if str(b[i+72:i+80]) == '0x7e': | |
l.append(str(b[i:i+80])) | |
return l | |
s = check(b) | |
print(collections.Counter(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment