Beispiel #1
0
 public static void DiscoverMethod(string[] args, Logger Log)
 {
     foreach (var Type in ModuleDefinition.FromFile(args[0]).GetAllTypes())
     {
         foreach (var Method in Type.Methods)
         {
             if (Method.Name == args[1] && Method.Parameters.Count == int.Parse(args[2]))
             {
                 DecMethod = Method;
                 Log.Info($"Decryption Method Found Params : {DecMethod.Resolve().Parameters.Count} :D");
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// Do Proxy Signature.
        /// </summary>
        /// <param name="IsNewobj"> Ditermine If The Processed Instruction Is CilOpCodes.NewObj. </param>
        /// <param name="Method"> Method to Call. </param>
        /// <returns> Proxy Method Sig. </returns>
        private static MethodSignature GetSignature(bool IsNewobj, IMethodDescriptor Method)
        {
            // Get Return Type.
            var _returntype = IsNewobj
                              ? Method.DeclaringType.ToTypeSignature()
                              : Method.Signature.ReturnType;
            // Assign Params Type.
            IList <TypeSignature> _params = new List <TypeSignature>();

            /// Inserting TypeSigs From <param name="Method"/> Sig.
            foreach (var _tsig in Method.Signature.ParameterTypes)
            {
                _params.Add(_tsig);
            }
            // If Method Is HasThis Insert Object Sig.
            if (Method.Signature.HasThis && !IsNewobj)
            {
                _params.Insert(0, _importer.ImportTypeSignature(Method.Resolve().Parameters.ThisParameter.ParameterType));
            }
            // Finally Return Maded Sig.
            return(MethodSignature.CreateStatic(_returntype, _params));
        }
Beispiel #3
0
        public static void DiscoverMethod(string[] args, Logger Log, bool IsMD, string MDToken)
        {
            var Temp = ModuleDefinition.FromFile(args[0]);

            if (IsMD)
            {
                DecMethod = (IMethodDescriptor)Temp.LookupMember(new MetadataToken((uint)Convert.ToInt32(MDToken, 16)));
                Log.Info($"Decryption Method Found Params : {DecMethod.Resolve().Parameters.Count} :D");
                return;
            }
            foreach (var Type in Temp.GetAllTypes())
            {
                foreach (var Method in Type.Methods)
                {
                    if (Method.Name == args[1] && Method.Parameters.Count == int.Parse(args[2]))
                    {
                        DecMethod = Method;
                        Log.Info($"Decryption Method Found Params : {DecMethod.Resolve().Parameters.Count} :D");
                    }
                }
            }
        }