Skip to content

Instantly share code, notes, and snippets.

@raddy
Created January 10, 2022 00:18
Show Gist options
  • Save raddy/826e0e1e98cbf5919f7e5976827de64f to your computer and use it in GitHub Desktop.
Save raddy/826e0e1e98cbf5919f7e5976827de64f to your computer and use it in GitHub Desktop.
checks the ctor bytes vs known addies
import sys
import json
def etherscan_link(addy : str):
return f"https://etherscan.io/address/{addy}"
def formatted_addy(addy : str):
l = etherscan_link(addy)
return f"[{addy}]({l})"
def load_json(path : str):
with open(path) as f:
return json.load(f)
def build_dict(path: str):
resp_json = load_json(path)
addy_dict = {}
for entry in resp_json:
addy_dict[entry['TX_TO_ADDRESS']] = entry['TX_TO_ADDRESS_NAME']
return addy_dict
def main():
if len(sys.argv) < 3:
sys.exit("Usage: <string blob from c'tor> <flipside_json_dump>")
ctor_string = sys.argv[1]
possibles = ['0x' + ctor_string[i:i+40] for i in range(0, len(ctor_string)-40 + 1)]
addy_dict = build_dict(sys.argv[2])
addies = {}
for p in possibles:
name = addy_dict.get(p, '')
if name != '':
addies[p] = name
for addy,name in addies.items():
print(formatted_addy(addy) + ' | ' + name)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment