diff --git a/patcher-source/godtier-patcher.sln b/patcher-source/godtier-patcher.sln new file mode 100644 index 0000000..1552727 --- /dev/null +++ b/patcher-source/godtier-patcher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30204.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "godtier-patcher", "goldtier-patcher\godtier-patcher.csproj", "{539DF0B0-5AC8-4701-965B-8B515B09A928}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {539DF0B0-5AC8-4701-965B-8B515B09A928}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {539DF0B0-5AC8-4701-965B-8B515B09A928}.Debug|Any CPU.Build.0 = Debug|Any CPU + {539DF0B0-5AC8-4701-965B-8B515B09A928}.Release|Any CPU.ActiveCfg = Release|Any CPU + {539DF0B0-5AC8-4701-965B-8B515B09A928}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0C2DDFF7-AD4D-4149-8CCA-0C624265A206} + EndGlobalSection +EndGlobal diff --git a/patcher-source/goldtier-patcher/App.config b/patcher-source/goldtier-patcher/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/patcher-source/goldtier-patcher/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/patcher-source/goldtier-patcher/Log.cs b/patcher-source/goldtier-patcher/Log.cs new file mode 100644 index 0000000..a028246 --- /dev/null +++ b/patcher-source/goldtier-patcher/Log.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +public static class Log +{ + public static void Info(object value) + { + Color(ConsoleColor.Cyan); + Console.WriteLine("[+] " + value.ToString()); + Color(); + } + + public static void Critical(object value) + { + Color(ConsoleColor.Magenta); + Console.WriteLine("[!] " + value.ToString()); + } + + public static void Error(object value) + { + Color(ConsoleColor.Red); + Console.WriteLine("[-] " + value.ToString()); + Color(); + } + + private static void Color(ConsoleColor color = ConsoleColor.White) + { + Console.ForegroundColor = color; + } +} diff --git a/patcher-source/goldtier-patcher/Patcherino.cs b/patcher-source/goldtier-patcher/Patcherino.cs new file mode 100644 index 0000000..ae10ec1 --- /dev/null +++ b/patcher-source/goldtier-patcher/Patcherino.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Management; +using System.Runtime.InteropServices; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace godtier_patcher +{ + public class Patcherino + { + public const long FunctionRVA = 0x4A49; + public readonly byte[] Shellcode = { 0x90, 0x90, 0x90, 0x90, 0x90 }; + + public Process Process; + public IntPtr ProcessHandle; + + [DllImport("kernel32.dll")] + private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, uint lpNumberOfBytesWritten); + + public Patcherino(Process proc) + { + Process = proc; + this.ProcessHandle = proc.Handle; + if (this.ProcessHandle == IntPtr.Zero) + throw new Exception("OpenProcess failed"); + } + + public bool WriteByteArray(long addr, byte[] buffer) + { + return WriteProcessMemory(ProcessHandle, (IntPtr)addr, buffer, (uint)buffer.Length, 0); + } + + public async Task Patch() + { + Log.Info("Module Base Address -> 0x" + Process.MainModule.BaseAddress.ToString("X8")); + var functionAddress = (long)Process.MainModule.BaseAddress + FunctionRVA; + Log.Info("Instruction Address (RVA 0x4A49) -> 0x" + functionAddress.ToString("X8") + "\n"); + Log.Critical("Patching..."); + + var success = WriteByteArray(functionAddress, Shellcode); + + if (success) + { + Log.Critical("Function patched successfully! Thanks for using! Press enter to close this!"); + } + else + { + Log.Error("Could not patch function."); + } + + return success; + } + } +} diff --git a/patcher-source/goldtier-patcher/Program.cs b/patcher-source/goldtier-patcher/Program.cs new file mode 100644 index 0000000..c5da536 --- /dev/null +++ b/patcher-source/goldtier-patcher/Program.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace godtier_patcher +{ + class Program + { + [STAThread] + static void Main(string[] args) + { + Log.Info("godtier-patcher by VollRahm"); + Log.Info("Please select godtier.exe...\n"); + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "Executables (*.exe) |"; + ofd.InitialDirectory = Directory.GetCurrentDirectory(); + ofd.Title = "Please select godtier.exe..."; + var result = ofd.ShowDialog(); + if(result == DialogResult.OK) + { + Log.Info("Loading exe..."); + Thread.Sleep(1000); + try + { + ProcessStartInfo psi = new ProcessStartInfo(Path.GetFullPath(ofd.FileName)) + { + UseShellExecute = true, + }; + var process = Process.Start(psi); + Log.Critical("Process started, PID -> " + process.Id); + Log.Info("Attaching to process..."); + Patcherino patcherino = new Patcherino(process); + Log.Info("Patching...\n"); + patcherino.Patch().GetAwaiter().GetResult(); + }catch(Exception ex) + { + Log.Error("Something wen't wrong: " + ex.Message); + } + } + else + { + Log.Error("Please select godtier.exe"); + } + Console.ReadLine(); + } + } +} diff --git a/patcher-source/goldtier-patcher/Properties/AssemblyInfo.cs b/patcher-source/goldtier-patcher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..83e25d7 --- /dev/null +++ b/patcher-source/goldtier-patcher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("godtier-patcher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("godtier-patcher")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("539df0b0-5ac8-4701-965b-8b515b09a928")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/patcher-source/goldtier-patcher/app.manifest b/patcher-source/goldtier-patcher/app.manifest new file mode 100644 index 0000000..d72e750 --- /dev/null +++ b/patcher-source/goldtier-patcher/app.manifest @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/patcher-source/goldtier-patcher/godtier-patcher.csproj b/patcher-source/goldtier-patcher/godtier-patcher.csproj new file mode 100644 index 0000000..76dcdc0 --- /dev/null +++ b/patcher-source/goldtier-patcher/godtier-patcher.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {539DF0B0-5AC8-4701-965B-8B515B09A928} + Exe + godtier_patcher + godtier-patcher + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x64 + none + true + bin\Release\ + TRACE + prompt + 4 + false + + + app.manifest + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file