public ResourceDirectory(JLibrary.PortableExecutable.PortableExecutable owner, IMAGE_RESOURCE_DIRECTORY_ENTRY entry, bool named, uint root) : base(owner, entry, named, root) { if (!owner.Read <IMAGE_RESOURCE_DIRECTORY>((long)(root + (entry.SubdirectoryRva ^ 0x80000000)), SeekOrigin.Begin, out this._base)) { throw owner.GetLastError(); } }
public ResourceFile(JLibrary.PortableExecutable.PortableExecutable owner, IMAGE_RESOURCE_DIRECTORY_ENTRY entry, bool named, uint root) : base(owner, entry, named, root) { if (!owner.Read <IMAGE_RESOURCE_DATA_ENTRY>((long)(base._root + entry.DataEntryRva), SeekOrigin.Begin, out this._base)) { throw owner.GetLastError(); } }
public virtual IntPtr Inject(JLibrary.PortableExecutable.PortableExecutable image, int processId) { this.ClearErrors(); IntPtr hProcess = WinAPI.OpenProcess(0x43a, false, processId); IntPtr ptr2 = this.Inject(image, hProcess); WinAPI.CloseHandle(hProcess); return(ptr2); }
public ResourceWalker(JLibrary.PortableExecutable.PortableExecutable image) { IMAGE_DATA_DIRECTORY image_data_directory = image.NTHeader.OptionalHeader.DataDirectory[2]; uint root = 0; if ((image_data_directory.VirtualAddress > 0) && (image_data_directory.Size > 0)) { IMAGE_RESOURCE_DIRECTORY image_resource_directory; if (!image.Read <IMAGE_RESOURCE_DIRECTORY>((long)(root = image.GetPtrFromRVA(image_data_directory.VirtualAddress)), SeekOrigin.Begin, out image_resource_directory)) { throw image.GetLastError(); } IMAGE_RESOURCE_DIRECTORY_ENTRY entry = new IMAGE_RESOURCE_DIRECTORY_ENTRY { SubdirectoryRva = 0x80000000 }; this.Root = new ResourceDirectory(image, entry, false, root); } }
public override IntPtr Inject(JLibrary.PortableExecutable.PortableExecutable dll, IntPtr hProcess) { this.ClearErrors(); string str = Utils.WriteTempData(dll.ToArray()); IntPtr zero = IntPtr.Zero; if (!string.IsNullOrEmpty(str)) { zero = this.Inject(str, hProcess); try { File.Delete(str); } catch { } } return(zero); }
public ResourceObject(JLibrary.PortableExecutable.PortableExecutable owner, IMAGE_RESOURCE_DIRECTORY_ENTRY entry, bool named, uint root) { this._owner = owner; this._entry = entry; this.IsNamedResource = named; if (named) { ushort result = 0; if (owner.Read <ushort>((long)(root + (entry.NameRva & 0x7fffffff)), SeekOrigin.Begin, out result)) { byte[] buffer = new byte[result << 1]; if (owner.Read(0L, SeekOrigin.Current, buffer)) { this._name = Encoding.Unicode.GetString(buffer); } } if (this._name == null) { throw owner.GetLastError(); } } this._root = root; }
public static void CSINJ() { while (System.Diagnostics.Process.GetProcessesByName(InjectForm.Process).Length == 0) //if csgo isnt started { InjectForm.status = "Scanning for CSGO"; InjectForm.value = 1; Thread.Sleep(500); //sleeps for .5 seconds } bool Enginedll_Found = false; //initialize engine_found with false bool Serverdll_Found = false; do { InjectForm.status = "Scanning for Engine"; Process[] CheckModules = System.Diagnostics.Process.GetProcessesByName(InjectForm.Process); foreach (ProcessModule m in CheckModules[0].Modules) { if (m.ModuleName == "engine.dll") //this is to check if engine.dll is loaded { InjectForm.value = 50; Enginedll_Found = true; } } } while (Enginedll_Found == false); //loop while not loaded do { InjectForm.status = "Scanning for Server Browser "; Process[] CheckModules = System.Diagnostics.Process.GetProcessesByName(InjectForm.Process); foreach (ProcessModule m in CheckModules[0].Modules) { if (m.ModuleName == "serverbrowser.dll") //this is to check if engine.dll is loaded { InjectForm.value = 75; Serverdll_Found = true; } } } while (Serverdll_Found == false); if (Enginedll_Found == true && Serverdll_Found == true) //if its loaded { Thread.Sleep(10000); var injectionMethod = InjectionMethod.Create(InjectionMethodType.Standard); IntPtr zero = IntPtr.Zero; using (JLibrary.PortableExecutable.PortableExecutable executable = new JLibrary.PortableExecutable.PortableExecutable(InjectForm.dll)) { InjectForm.value = 100; zero = injectionMethod.Inject(executable, Process.GetProcessesByName("csgo").FirstOrDefault().Id); } if (zero != IntPtr.Zero) { //BAIL HERE - ERROR } else if (injectionMethod.GetLastError() != null) { //ERROR OCCURED System.Windows.Forms.MessageBox.Show(injectionMethod.GetLastError().Message); } } Application.Exit(); }
public abstract IntPtr Inject(JLibrary.PortableExecutable.PortableExecutable image, IntPtr hProcess);