def main(): if len(sys.argv) != 2: return print sys.argv[1] input_path = sys.argv[1] dirlist = os.listdir(sys.argv[1]) rel_file_obj = open('relevant_files.db', 'r') rel_files = [] for line in rel_file_obj.readlines(): line = line.strip() rel_files.append(line) print 'Relevant files:', len(rel_files) #print '\n'.join(rel_files) for filename in dirlist: if os.path.isdir(filename): continue abs_file = os.path.join(input_path, filename) if abs_file in rel_files: cmd = "python get_field_type.py '" + abs_file + "'" print run_command(cmd, None)
def main(): if len(sys.argv) != 2: return print sys.argv[1] input_path = sys.argv[1] dirlist = os.listdir(sys.argv[1]) rel_file_obj = open('relevant_files.db', 'r') rel_files = [] for line in rel_file_obj.readlines(): line = line.strip() rel_files.append(line) print 'Relevant files:' , len(rel_files) #print '\n'.join(rel_files) for filename in dirlist: if os.path.isdir(filename): continue abs_file = os.path.join(input_path, filename) if abs_file in rel_files: cmd = "python get_field_type.py '" + abs_file + "'" print run_command(cmd, None)
def decompile(self): files = os.listdir(self.inpath) for apkfile in files: absfile = os.path.join(os.path.abspath(self.inpath), apkfile) if absfile.endswith('.apk'): print run_command((self.decompile_command + absfile + ' -o ' + self.outfile), os.getcwd())
def __run_weka__(self, output_location, file_identifier): #arff_output_file = os.path.join(os.path.dirname(__file__), ('arff_output' + self.ARFF_FILE_POSTFIX)) os.chdir(os.path.dirname(__file__)) #print 'CWD: ', os.getcwd() # file_path = output_location+'/'+file_identifier arff_output_file = output_location + '/' + file_identifier + '_arff_output' + self.ARFF_FILE_POSTFIX print "Reference loc " + arff_output_file #arff_output_file = 'arff_output' + self.ARFF_FILE_POSTFIX cmd_str = self.CMD_PREFIX + ' ' \ + os.path.join(os.getcwd(), self.WEKA) + ' ' \ + self.CLASSIFIER + ' ' \ + '-T ' + arff_output_file + ' ' \ + ' -l ' + self.MODEL_FILE \ + ' -p 0' return run_command(cmd_str, os.getcwd())
def __run_weka__(self,output_location, file_identifier): #arff_output_file = os.path.join(os.path.dirname(__file__), ('arff_output' + self.ARFF_FILE_POSTFIX)) os.chdir(os.path.dirname(__file__)) #print 'CWD: ', os.getcwd() # file_path = output_location+'/'+file_identifier arff_output_file = output_location+'/'+file_identifier+'_arff_output' + self.ARFF_FILE_POSTFIX print "Reference loc "+ arff_output_file #arff_output_file = 'arff_output' + self.ARFF_FILE_POSTFIX cmd_str = self.CMD_PREFIX + ' ' \ + os.path.join(os.getcwd(), self.WEKA) + ' ' \ + self.CLASSIFIER + ' ' \ + '-T ' + arff_output_file + ' ' \ + ' -l ' + self.MODEL_FILE \ + ' -p 0' return run_command(cmd_str, os.getcwd())
from cli_utils import run_command if len(sys.argv) != 3: print 'usage: move_relevant_files.py <source_path> <destination_path>' exit() src_dir = sys.argv[1] dst_dir = sys.argv[2] if not os.path.exists('relevant_files.db'): print 'Relevant files db does not exist!' exit() relevant_file_obj = open('relevant_files.db', 'r') relevant_files = [] for line in relevant_file_obj.readlines(): line = line.strip() if line not in relevant_files: relevant_files.append(line) for entry in relevant_files: file_name = entry file_dir = entry[:-4] file_copy_command = 'cp ' + os.path.join(src_dir, file_name) + ' ' + dst_dir dir_copy_command = 'cp -r ' + os.path.join(src_dir, file_dir) + ' ' + dst_dir run_command(file_copy_command, None) run_command(dir_copy_command, None)