def estimate(args): input_model_file_name = args.input_model_file_name input_exe_file_name = args.input_feature_file_name extraction_method = args.extraction_method label_type = args.label_type # generate an .asm file from the executable file generator = IDAAsmGenerator() generator.generate(input_exe_file_name) # append the information of the input file to the database datproc = DataProcessor() datproc.update_database_from_file() # extract feature vector ams_file_name = os.path.join(os.path.splittext(input_file_name)[0], '.asm') datproc.extract_data_from_file(asm_file_name, extraction_method, label_type) # load classification model estimator = CompilerEstimator() estimator.load_model(input_model_file_name) # estimate result = estimator.estimate(feature_vector) print result
def updatedb(args): file_name = args.file_name dir_name = args.dir_name datproc = DataProcessor() if file_name is not None and dir_name is not None: sys.stderr.write('Error: please assign only one file name or directory name') elif file_name is not None: datproc.update_database_from_file(file_name) elif dir_name is not None: datproc.update_database_from_dir(dir_name) else: sys.stderr.write('Error: no file name or directory name specified')