Last active
April 28, 2018 18:21
-
-
Save veox/8af41cd60c59da5d038e1b648ae8c7ce to your computer and use it in GitHub Desktop.
grep --with-filename -v -E "^>>>" *
This file contains hidden or 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
| #!/usr/bin/env python | |
| # see https://{gitlab,hithub}.com/veox/funsel-preimage instead | |
| import itertools | |
| import argparse | |
| import web3 | |
| argtypes = ['uint256', 'uint64', 'uint32', 'uint8', 'bool', 'bytes32', 'bytes', 'string'] | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-a', '--nargs', type=int, default=1, | |
| help='number of function arguments') | |
| parser.add_argument('-f', '--dictfile', type=str, default=None, | |
| help='file name to read dictionary of words from') | |
| parser.add_argument('-w', '--minwords', type=int, default=1, | |
| help='minimum number of words in function name') | |
| parser.add_argument('-W', '--maxwords', type=int, default=None, | |
| help='maximum number of words in function name') | |
| conf = parser.parse_args() | |
| if not conf.maxwords: conf.maxwords = conf.minwords | |
| filenameshort = conf.dictfile[:8] | |
| # words' list for function name body | |
| with open(conf.dictfile) as fd: | |
| words = fd.readlines() | |
| words = [word.strip() for word in words] | |
| for nwords in range(conf.minwords, conf.maxwords+1): | |
| for argstuple in itertools.product(argtypes, repeat=conf.nargs): | |
| argstr = '(' + ','.join(argstuple) + ')' | |
| print('>>>', filenameshort, nwords, 'words, args:', argstr) | |
| for funwords in itertools.permutations(words, nwords): | |
| # human-readable function signature | |
| funsig = '_'.join(list(funwords)) + argstr | |
| # 4-byte function selector | |
| funsel = web3.Web3.toHex(web3.Web3.sha3(text=funsig)[:4]) | |
| # print close-enoughs | |
| if funsel.startswith('0x000000'): print(funsel, funsig) | |
| # print match | |
| if funsel == '0x00000000': print('>>>>>> FOUND!', funsel, funsig) |
This file contains hidden or 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
| bitcoin-.2.2.txt:bright_peace(bytes32,bytes) 0x0000006e | |
| bitcoin-.2.2.txt:suspect_radar(bytes32,string) 0x0000001f | |
| bitcoin-.2.2.txt:romance_weasel(bytes,uint256) 0x00000017 | |
| bitcoin-.2.2.txt:word_sentence(bytes,uint64) 0x0000008e | |
| bitcoin-.2.2.txt:pole_world(bytes,uint8) 0x000000e0 | |
| bitcoin-.2.2.txt:derive_trial(bytes,bytes) 0x000000f3 | |
| bitcoin-.2.2.txt:lonely_ancient(bytes,bytes) 0x000000ac | |
| bitcoin-.2.2.txt:style_galaxy(string,uint8) 0x000000eb | |
| bitcoin-.2.2.txt:treat_void(string,bytes32) 0x000000c5 | |
| bitcoin-.2.2.txt:stand_critic(string,bytes) 0x0000005b | |
| bitcoin-.2.2.txt:devote_stove(string,string) 0x0000001c | |
| bitcoin-.n.1.txt.incomp:talk_warfare(uint32) 0x000000d8 | |
| bitcoin-.n.1.txt.incomp:razor_balance(bool) 0x00000002 | |
| bitcoin-.n.1.txt.incomp:glide_above(bytes32) 0x000000df | |
| bitcoin-.n.1.txt.incomp:rain_hazard(bytes) 0x00000050 | |
| bitcoin-.n.1.txt.incomp:about_tenant_huge(uint256) 0x000000f2 | |
| bitcoin-.n.1.txt.incomp:above_change_photo(uint256) 0x0000006e | |
| bitcoin-.n.1.txt.incomp:access_coconut_alarm(uint256) 0x000000ed | |
| bitcoin-.n.1.txt.incomp:acoustic_table_tank(uint256) 0x0000007f | |
| bitcoin-.n.1.txt.incomp:acquire_collect_sudden(uint256) 0x0000007e | |
| bitcoin-.n.1.txt.incomp:across_gentle_senior(uint256) 0x0000009b | |
| bitcoin-.n.1.txt.incomp:actor_kite_cannon(uint256) 0x000000f4 | |
| bitcoin-.n.1.txt.incomp:adapt_glide_they(uint256) 0x000000e0 | |
| bitcoin-.n.1.txt.incomp:admit_garment_exact(uint256) 0x0000009d | |
| bitcoin-.n.1.txt.incomp:advance_garage_bridge(uint256) 0x000000d8 | |
| bitcoin-.n.1.txt.incomp:advance_swim_uncle(uint256) 0x0000006f | |
| bitcoin-.n.1.txt.incomp:aerobic_gift_enrich(uint256) 0x0000002c | |
| bitcoin-.n.1.txt.incomp:afraid_wool_phrase(uint256) 0x000000a2 | |
| bitcoin-.n.1.txt.incomp:agree_chronic_hole(uint256) 0x00000050 | |
| bitcoin-.n.1.txt.incomp:alcohol_clerk_couch(uint256) 0x00000052 | |
| bitcoin-.n.1.txt.incomp:alcohol_seed_road(uint256) 0x000000da | |
| bitcoin-.n.1.txt.incomp:alert_better_topic(uint256) 0x000000da | |
| bitcoin-.n.1.txt.incomp:alert_cake_busy(uint256) 0x0000007b | |
| bitcoin-.n.1.txt.incomp:allow_problem_wedding(uint256) 0x00000067 | |
| bitcoin-.n.1.txt.incomp:alone_sadness_magic(uint256) 0x00000010 | |
| bitcoin-.n.1.txt.incomp:amateur_divide_someone(uint256) 0x000000c3 | |
| bitcoin-.n.1.txt.incomp:amateur_indicate_asthma(uint256) 0x000000d | |
| funwords.n.1.txt.incomp:tree_code_error(uint64) 0x00000041 | |
| funwords.n.1.txt.incomp:library_token_limit(uint8) 0x00000077 | |
| funwords.n.1.txt.incomp:storage_bits_transact(uint8) 0x00000083 | |
| funwords.n.1.txt.incomp:encrypt_shred_function(bool) 0x000000ce | |
| funwords.n.1.txt.incomp:symbol_rewind_sign(bytes32) 0x0000009b | |
| funwords.n.1.txt.incomp:invalid_hashrate_ideal(bytes) 0x0000006f | |
| funwords.n.1.txt.incomp:account_library_split_signature(uint256) 0x00000034 | |
| funwords.n.1.txt.incomp:after_encode_password_unique(uint256) 0x000000d3 | |
| funwords.n.1.txt.incomp:allow_storage_delete_pull(uint256) 0x000000bc | |
| funwords.n.1.txt.incomp:allowance_card_attack_node(uint256) 0x00000068 | |
| funwords.n.1.txt.incomp:assert_thread_in_day(uint256) 0x0000006c | |
| funwords.n.1.txt.incomp:attack_approve_unwrap_solidity(uint256) 0x00000028 | |
| funwords.n.1.txt.incomp:available_commit_variant_deed(uint256) 0x00000052 | |
| funwords.n.1.txt.incomp:available_value_fuzzy_solidity(uint256) 0x000000f7 | |
| funwords.n.1.txt.incomp:babbage_request_duplicate_donate(uint256) 0x00000007 | |
| funwords.n.1.txt.incomp:bad_lovelace_modifier_sub(uint256) 0x00000021 | |
| funwords.n.1.txt.incomp:ban_digit_add_unavailable(uint256) 0x000000dc | |
| funwords.n.1.txt.incomp:ban_link_deny_process(uint256) 0x0000000e | |
| funwords.n.1.txt.incomp:ban_pipe_commit_route(uint256) 0x000000b2 | |
| progword.2.1.txt.incomp:decls_pin(uint8) 0x000000eb | |
| progword.2.1.txt.incomp:FileUtils_stub(uint8) 0x0000004c | |
| progword.2.1.txt.incomp:os_sum(uint8) 0x000000b0 | |
| progword.2.1.txt.incomp:optional_UIKit(bool) 0x000000b6 | |
| progword.2.1.txt.incomp:String_aux(bytes32) 0x0000002d | |
| progword.2.1.txt.incomp:XXX_unrecognized_adapter(string) 0x00000039 | |
| progword.2.1.txt.incomp:abc_program_active(uint256) 0x000000aa | |
| progword.2.1.txt.incomp:absolute_Builder_protect(uint256) 0x00000006 | |
| progword.2.1.txt.incomp:acc_graph_io(uint256) 0x000000ea | |
| progword.2.1.txt.incomp:access_User_By(uint256) 0x000000e5 | |
| progword.2.1.txt.incomp:accessor_U_OF(uint256) 0x00000095 | |
| progword.2.1.txt.incomp:account_except_end(uint256) 0x000000c1 | |
| progword.2.1.txt.incomp:action_Event_b5(uint256) 0x000000db | |
| progword.2.1.txt.incomp:action_dispatch_NOT_encode(uint256) 0x000000e8 | |
| progword.2.1.txt.incomp:action_mailer_handle_Time(uint256) 0x00000060 | |
| progword.2.1.txt.incomp:actions_getString_maxima(uint256) 0x0000008a | |
| progword.2.1.txt.incomp:active_cpu_Package(uint256) 0x0000005c | |
| progword.2.1.txt.incomp:ActiveRecord_since_bind(uint256) 0x000000ad | |
| progword.n.2.txt.incomp:settings_constant(uint256,uint256) 0x000000bf | |
| progword.n.2.txt.incomp:maxResults_Input(uint256,uint64) 0x00000034 | |
| progword.n.2.txt.incomp:represents_dir(uint256,uint8) 0x0000008a | |
| progword.n.2.txt.incomp:typep_seq(uint256,bool) 0x00000074 | |
| progword.n.2.txt.incomp:WriteHeader_menu(uint256,bool) 0x000000f2 | |
| progword.n.2.txt.incomp:update_attributes(uint64,bool) 0x00000064 | |
| progword.n.2.txt.incomp:contain_Spree(uint32,bool) 0x000000ec | |
| progword.n.2.txt.incomp:example_pre(uint8,bytes) 0x00000040 | |
| progword.n.2.txt.incomp:Column_Error(uint8,string) 0x000000dc | |
| progword.n.2.txt.incomp:ftype_headers(bool,uint256) 0x00000072 | |
| progword.n.2.txt.incomp:external_fresh(bool,bool) 0x000000af | |
| progword.n.2.txt.incomp:size_t_possible(bool,bool) 0x00000058 | |
| progword.n.2.txt.incomp:STRINGS_getValue(bytes32,uint256) 0x0000006a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment