def load_pypylib(): from rpython.translator.cli.rte import get_pypy_dll dll = get_pypy_dll() try: import clr from System.Reflection import Assembly except ImportError: pass else: ass = Assembly.LoadFrom(dll) assert ass is not None clr.AddReference(pypylib) load_assembly(pypylib)
def load_asm_file(asm_file): return Assembly.LoadFrom(asm_file)
for method in type.Methods: if not method.HasBody: pass i = 0 operText = "" while i < len(method.Body.Instructions): operText = str(method.Body.Instructions[i].Operand).encode() if(method.Body.Instructions[i].OpCode == OpCodes.Call and operText.find(str(stringMethodName).encode()) != -1): keyValue = method.Body.Instructions[i - 1].GetLdcI4Value() result = str(invokeMethod.Invoke(None, [keyValue])) method.Body.Instructions[i - 1].OpCode = OpCodes.Nop method.Body.Instructions[i].OpCode = OpCodes.Ldstr method.Body.Instructions[i].Operand = result decryptedStrings += 1 i += 1 print("Decrypted {} string".format(decryptedStrings)) if __name__ == "__main__": clr.AddReference(r"DNLIB PATH") import dnlib from dnlib.DotNet.Emit import OpCodes global module global assembly module = dnlib.DotNet.ModuleDefMD.Load("WindowsFormsApp3.exe") assembly = Assembly.LoadFrom("WindowsFormsApp3.exe") DecryptStrings() Save()