Jump to content
io.kent

Dll injector autoit source

Recommended Posts

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#RequireAdmin
Global Const $gui_event_close = -3
Global Const $gui_event_minimize = -4
Global Const $gui_event_restore = -5
Global Const $gui_event_maximize = -6
Global Const $gui_event_primarydown = -7
Global Const $gui_event_primaryup = -8
Global Const $gui_event_secondarydown = -9
Global Const $gui_event_secondaryup = -10
Global Const $gui_event_mousemove = -11
Global Const $gui_event_resized = -12
Global Const $gui_event_dropped = -13
Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
Global Const $gui_avistop = 0
Global Const $gui_avistart = 1
Global Const $gui_aviclose = 2
Global Const $gui_checked = 1
Global Const $gui_indeterminate = 2
Global Const $gui_unchecked = 4
Global Const $gui_dropaccepted = 8
Global Const $gui_nodropaccepted = 4096
Global Const $gui_acceptfiles = $gui_dropaccepted
Global Const $gui_show = 16
Global Const $gui_hide = 32
Global Const $gui_enable = 64
Global Const $gui_disable = 128
Global Const $gui_focus = 256
Global Const $gui_nofocus = 8192
Global Const $gui_defbutton = 512
Global Const $gui_expand = 1024
Global Const $gui_ontop = 2048
Global Const $gui_fontitalic = 2
Global Const $gui_fontunder = 4
Global Const $gui_fontstrike = 8
Global Const $gui_dockauto = 1
Global Const $gui_dockleft = 2
Global Const $gui_dockright = 4
Global Const $gui_dockhcenter = 8
Global Const $gui_docktop = 32
Global Const $gui_dockbottom = 64
Global Const $gui_dockvcenter = 128
Global Const $gui_dockwidth = 256
Global Const $gui_dockheight = 512
Global Const $gui_docksize = 768
Global Const $gui_dockmenubar = 544
Global Const $gui_dockstatebar = 576
Global Const $gui_dockall = 802
Global Const $gui_dockborders = 102
Global Const $gui_gr_close = 1
Global Const $gui_gr_line = 2
Global Const $gui_gr_bezier = 4
Global Const $gui_gr_move = 6
Global Const $gui_gr_color = 8
Global Const $gui_gr_rect = 10
Global Const $gui_gr_ellipse = 12
Global Const $gui_gr_pie = 14
Global Const $gui_gr_dot = 16
Global Const $gui_gr_pixel = 18
Global Const $gui_gr_hint = 20
Global Const $gui_gr_refresh = 22
Global Const $gui_gr_pensize = 24
Global Const $gui_gr_nobkcolor = -2
Global Const $gui_bkcolor_default = -1
Global Const $gui_bkcolor_transparent = -2
Global Const $gui_bkcolor_lv_alternate = -33554432
Global Const $gui_ws_ex_parentdrag = 1048576

