Компьютерный форум OSzone.net  

Компьютерный форум OSzone.net (http://forum.oszone.net/index.php)
-   AutoIt (http://forum.oszone.net/forumdisplay.php?f=103)
-   -   Внедрение dll в запушенный процесс (http://forum.oszone.net/showthread.php?t=133959)

.:TimoXa:. 06-03-2009 11:17 1056335

Внедрение dll в запушенный процесс
 
Вопрос заключается в том как получить информацию с внедренной дллки. Облазил весь форум автоита но так и не нашел ответ на свой вопрос ((
Информация:
Внедрение ДДЛ произвожу по методу проекта ModuleSpy

Функции самой ДЛЛ(по данным IDA ):
-экспорт - cp 0040828C 1
- SetHK 0040869C 2
- HookProc 0040867C 3
- DllEntryPoint 00408FB0
-импорт Стандатные функции kernel32.dll и user32.dll
может кто подскажет что нужно сделать...
Код:

Func _InjectModule()
        Local $err = 0, $hModule = 0
        Local $procidx = _GUICtrlListView_GetSelectedIndices($hLV1)
        If $procidx == "" Then
                $err = 1
        Else
                Local $dllpath = FileOpenDialog("Inject Module into " & $g_aProcs[Number($procidx)][1] & "...", @ScriptDir, "Modules (*.dll)", 3, "", $gui)
                If @error Then
                        $err = 2
                Else
                        If StringRight($dllpath, 4) <> ".dll" Then
                                $err = 3
                        Else                       
                                Local $hProcess = _GetProcHandle($g_aProcs[Number($procidx)][0])
                                If Not $hProcess Then
                                        $err = 4
                                Else
                                        ; allocate memory in remote process for dll path
                                        Local $pMem = _MemVirtualAllocEx($hProcess, 0, 260, $MEM_COMMIT, $PAGE_READWRITE)
                                        If Not $pMem Then
                                                $err = 5
                                        Else
                                                ; write dll path to remote process
                                                Local $ret = DllCall("kernel32.dll", "int", "WriteProcessMemory", "ptr", $hProcess, "ptr", $pMem, "str", $dllpath, "uint", 260, "uint*", 0)
                                                If $ret[5] <> 260 Then
                                                        $err = 6
                                                Else
                                                        ; get LoadLibraryA address and call the remote thread with a pointer to the dll path
                                                        Local $kernelidx = _ArraySearch($g_aMods, "kernel32.dll", 0, 0, 0, 0, 1, 1)
                                                        If $kernelidx == -1 Then
                                                                $err = 7
                                                        Else
                                                                Local $LoadLibraryA = $g_aMods[$kernelidx][0] + $g_LoadLibraryA ; add offset to base address
                                                                Global $ret
                                                                $ret = DllCall("kernel32.dll", "ptr", "CreateRemoteThread", "ptr", $hProcess, "ptr", 0, "uint", 0, "ptr", $LoadLibraryA, "ptr", $pMem, "dword", 0, "ptr", 0)
                                                                $put = DllCall($ret[5], 'int', 'ФУНКЦИЯ', 'str', ???ЕЩЕ ЧТО-ТО???)
                                                                If Not $ret[0] Then
                                                                        $err = 8 ; create remote thread failed
                                                                Else
                                                                        Local $hThread = $ret[0]
                                                                        _WinAPI_WaitForSingleObject($hThread) ; wait for thread to finish
                                                                        ; get thread return value, which is the HMODULE (base address) of the injected dll
                                                                        $ret = DllCall("kernel32.dll", "int", "GetExitCodeThread", "ptr", $hThread, "dword*", 0)
                                                                        $hModule = Ptr($ret[2])
                                                                        _ArrayDisplay( $ret, "est")
                                                                        _WinAPI_CloseHandle($hThread) ; close thread handle
                                                                EndIf
                                                        EndIf
                                                EndIf
                                                _MemVirtualFreeEx($hProcess, $pMem, 260, $MEM_DECOMMIT) ; release memory for dll path
                                        EndIf
                                        _WinAPI_CloseHandle($hProcess)
                                EndIf
                        EndIf
                EndIf
        EndIf
       
        _RefreshMods()
        _ArrayDisplay( $hThread, "est")
        Local $blabla = DLLCall($LoadLibraryA,"int", "cp","hwnd",$hProcess, "ptr", 0, "uint", 0)
        MsgBox(0,"ggs", $blabla)
        Return SetError($err, 0, $hModule)
EndFunc

Синим выделил место куда я пытаюсь вставить вывод значения...но не чего не выходит...значение $put всегда 0 (((

Creat0R 06-03-2009 15:41 1056557

.:TimoXa:.,
Почему название темы на английском? Это вроде русскоязычный форум.

.:TimoXa:. 07-03-2009 00:27 1056951

Испарвил...хотел для большей понятности...видимо вышло на оборот...


Время: 00:19.

Время: 00:19.
© OSzone.net 2001-