<s> import os <EOL> import argparse <EOL> import sys <EOL> def get_strings ( filename ) : <EOL> """<STR_LIT>""" <EOL> list_strings = [ ] <EOL> with open ( filename , '<STR_LIT>' ) as f : <EOL> list_strings = [ line [ : - <NUM_LIT:1> ] for line in f . readlines ( ) ] <EOL> return list_strings <EOL> def get_exe_to_reverse ( ) : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT:file>' , nargs = <NUM_LIT:1> , help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> return args . file [ <NUM_LIT:0> ] <EOL> def string_compare ( exe_to_reverse , file_string_map ) : <EOL> """<STR_LIT>""" <EOL> l1 = file_string_map [ exe_to_reverse ] . split ( '<STR_LIT>' ) <EOL> match_result = { } <EOL> for key , value in file_string_map . iteritems ( ) : <EOL> l2 = [ ] <EOL> if key != exe_to_reverse : <EOL> l2 = value . split ( '<STR_LIT>' ) <EOL> l3 = [ i for i in l1 for j in l2 if i == j ] <EOL> match_result [ key ] = l3 <EOL> else : <EOL> continue <EOL> return match_result <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> """<STR_LIT>""" <EOL> exe_to_reverse = get_exe_to_reverse ( ) <EOL> output_dir = '<STR_LIT>' <EOL> file_string_map = { } <EOL> for filename in os . listdir ( output_dir ) : <EOL> list_strings = [ ] <EOL> list_strings = get_strings ( output_dir + '<STR_LIT:/>' + filename ) <EOL> file_string_map [ filename [ : - <NUM_LIT:4> ] ] = '<STR_LIT>' . join ( list_strings ) <EOL> match_result = string_compare ( exe_to_reverse , file_string_map ) <EOL> for key , value in match_result . iteritems ( ) : <EOL> t1 = [ ] <EOL> t1 = [ v for v in value if v != '<STR_LIT>' ] <EOL> print t1 <EOL> print "<STR_LIT>" , key , "<STR_LIT>" , len ( t1 ) , "<STR_LIT>" </s>
