private void InvokeFunctionCallMethods(FunctionCallType functionCallType) { foreach (var item in _functionCalls.Where(x => x.FunctionCallConfig.GetFunctionCallType() == functionCallType)) { InvokeFunctionCall(item); } }
public FunctionCallAttribute(FunctionCallType fct) { if (fct == FunctionCallType.CallOnInterval || fct == FunctionCallType.CallOnTime) { throw new Exception("you have to specify a value (timeMs or dateTime)"); } _fct = fct; }
public void RegisterFunction(string name, FunctionCallType type, int address, int argumentsCount) { var registrationData = new object[] { name, address, type, argumentsCount }; this[c_register, false, Encoding.UTF8](new object[] { registrationData }, 1); }
public FunctionCall(FunctionCallType type, CallSiteParameter[] arguments) { Type = type; Arguments = arguments; }
private static int GetTokenForMethodDecode(ProxyType PT, int iIndex, AntiProxyParams Params, out FunctionCallType CT) { FieldInfo fieldFromHandle = PT.arFieldReflection[iIndex]; Assembly executingAssembly = Params.asmReflection; char[] array = new char[fieldFromHandle.Name.Length]; for (int i = 0; i < array.Length; i++) { array[i] = (char)((int)((byte)fieldFromHandle.Name[i]) ^ i); } byte[] array2 = Convert.FromBase64String(new string(array)); CT = (array2[0] == 13) ? FunctionCallType.Callvirt : FunctionCallType.Call; return(BitConverter.ToInt32(array2, 1) ^ Params.XORTokenMethod); }
private static bool DoAntiProxy(ProxyType PT, AntiProxyParams Params) { FunctionCallType CT = FunctionCallType.Call; for (int iIndex = 0; iIndex < PT.arMethods.Length; iIndex++) { if (PT.arProxyTypeDelegate[iIndex] == ProxyTypeDelegate.NewObjectCall) { Int32 TokenOfOriginalCall = GetTokenForFieldDecode(PT, iIndex, Params); MethodReference MR = AsmDef.MainModule.Import(Params.asmReflection.GetModules()[0].ResolveMethod(TokenOfOriginalCall)); Instruction[] arIns = GetInstructionsWithMethodCall(PT.arMethods[iIndex]).ToArray(); for (int i = 0; i < arIns.Length; i++) { arIns[i].OpCode = OpCodes.Newobj; arIns[i].Operand = MR; } } if (PT.arProxyTypeDelegate[iIndex] == ProxyTypeDelegate.DirectMethodCall) { Int32 TokenOfOriginalCall = GetTokenForMethodDecode(PT, iIndex, Params, out CT); ProxyType PT2 = null; MethodReference MR = AsmDef.MainModule.Import(Params.asmReflection.GetModules()[0].ResolveMethod(TokenOfOriginalCall)); ProxyType[] NestedPT = Params.lstProxyTypes.Where(m => m.Type.Name == MR.DeclaringType.Name).ToArray(); if (NestedPT.Length != 0) { PT2 = NestedPT[0]; } /*foreach (var PTNew in AP17.lstProxyTypes) * { * if (MR.DeclaringType.Name == PTNew.Type.Name) * { * PT2 = new ProxyType(PTNew.Type, AP17); * } * }*/ // PT2 = Second stage proxy -> proxy followed by a proxy by a method/newobj if (PT2 != null) { Instruction[] arIns = GetInstructionsWithMethodCall(PT.arMethods[iIndex]); if (PT2.arProxyTypeDelegate[0] == ProxyTypeDelegate.NewObjectCall) { Int32 TokenOfOriginalCall2 = GetTokenForFieldDecode(PT2, 0, Params); MethodReference MR2 = AsmDef.MainModule.Import(Params.asmReflection.GetModules()[0].ResolveMethod(TokenOfOriginalCall2)); for (int i = 0; i < arIns.Length; i++) { arIns[i].OpCode = OpCodes.Newobj; arIns[i].Operand = MR2; } } } else { Instruction[] arIns = GetInstructionsWithMethodCall(PT.arMethods[iIndex]); for (int i = 0; i < arIns.Length; i++) { if (CT == FunctionCallType.Call) { arIns[i].OpCode = OpCodes.Call; arIns[i].Operand = MR; } if (CT == FunctionCallType.Callvirt) { arIns[i].OpCode = OpCodes.Callvirt; arIns[i].Operand = MR; } } } } } return(true); }
protected FunctionCall(FunctionCallType type, CallSiteParameter[] arguments) { Type = type; Arguments = arguments; }
private static int GetTokenForMethodDecode(ProxyType PT, int iIndex, AntiProxyParams Params, out FunctionCallType CT) { FieldInfo fieldFromHandle = PT.arFieldReflection[iIndex]; Assembly executingAssembly = Params.asmReflection; char[] array = new char[fieldFromHandle.Name.Length]; for (int i = 0; i < array.Length; i++) { array[i] = (char)((int)((byte)fieldFromHandle.Name[i]) ^ i); } byte[] array2 = Convert.FromBase64String(new string(array)); CT = (array2[0] == 13) ? FunctionCallType.Callvirt : FunctionCallType.Call; return BitConverter.ToInt32(array2, 1) ^ Params.XORTokenMethod; }
public FunctionCallAttribute(FunctionCallType fct, DateTime dateTime) { _fct = fct; DateTime = dateTime; }
public FunctionCallAttribute(FunctionCallType fct, double timeMs) { _fct = fct; TimeMs = timeMs; }