Created
January 10, 2022 00:18
-
-
Save raddy/826e0e1e98cbf5919f7e5976827de64f to your computer and use it in GitHub Desktop.
checks the ctor bytes vs known addies
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 | |
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