MCPcopy Create free account
hub / github.com/eSentire/iocs / ProcessMainMethod

Method ProcessMainMethod

Pure Crypter/PureCrypterPunisher/Program.cs:134–207  ·  view source on GitHub ↗
(IList<dnlib.DotNet.Emit.Instruction> instrs, int index)

Source from the content-addressed store, hash-verified

132
133
134 private static bool ProcessMainMethod(IList<dnlib.DotNet.Emit.Instruction> instrs, int index)
135 {
136 try
137 {
138 if (
139 instrs[index + 0].OpCode == dnlib.DotNet.Emit.OpCodes.Call &&
140 instrs[index + 0].Operand is IMethod method0 &&
141
142 instrs[index + 1].OpCode == dnlib.DotNet.Emit.OpCodes.Call &&
143 instrs[index + 1].Operand is IMethod method1 &&
144 method1.MethodSig.Params.Count == 1 &&
145 method1.MethodSig.Params[0].FullName == "System.Byte[]" &&
146 method1.MethodSig.RetType.FullName == "System.Byte[]" &&
147
148 instrs[index + 2].OpCode == dnlib.DotNet.Emit.OpCodes.Stloc_S &&
149 instrs[index + 3].OpCode == dnlib.DotNet.Emit.OpCodes.Ldloc_S &&
150
151 instrs[index + 4].OpCode == dnlib.DotNet.Emit.OpCodes.Call &&
152 instrs[index + 4].Operand is IMethod method2 &&
153 method2.MethodSig.Params.Count == 1 &&
154 method2.MethodSig.Params[0].FullName == "System.Byte[]" &&
155 method2.MethodSig.RetType.FullName == "System.Byte[]" &&
156
157 instrs[index + 5].OpCode == dnlib.DotNet.Emit.OpCodes.Newobj &&
158 instrs[index + 5].Operand is IMethod ctor &&
159 ctor.DeclaringType.FullName == "System.IO.MemoryStream" &&
160 ctor.MethodSig.Params.Count == 1 &&
161 ctor.MethodSig.Params[0].FullName == "System.Byte[]" &&
162
163 instrs[index + 6].OpCode == dnlib.DotNet.Emit.OpCodes.Stloc_S &&
164 instrs[index + 7].OpCode == dnlib.DotNet.Emit.OpCodes.Ldloc_S &&
165
166 instrs[index + 8].OpCode == dnlib.DotNet.Emit.OpCodes.Ldc_I8 &&
167 instrs[index + 8].Operand is long l && l == 0L &&
168
169 instrs[index + 9].OpCode == dnlib.DotNet.Emit.OpCodes.Callvirt &&
170 instrs[index + 9].Operand is IMethod method3 &&
171 method3.FullName.Contains("System.IO.Stream::set_Position") &&
172
173 instrs[index + 10].OpCode == dnlib.DotNet.Emit.OpCodes.Ldloc_S &&
174
175 instrs[index + 11].OpCode == dnlib.DotNet.Emit.OpCodes.Call &&
176 instrs[index + 11].Operand is MethodSpec methodSpec &&
177 methodSpec.Method is IMethod method4 &&
178 method4.Name == "Deserialize" &&
179 method4.DeclaringType.FullName == "ProtoBuf.Serializer"
180 )
181 {
182 // Set the name/type of the method used to get the resource
183 getResourceMethodType = method0.DeclaringType.FullName;
184 getResourceMethodName = method0.Name;
185
186 // Set the name/type of the method used to decrypt the resource
187 decryptResourceMethodType = method1.DeclaringType.FullName;
188 decryptResourceMethodName = method1.Name;
189
190 // Set the protobufs deserialization type
191 var genericSig = methodSpec.GenericInstMethodSig;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected