def hide_code_with_string(obj): code = Utils.get_string_from_obj(obj) code = Utils.standar_quotes(code) obj = Utils.get_obj_from_code(code) s_var = g.variable() res = "Local " + s_var + ' = "' + obj[0] + '" & _ \n' for i in xrange(1, len(obj) - 1): res += '"' + obj[i] + '" & _ \n' res += '"' + obj[len(obj) - 1] + '"\n' res += "Local " + g.variable() + " = Execute(" + s_var + ")\n" return res
) + "] = " + str( indexes ) + "\n For $" + var_cnt_name + " = 0 To " + str( len(indexes) ) + "-1\n\t" + var_name + "[$" + var_ind_name + "[$" + var_cnt_name + "]] = $" + var_aux_name + "[$" + var_cnt_name + "]\nNext\n" + var_name + " = StringFromASCIIArray(" + var_name + ")\n" return obj def hide_strings_reverse(obj): for i in xrange(len(obj)): v = ex.extract_string(obj[i]) aux = obj[i].strip() if len(aux) > 0 and aux[0] != "#" and not "RegExp" in aux: for j in xrange(len(v)): v[j] = v[j][1:-1] if '"' not in v[j] and "'" not in v[j] and len(v[j]) > 0: obj[i] = obj[i].replace( '"' + v[j] + '"', Globals.string_reverse_function + '("' + v[j][::-1] + '") ') obj[i] = obj[i].replace("'" + v[j] + "'", Globals.string_reverse_function + '("' + v[j][::-1] + '") ') # return obj if __name__ == "__main__": obj = Utils.extract_code("test.au3") obj = hide_strings_definition(obj) Utils.write_code(Utils.get_string_from_obj(obj), "testmod.au3") #print generate_graph(obj)
try: if identifiers[i]: obj = sub(r"\$"+identifiers[i][1:]+r"\b","$"+replaces[i]+" ",obj) except: continue return obj.split(boundary) def hide_variable_names(obj): identifiers = list(ex.extract_defined_variables_from_obj(obj)) # Extraer solo las que se definen en el script # replaces = Utils.mod_names_hash(identifiers) boundary = "\n"+Utils.generate_random_string(20,30)+"\n" obj = boundary.join(obj) for i in xrange(len(identifiers)): if identifiers[i]: obj = sub(r"\$"+identifiers[i][1:]+r"\b","$"+replaces[i]+" ",obj) return obj.split(boundary) def hide_function_names(obj): identifiers = list(ex.extract_func_names_from_obj(obj)) replaces = Utils.mod_names_identifier(identifiers) obj = "\n".join(obj) for i in xrange(len(identifiers)): if identifiers[i]: obj = sub(r""+identifiers[i]+r"\s*\(",replaces[i]+"(",obj) return obj.split("\n") if __name__ == "__main__": obj = Utils.extract_code("test.au3") obj = hide_variable_names(obj) obj = hide_function_names(obj) Utils.write_code(Utils.get_string_from_obj(obj),"testmod.au3") #print generate_graph(obj)