Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void ObfuscateCode(string file)
- {
- AssemblyDefinition ASM = AssemblyDefinition.ReadAssembly(file);
- ModuleDefinition MainModule = ASM.MainModule;
- foreach (TypeDefinition T in MainModule.Types)
- {
- T.Name = RandomKey(30);
- foreach (PropertyDefinition P in T.Properties)
- {
- P.Name = RandomKey(30);
- }
- foreach (FieldDefinition F in T.Fields)
- {
- F.Name = RandomKey(30);
- }
- if (T.Namespace.Contains(".My") == false)
- {
- foreach (MethodDefinition M in T.Methods)
- {
- if (M.IsConstructor == false)
- {
- if (M.IsPInvokeImpl == false)
- {
- M.Name = RandomKey(30);
- }
- }
- foreach (ParameterDefinition Param in M.Parameters)
- {
- Param.Name = RandomKey(30);
- }
- }
- }
- }
- ASM.Write("C:\\Output.exe");
- }
Advertisement
Add Comment
Please, Sign In to add comment