Source Code Nim Bindings for the GuidedHacking DLL Injector

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Meow

Gimme food hooman.
Fleep Tier Donator
Nobleman
Apr 24, 2020
145
3,743
4
How long you been coding/hacking?
3 years, few months
I thought since @Broihon actually exported the functions it would be pretty cool to use them in another languages beside cpp aswell. So credits to him.
Source Code on Github. I probably didn't wrapped everything correctly yet, but basic injection works pretty fine.

Theres also some `easyinject` file which allows to inject fastly without defining a whole struct etc.
Once I got some time I'll write some sexy cli injector with it.

I didn't included the binaries instead I've wrote a small compile time warning:
Code:
static:
  if not fileExists(ghInjLib):
    {.warning: "Missing " & ghInjLib & "! Download the latest release at GuidedHacking.com".}
Code:
#[
  Wrapper for the GuidedHacking.com DLL Injector Library
  Credits to Broihon for the cpp library.
  https://guidedhacking.com/resources/guided-hacking-dll-injector.4/
]#

when defined(cpu64):
  const ghInjLib* = "GH Injector - x64.dll"
  {.passL: "-static-libgcc -static-libstdc++".}
else:
  const ghInjLib* = "GH Injector - x86.dll"

const
  MAX_PATH* = 260

const
  # Injection Flags
  INJ_ERASE_HEADER* = 0x00000001
  INJ_FAKE_HEADER* = 0x00000002
  INJ_UNLINK_FROM_PEB* = 0x00000004
  INJ_SHIFT_MODULE* = 0x00000008
  INJ_CLEAN_DATA_DIR* = 0x00000010
  INJ_THREAD_CREATE_CLOAKED* = 0x00000020
  INJ_SCRAMBLE_DLL_NAME* = 0x00000040
  INJ_LOAD_DLL_COPY* = 0x00000080
  INJ_HIJACK_HANDLE* = 0x00000100
  INJ_MAX_FLAGS* = 0x000001FF

type
  INJECTION_MODE* = enum
    IM_LoadLibrary, IM_LdrLoadDll, IM_ManualMap

  LAUNCH_METHOD* = enum
    LM_NtCreateThreadEx,
    LM_HijackThread,
    LM_SetWindowsHookEx,
    LM_QueueUserAPC,
    LM_SetWindowLong

  INJECTIONDATAA* {.bycopy.} = object
    LastErrorCode*: cint                     ## used to store the error code of the injection
    szDllPath*: array[MAX_PATH * 2, char]    ## fullpath to the dll to inject
    ProcessID*: cint                         ## process identifier of the target process
    Mode*: INJECTION_MODE                    ## injection mode
    Method*: LAUNCH_METHOD                   ## method to execute the remote shellcode
    Flags*: cint                             ## combination of the flags defined above
    hHandleValue*: cint                      ## optional value to identify a handle in a process
    hDllOut*: cint                           ## returned image base of the injection

  INJECTIONDATAW* {.bycopy.} = object
    LastErrorCode*: int32
    szDllPath*: array[MAX_PATH * 2, char]
    szTargetProcessExeFileName*: ptr cstring ## exe name of the target process, this value gets set automatically and should be ignored
    ProcessID*: cint
    Mode*: INJECTION_MODE
    Method*: LAUNCH_METHOD
    Flags*: cint
    hHandleValue*: int32
    hDllOut*: cint

proc InjectA*(pData: ptr INJECTIONDATAA): cint {.stdcall, importc, discardable, dynlib: ghInjLib.}
proc InjectW*(pData: ptr INJECTIONDATAW): cint {.stdcall, importc, discardable, dynlib: ghInjLib.}
 
  • Like
Reactions: Rake and Petko123

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,746
40,528
316
Nice, glad to see someone doing something actually useful with it.
You probably can't wait for the next update where you have to update all the structs :EleGiggle:
 
  • Haha
Reactions: Meow

Meow

Gimme food hooman.
Fleep Tier Donator
Nobleman
Apr 24, 2020
145
3,743
4
Theres c2nim which actually does the most part ;D

btw. I would like to see a processName field in the struct, so I don't need to do that on my end ;D Also wide char arrays are hard to wrap.
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,746
40,528
316
I won't add a process name field since process names aren't unique. It's up to the user to identify the correct process.
 
  • Like
Reactions: Meow
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods