├── ProxyCalld.rar
├── ProxyCalld.sln
├── ProxyCalld
├── InjectHelper.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── ProxyCalld.csproj
├── ProxyCalld.csproj.user
├── app.config
├── bin
│ └── Debug
│ │ ├── ProxyCalld.exe
│ │ ├── ProxyCalld.exe.config
│ │ ├── ProxyCalld.pdb
│ │ └── dnlib.dll
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── ProxyCalld.csproj.CopyComplete
│ ├── ProxyCalld.csproj.CoreCompileInputs.cache
│ ├── ProxyCalld.csproj.FileListAbsolute.txt
│ ├── ProxyCalld.csprojAssemblyReference.cache
│ ├── ProxyCalld.exe
│ └── ProxyCalld.pdb
├── ProxyTest
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
├── ProxyTest.csproj
├── bin
│ └── Debug
│ │ ├── ProxyTest.exe
│ │ ├── ProxyTest.pdb
│ │ └── ProxyTest_deobfuscated.exe
└── obj
│ └── Debug
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── ProxyTest.csproj.CoreCompileInputs.cache
│ ├── ProxyTest.csproj.FileListAbsolute.txt
│ ├── ProxyTest.csprojAssemblyReference.cache
│ ├── ProxyTest.exe
│ └── ProxyTest.pdb
└── README.md
/ProxyCalld.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XenocodeRCE/BasicProxyObfucator/5584949d70bb68231b4b2d4a8a7a2e1068f2a80e/ProxyCalld.rar
--------------------------------------------------------------------------------
/ProxyCalld.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2035
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxyCalld", "ProxyCalld\ProxyCalld.csproj", "{460E54D6-4EB5-4323-AA58-132E69AD3A02}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxyTest", "ProxyTest\ProxyTest.csproj", "{90C2B6A4-D203-405B-B140-0645B39EAF7B}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {460E54D6-4EB5-4323-AA58-132E69AD3A02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {460E54D6-4EB5-4323-AA58-132E69AD3A02}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {460E54D6-4EB5-4323-AA58-132E69AD3A02}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {460E54D6-4EB5-4323-AA58-132E69AD3A02}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {90C2B6A4-D203-405B-B140-0645B39EAF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {90C2B6A4-D203-405B-B140-0645B39EAF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {90C2B6A4-D203-405B-B140-0645B39EAF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {90C2B6A4-D203-405B-B140-0645B39EAF7B}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {C62A0735-4703-42F6-9146-810089EEEDB3}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/ProxyCalld/InjectHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using dnlib.DotNet;
5 | using dnlib.DotNet.Emit;
6 |
7 | namespace ProxyCalld
8 | {
9 | ///
10 | /// Provides methods to inject a into another module.
11 | ///
12 | public static class InjectHelper
13 | {
14 | ///
15 | /// Clones the specified origin TypeDef.
16 | ///
17 | /// The origin TypeDef.
18 | /// The cloned TypeDef.
19 | static TypeDefUser Clone(TypeDef origin)
20 | {
21 | var ret = new TypeDefUser(origin.Namespace, origin.Name);
22 | ret.Attributes = origin.Attributes;
23 |
24 | if (origin.ClassLayout != null)
25 | ret.ClassLayout = new ClassLayoutUser(origin.ClassLayout.PackingSize, origin.ClassSize);
26 |
27 | foreach (GenericParam genericParam in origin.GenericParameters)
28 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
29 |
30 | return ret;
31 | }
32 |
33 | ///
34 | /// Clones the specified origin MethodDef.
35 | ///
36 | /// The origin MethodDef.
37 | /// The cloned MethodDef.
38 | public static MethodDefUser Clone(MethodDef origin)
39 | {
40 | var ret = new MethodDefUser(origin.Name, null, origin.ImplAttributes, origin.Attributes);
41 |
42 | foreach (GenericParam genericParam in origin.GenericParameters)
43 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
44 |
45 | return ret;
46 | }
47 |
48 | ///
49 | /// Clones the specified origin FieldDef.
50 | ///
51 | /// The origin FieldDef.
52 | /// The cloned FieldDef.
53 | static FieldDefUser Clone(FieldDef origin)
54 | {
55 | var ret = new FieldDefUser(origin.Name, null, origin.Attributes);
56 | return ret;
57 | }
58 |
59 | ///
60 | /// Populates the context mappings.
61 | ///
62 | /// The origin TypeDef.
63 | /// The injection context.
64 | /// The new TypeDef.
65 | static TypeDef PopulateContext(TypeDef typeDef, InjectContext ctx)
66 | {
67 | TypeDef ret;
68 | IDnlibDef existing;
69 | if (!ctx.Map.TryGetValue(typeDef, out existing))
70 | {
71 | ret = Clone(typeDef);
72 | ctx.Map[typeDef] = ret;
73 | }
74 | else
75 | ret = (TypeDef)existing;
76 |
77 | foreach (TypeDef nestedType in typeDef.NestedTypes)
78 | ret.NestedTypes.Add(PopulateContext(nestedType, ctx));
79 |
80 | foreach (MethodDef method in typeDef.Methods)
81 | ret.Methods.Add((MethodDef)(ctx.Map[method] = Clone(method)));
82 |
83 | foreach (FieldDef field in typeDef.Fields)
84 | ret.Fields.Add((FieldDef)(ctx.Map[field] = Clone(field)));
85 |
86 | return ret;
87 | }
88 |
89 | ///
90 | /// Copies the information from the origin type to injected type.
91 | ///
92 | /// The origin TypeDef.
93 | /// The injection context.
94 | static void CopyTypeDef(TypeDef typeDef, InjectContext ctx)
95 | {
96 | var newTypeDef = (TypeDef)ctx.Map[typeDef];
97 |
98 | newTypeDef.BaseType = (ITypeDefOrRef)ctx.Importer.Import(typeDef.BaseType);
99 |
100 | foreach (InterfaceImpl iface in typeDef.Interfaces)
101 | newTypeDef.Interfaces.Add(new InterfaceImplUser((ITypeDefOrRef)ctx.Importer.Import(iface.Interface)));
102 | }
103 |
104 | ///
105 | /// Copies the information from the origin method to injected method.
106 | ///
107 | /// The origin MethodDef.
108 | /// The injection context.
109 | static void CopyMethodDef(MethodDef methodDef, InjectContext ctx)
110 | {
111 | var newMethodDef = (MethodDef)ctx.Map[methodDef];
112 |
113 | newMethodDef.Signature = ctx.Importer.Import(methodDef.Signature);
114 | newMethodDef.Parameters.UpdateParameterTypes();
115 |
116 | if (methodDef.ImplMap != null)
117 | newMethodDef.ImplMap = new ImplMapUser(new ModuleRefUser(ctx.TargetModule, methodDef.ImplMap.Module.Name), methodDef.ImplMap.Name, methodDef.ImplMap.Attributes);
118 |
119 | foreach (CustomAttribute ca in methodDef.CustomAttributes)
120 | newMethodDef.CustomAttributes.Add(new CustomAttribute((ICustomAttributeType)ctx.Importer.Import(ca.Constructor)));
121 |
122 | if (methodDef.HasBody)
123 | {
124 | newMethodDef.Body = new CilBody(methodDef.Body.InitLocals, new List(), new List(), new List());
125 | newMethodDef.Body.MaxStack = methodDef.Body.MaxStack;
126 |
127 | var bodyMap = new Dictionary