Created
January 12, 2022 16:21
-
-
Save raddy/a49a9038dcf506931856f9894ac133ce to your computer and use it in GitHub Desktop.
grep out push4 opcodes
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 sys | |
from pyevmasm import disassemble_hex | |
def four_byte(line): | |
toks = line.split() | |
if toks[0] != 'PUSH4': | |
return | |
return toks[1] | |
def main(): | |
if len(sys.argv) < 2: | |
sys.exit("Usage: <string blob from c'tor>") | |
with open(sys.argv[1]) as f: | |
blob = f.read() | |
opcodes = disassemble_hex(blob).split('\n') | |
ops = set() | |
for entry in opcodes: | |
op = four_byte(entry) | |
if not op: | |
continue | |
ops.add(op) | |
print(ops) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment