Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Written by DevSome - all credits to him!
- // http://forum.cp-g.de/user/50580-awesome/
- // http://www.elitepvpers.com/forum/members/1199443-devsome.html
- // Mail: [email protected]
- // Instructions: put the exe in your SRO directory!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Runtime.InteropServices;
- using System.Diagnostics;
- using System.IO;
- //using Microsoft.Win32;
- //using System.Xml.Serialization;
- namespace MulticlientProject
- {
- class Program
- {
- [DllImport("kernel32.dll")]
- static extern IntPtr LoadLibrary(string dllToLoad);
- [DllImport("kernel32.dll")]
- static extern IntPtr OpenProcess(uint dwDesiredAccess, int bInheritHandle, int dwProcessId);
- [DllImport("kernel32.dll")]
- static extern uint ReadProcessMemory(IntPtr hProcess, uint lpBaseAddress, uint lpbuffer, uint nSize, uint lpNumberOfBytesRead);
- [DllImport("kernel32.dll")]
- static extern uint WriteProcessMemory(IntPtr hProcess, uint lpBaseAddress, byte[] lpBuffer, int nSize, uint lpNumberOfBytesWritten);
- [DllImport("kernel32.dll")]
- static extern uint VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, int dwSize, uint flAllocationType, uint flProtect);
- [DllImport("kernel32.dll")]
- static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner, string lpName);
- [DllImport("kernel32.dll")]
- static extern IntPtr GetModuleHandle(string lpModuleName);
- [DllImport("kernel32")]
- static extern uint GetProcAddress(IntPtr hModule, string procName);
- [DllImport("kernel32.dll")]
- static extern uint WritePrivateProfileString(string section, string key, string val, string filePath);
- [DllImport("kernel32.dll")]
- static extern uint GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
- #region Addresses
- uint ByteArray = 0;
- uint SeedPatchAdress = 0;
- uint AlreadyProgramExe = 0;
- uint MultiClientAddress = 0;
- uint CallForwardAddress = 0;
- uint MultiClientError = 0;
- uint StartingMSG = 0;
- uint ChangeVersion = 0;
- #endregion
- #region BytePattern
- //byte[] RedirectIPAddressPattern = { 0x89, 0x86, 0x2C, 0x01, 0x00, 0x00, 0x8B, 0x17, 0x89, 0x56, 0x50, 0x8B, 0x47, 0x04, 0x89, 0x46, 0x54, 0x8B, 0x4F, 0x08, 0x89, 0x4E, 0x58, 0x8B, 0x57, 0x0C, 0x89, 0x56, 0x5C, 0x5E, 0xB8, 0x01, 0x00, 0x00, 0x00, 0x5D, 0xC3 };
- byte[] SeedPatchPattern = { 0x8B, 0x4C, 0x24, 0x04, 0x81, 0xE1, 0xFF, 0xFF, 0xFF, 0x7F };
- byte[] SeedPatch = { 0xB9, 0x33, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x90 };
- //byte[] NudePatchPattern = { 0x8B, 0x84, 0xEE, 0x1C, 0x01, 0x00, 0x00, 0x3B, 0x44, 0x24, 0x14 };
- //byte[] ZoomhackPattern = { 0xDF, 0xE0, 0xF6, 0xC4, 0x41, 0x7A, 0x08, 0xD9, 0x9E };
- byte[] MulticlientPattern = { 0x6A, 0x06, 0x8D, 0x44, 0x24, 0x48, 0x50, 0x8B, 0xCF };
- byte[] CallForwardPattern = { 0x56, 0x8B, 0xF1, 0x0F, 0xB7, 0x86, 0x3E, 0x10, 0x00, 0x00, 0x57, 0x66, 0x8B, 0x7C, 0x24, 0x10, 0x0F, 0xB7, 0xCF, 0x8D, 0x14, 0x01, 0x3B, 0x96, 0x4C, 0x10, 0x00, 0x00 };
- byte[] MultiClientErrorStringPattern = Encoding.Default.GetBytes("½ÇÅ©·Îµå°¡ ÀÌ¹Ì ½ÇÇà Áß ÀÔ´Ï´Ù.");
- byte[] ChangeVersionStringPattern = Encoding.Unicode.GetBytes("Ver %d.%03d");
- byte[] StartingMSGStringPattern = Encoding.Unicode.GetBytes("UIIT_STT_STARTING_MSG");
- byte[] AlreadyProgramExeStringPattern = Encoding.ASCII.GetBytes("//////////////////////////////////////////////////////////////////");
- #endregion
- static void Main()
- {
- Console.WriteLine("Programm got stared.");
- Program pr = new Program();
- string StartingMessageText = "Visit devsome.com\r\nOpensource on elitepverps.com published by Devsome(dot)com";
- byte[] HexColorArray = { 0xff, 0xa5, 0x00, 0x00 };
- // pink 0xee, 0x82, 0xee, 0x00
- // hell blau 0xff, 0xa5, 0x00, 0x00
- uint BaseAddress = 0x400000;
- byte PUSH = 0x68;
- byte[] JMP = { 0xEB };
- uint ByteArray = 0;
- string currentDir = Environment.CurrentDirectory;
- Console.WriteLine("Your current Directory: " + currentDir);
- byte[] FileArray = File.ReadAllBytes(currentDir + @"\sro_client.exe");
- //AlreadyProgramExeSearch
- pr.AlreadyProgramExe = pr.FindStringPattern(pr.AlreadyProgramExeStringPattern, FileArray, BaseAddress, PUSH, 1) - 2;
- //SeedPatchSearch
- pr.SeedPatchAdress = BaseAddress + pr.FindPattern(pr.SeedPatchPattern, FileArray, 1);
- //ReplaceText
- pr.StartingMSG = pr.FindStringPattern(pr.StartingMSGStringPattern, FileArray, BaseAddress, PUSH, 1) + 24;
- pr.ChangeVersion = pr.FindStringPattern(pr.ChangeVersionStringPattern, FileArray, BaseAddress, PUSH, 1);
- //MulticlientSearch
- pr.MultiClientAddress = BaseAddress + pr.FindPattern(pr.MulticlientPattern, FileArray, 1) + 9;
- //CallForwardSearch
- pr.CallForwardAddress = BaseAddress + pr.FindPattern(pr.CallForwardPattern, FileArray, 1);
- //MultiClientErrorSearch
- pr.MultiClientError = pr.FindStringPattern(pr.MultiClientErrorStringPattern, FileArray, BaseAddress, PUSH, 1) - 8;
- CreateMutex(IntPtr.Zero, false, "Silkroad Online Launcher");
- CreateMutex(IntPtr.Zero, false, "Ready");
- Console.WriteLine("Silkroad Launcher started in background.");
- Process SilkProcess;
- SilkProcess = new Process();
- SilkProcess.StartInfo.FileName = currentDir + @"\sro_client.exe";
- SilkProcess.StartInfo.Arguments = "0 /22 0 0";
- SilkProcess.Start();
- Console.WriteLine("Process started with 0 /22 0 0");
- IntPtr SroProcessHandle = OpenProcess((uint)(0x000F0000L | 0x00100000L | 0xFFF), 0, SilkProcess.Id);
- //Already Program Exe
- WriteProcessMemory(SroProcessHandle, pr.AlreadyProgramExe, JMP, JMP.Length, ByteArray);
- Console.WriteLine("Already opend (write in Memory)");
- //Multiclient Error MessageBox
- WriteProcessMemory(SroProcessHandle, pr.MultiClientError, JMP, JMP.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, pr.SeedPatchAdress, pr.SeedPatch, pr.SeedPatch.Length, ByteArray);
- Console.WriteLine("Multiclient Error MessageBox (write in Memory)");
- pr.MultiClient(SroProcessHandle);
- pr.StartingTextMSG(SroProcessHandle, StartingMessageText, HexColorArray);
- Console.WriteLine("Writing the Version & Startmessage");
- }
- private void MultiClient(IntPtr SroProcessHandle)
- {
- uint MultiClientCodeCave = VirtualAllocEx(SroProcessHandle, IntPtr.Zero, 45, 0x1000, 0x4);
- uint MACCodeCave = VirtualAllocEx(SroProcessHandle, IntPtr.Zero, 4, 0x1000, 0x4);
- uint GTC = GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTickCount");
- byte[] CallBack = BitConverter.GetBytes(MultiClientCodeCave + 41);
- byte[] CALLForward = BitConverter.GetBytes(CallForwardAddress - MultiClientCodeCave - 34);
- byte[] MACAddress = BitConverter.GetBytes(MACCodeCave);
- byte[] GTCAddress = BitConverter.GetBytes(GTC - MultiClientCodeCave - 18);
- byte[] MultiClientArray = BitConverter.GetBytes(MultiClientCodeCave - MultiClientAddress - 5);
- byte[] MultiClientCodeArray = { 0xE8, MultiClientArray[0], MultiClientArray[1], MultiClientArray[2], MultiClientArray[3] };
- byte[] MultiClientCode = { 0x8F, 0x05, CallBack[0], CallBack[1], CallBack[2], CallBack[3], //POP DWORD PTR DS:[xxxxxxxx]
- 0xA3, MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], //MOV DWORD PTR DS:[xxxxxxxx],EAX
- 0x60, //PUSHAD
- 0x9C, //PUSHFD
- 0xE8, GTCAddress[0], GTCAddress[1], GTCAddress[2], GTCAddress[3], // Call KERNEL32.gettickcount
- 0x8B, 0x0D, MACAddress[0], MACAddress[1], MACAddress[2], MACAddress[3], //MOV ECX,DWORD PTR DS:[xxxxxxxx]
- 0x89, 0x41, 0x02, // MOV DWORD PTR DS:[ECX+2],EAX
- 0x9D, //POPFD
- 0x61, //POPAD
- 0xE8, CALLForward[0], CALLForward[1], CALLForward[2], CALLForward[3], //CALL xxxxxxxx
- 0xFF, 0x35, CallBack[0], CallBack[1], CallBack[2], CallBack[3], // PUSH DWORD PTR DS:[xxxxxxxx]
- 0xC3 //RETN
- };
- WriteProcessMemory(SroProcessHandle, MultiClientCodeCave, MultiClientCode, MultiClientCode.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, MultiClientAddress, MultiClientCodeArray, MultiClientCodeArray.Length, ByteArray);
- }
- private void StartingTextMSG(IntPtr SroProcessHandle, string StartingText, byte[] HexColor)
- {
- string ChangeVersionString = "Dev";
- uint StartingMSGStringCodeCave = VirtualAllocEx(SroProcessHandle, IntPtr.Zero, StartingText.Length, 0x1000, 0x4);
- uint ChangeVersionStringCodeCave = VirtualAllocEx(SroProcessHandle, IntPtr.Zero, StartingText.Length, 0x1000, 0x4);
- byte[] StartingMSGByteArray = Encoding.Unicode.GetBytes(StartingText);
- byte[] ChangeVersionByteArray = Encoding.Unicode.GetBytes(ChangeVersionString);
- byte[] CallStartingMSG = BitConverter.GetBytes(StartingMSGStringCodeCave);
- byte[] CallChangeVersion = BitConverter.GetBytes(ChangeVersionStringCodeCave);
- byte[] StartingMSGCodeArray = { 0xB8, CallStartingMSG[0], CallStartingMSG[1], CallStartingMSG[2], CallStartingMSG[3] };
- byte[] ChangeVersionCodeArray = { 0x68, CallChangeVersion[0], CallChangeVersion[1], CallChangeVersion[2], CallChangeVersion[3] };
- WriteProcessMemory(SroProcessHandle, ChangeVersionStringCodeCave, ChangeVersionByteArray, ChangeVersionByteArray.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, ChangeVersion, ChangeVersionCodeArray, ChangeVersionCodeArray.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, ChangeVersion - 59, HexColor, HexColor.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, StartingMSGStringCodeCave, StartingMSGByteArray, StartingMSGByteArray.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, StartingMSG, StartingMSGCodeArray, StartingMSGCodeArray.Length, ByteArray);
- WriteProcessMemory(SroProcessHandle, StartingMSG + 9, HexColor, HexColor.Length, ByteArray);
- System.Environment.Exit(0);
- }
- private uint FindPattern(byte[] Pattern, byte[] FileByteArray, uint Result)
- {
- uint MyPosition = 0;
- uint ResultCounter = 0;
- for (uint PositionFileByteArray = 0; PositionFileByteArray < FileByteArray.Length - Pattern.Length; PositionFileByteArray++)
- {
- bool found = true;
- for (uint PositionPattern = 0; PositionPattern < Pattern.Length; PositionPattern++)
- {
- if (FileByteArray[PositionFileByteArray + PositionPattern] != Pattern[PositionPattern])
- {
- found = false;
- break;
- }
- }
- if (found)
- {
- ResultCounter += 1;
- if (Result == ResultCounter)
- {
- MyPosition = PositionFileByteArray;
- break;
- }
- }
- }
- return MyPosition;
- }
- private uint FindStringPattern(byte[] StringByteArray, byte[] FileArray, uint BaseAddress, byte StringWorker, uint Result)
- {
- uint MyPosition = 0;
- byte[] StringWorkerAddress = { StringWorker, 0x00, 0x00, 0x00, 0x00 };
- byte[] StringAddress = new byte[4];
- StringAddress = BitConverter.GetBytes(BaseAddress + FindPattern(StringByteArray, FileArray, 1));
- StringWorkerAddress[1] = StringAddress[0];
- StringWorkerAddress[2] = StringAddress[1];
- StringWorkerAddress[3] = StringAddress[2];
- StringWorkerAddress[4] = StringAddress[3];
- MyPosition = BaseAddress + FindPattern(StringWorkerAddress, FileArray, Result);
- return MyPosition;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment