private static void LoadSignatures()
 {
     for (int i = 0; i < Signatures.Count; i++)
     {
         if (Signatures[i].Tag == null)
         {
             Signatures[i].Tag = ByteScan.CompileSig(Signatures[i].Trigger);
         }
         else if (Signatures[i].Tag.GetType().Name != "Sig")
         {
             string       contents = ((JToken)Signatures[i].Tag).ToString();
             ByteScan.Sig sg       = JsonConvert.DeserializeObject <ByteScan.Sig>(contents);
             Signatures[i].Tag = sg;
         }
     }
 }
Exemple #2
0
        static void Main()
        {
            Console.WriteLine("Attempting to patch The Impossible Game.");

            Process p = Process.GetProcessesByName("ImpossibleGame").FirstOrDefault();

            if (p == null)
            {
                throw new Exception("Impossible Game not running");
            }

            int result = AntiAntiCheat.StartAntiDebuggingPatchThread(p.Id);

            if (result != 0)
            {
                Console.WriteLine($"Antidebugging patch failed to apply with error {Marshal.GetLastWin32Error()}");
            }

            Console.WriteLine("Antidebugging patch applied!");

            IntPtr handle = NativeMethods.Processthreadsapi.OpenProcess(NativeMethods.Winnt.ProcessAccessFlags.PROCESS_ALL_ACCESS, false, p.Id);

            if (handle == IntPtr.Zero)
            {
                throw new Exception("Invalid Handle");
            }

            ByteScan.FindInBaseModule(p, expectedOverwriteBytes, out IntPtr[] offsets);
            if (offsets.Length == 0)
            {
                throw new Exception("No matching pattern found");
            }

            IntPtr callRetAddr = p.MainModule.BaseAddress + (int)offsets[0];


            Console.WriteLine("Found death function bytes!");

            if (!NativeMethods.Memoryapi.WriteProcessMemory(handle, callRetAddr, nopSlideArray, nopSlideArray.Length, out IntPtr _))
            {
                throw new Exception($"Failed to WriteProcessMemory at address {callRetAddr}. Last Error: {Marshal.GetLastWin32Error()}");
            }

            Console.WriteLine("Patched death function!\nPress any key to continue");
            Console.ReadKey();
        }
Exemple #3
0
 public static long IndexOf(this byte[] file, string sig)
 {
     return(ByteScan.GetIndexOfSig(file, sig));
 }