If FileExists("hack.ini") Then
Else
MsgBox(16, "Dll Injector", "hack.ini Bulunamadi Lütfen Dizine Ekleyiniz", 5)
Exit
EndIf
$InjectEdilecekExeTitle = IniRead("hack.ini", "dll", "Procces", "default")
$dllyeri = IniRead("hack.ini", "halo", "Dll", "default")
GUICreate("Dll Injector", 275, 100)
GUISetBkColor(16777215)
GUICtrlCreateLabel("KO.exe:", 10, 10, 50, 17)
$i_processname = GUICtrlCreateInput($InjectEdilecekExeTitle, 65, 10, 200, 21)
GUICtrlCreateLabel("DLL:", 10, 40, 50, 17)
$i_dllpath = GUICtrlCreateInput($dllyeri, 65, 40, 150, 21)
$b_searchdll = GUICtrlCreateButton("...", 225, 40, 40, 25)
$r_auto = GUICtrlCreateRadio("Otomatik", 10, 75, 75, 17)
GUICtrlSetState(-1, $gui_checked)
$r_man = GUICtrlCreateRadio("Elle", 130, 75, 55, 17)
$b_inject = GUICtrlCreateButton("Injectle", 190, 70, 75, 25)
GUICtrlSetState(-1, $gui_disable)
GUISetState()
$injected = False
Do
$msg = GUIGetMsg()
Switch $msg
Case $b_searchdll
GUICtrlSetData($i_dllpath, FileOpenDialog("Dll", @HomeDrive, "Dynamic Link Library (*.dll)", 3))
Case $r_auto
GUICtrlSetState($b_inject, $gui_disable)
Case $r_man
GUICtrlSetState($b_inject, $gui_enable)
Case $b_inject
_injectdll(ProcessExists(GUICtrlRead($i_processname)), GUICtrlRead($i_dllpath))
_message(@error)
EndSwitch
If BitAND(GUICtrlRead($r_auto), $gui_checked) AND NOT $injected Then
$processid = ProcessExists(GUICtrlRead($i_processname))
If $processid > 0 Then
_injectdll($processid, GUICtrlRead($i_dllpath))
_message(@error)
$injected = True
EndIf
EndIf
Sleep(10)
Until $msg == $gui_event_close

Func _message($errorcode)
If $errorcode <> 0 Then
MsgBox(16, "Dll Injector", "Fatal Error" & @CRLF & "Hata Kodu: " & @error)
Else
MsgBox(64, "TEST", "Inject Succesfull", 3)
If WinWaitActive("Knight OnLine Client", "") Then
Sleep(100)
WinSetState("Direnish.net", "", @SW_HIDE)
EndIf
Exit
EndIf
EndFunc

Func _injectdll($processid, $dllpath)
If $processid == 0 Then Return SetError(1, "", False)
If NOT (FileExists($dllpath)) Then Return SetError(2, "", False)
If NOT (StringRight($dllpath, 4) == ".dll") Then Return SetError(3, "", False)
$kernel32 = DllOpen("kernel32.dll")
If @error Then Return SetError(4, "", False)
$dll_path = DllStructCreate("char[255]")
DllCall($kernel32, "DWORD", "GetFullPathNameA", "str", $dllpath, "DWORD", 255, "ptr", DllStructGetPtr($dll_path), "int", 0)
If @error Then Return SetError(5, "", False)
$hprocess = DllCall($kernel32, "DWORD", "OpenProcess", "DWORD", 2035711, "int", 0, "DWORD", $processid)
If @error Then Return SetError(6, "", False)
$hmodule = DllCall($kernel32, "DWORD", "GetModuleHandleA", "str", "kernel32.dll")
If @error Then Return SetError(7, "", False)
$lpstartaddress = DllCall($kernel32, "DWORD", "GetProcAddress", "DWORD", $hmodule[0], "str", "LoadLibraryA")
If @error Then Return SetError(8, "", False)
$lpparameter = DllCall($kernel32, "DWORD", "VirtualAllocEx", "int", $hprocess[0], "int", 0, "ULONG_PTR", DllStructGetSize($dll_path), "DWORD", 12288, "int", 4)
If @error Then Return SetError(9, "", False)
DllCall("kernel32.dll", "BOOL", "WriteProcessMemory", "int", $hprocess[0], "DWORD", $lpparameter[0], "str", DllStructGetData($dll_path, 1), "ULONG_PTR", DllStructGetSize($dll_path), "int", 0)
If @error Then Return SetError(10, "", False)
$hthread = DllCall($kernel32, "int", "CreateRemoteThread", "DWORD", $hprocess[0], "int", 0, "int", 0, "DWORD", $lpstartaddress[0], "DWORD", $lpparameter[0], "int", 0, "int", 0)
If @error Then Return SetError(11, "", False)
DllCall($kernel32, "BOOL", "CloseHandle", "DWORD", $hprocess[0])
DllClose($kernel32)
Return SetError(0, "", True)
EndFunc

Exit

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...