<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: список модулей процесса]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=11739&amp;type=atom" />
	<updated>2016-06-26T13:37:47Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=11739</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105567#p105567" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>Нужно, чтобы все три компонента — скрипт, процесс и DLL — были 32-битными. У вас так?</p></blockquote></div><p>если у вас работает значит что-то у меня. Видимо что-то с длл. Во общем огромное спасибо)</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-26T13:37:47Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105567#p105567</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105536#p105536" />
			<content type="html"><![CDATA[<p>Нужно, чтобы все три компонента — скрипт, процесс и DLL — были 32-битными. У вас так?</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-25T03:00:27Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105536#p105536</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105529#p105529" />
			<content type="html"><![CDATA[<p>Спасибо большое!<br />Почему-то функция не работает. <br />Положил скрипт и модуль в одну папку<br />Писал так<br /></p><div class="codebox"><pre><code>PsInjectDll(&quot;test.exe&quot;, &quot;test.dll&quot;)</code></pre></div><p>и так<br /></p><div class="codebox"><pre><code>PsInjectDll(test.exe, &quot;test.dll&quot;)</code></pre></div><p>и не инжектит.<br />Так же перемещал на диск D и прописывал полный путь вот так:<br /></p><div class="codebox"><pre><code>PsInjectDll(&quot;test.exe&quot;, &quot;D:\test.dll&quot;)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-24T20:31:07Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105529#p105529</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105512#p105512" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Dworkin пишет:</cite><blockquote><p>Могли бы вы пожалуйста глянуть и сказать возможно ли оттуда вытащить или сделать на подобии что бы так же показывало все модули?</p></blockquote></div><p>Возможно, дело в этом:<br /></p><div class="quotebox"><blockquote><p>Process Hacker uses a kernel-mode driver, KProcessHacker, to assist with certain functionality.</p></blockquote></div><p>На АНК драйвера писать точно не вариант. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-24T03:16:21Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105512#p105512</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105485#p105485" />
			<content type="html"><![CDATA[<p>Логично, что продвинутый видит, на то он и продвинутый.</p><p>Попробовал перевести. На 32 битах работает, а на 64 целевой процесс вылетает с исключением. Видимо, это связано с тем, что адреса загрузки системных библиотек на 64 битах рандомизируются. Соответственно, адрес функции LoadLibrary, полученный в адресном пространстве скрипта, в целевом процессе указывает на какой-то случайный код, выполнение которого удалённым потоком и вызывает исключение.<br /></p><div class="codebox"><pre><code>
PsInjectDll(Process, DllName)   ; Process — PID или Name.exe.
{
    static AccessRights = 0x43A     ; PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION
    ; | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION
    Process, Exist, %Process%
    If !(PID := ErrorLevel) {
        MsgBox, Процесс не найден: %Process%
        Return 0
    }
    If !FileExist(DllName) {
        MsgBox, DLL не найдена: %DllName%
        Return 0
    }
    hKernel32 := DllCall(&quot;GetModuleHandleW&quot;, &quot;wstr&quot;, &quot;Kernel32.dll&quot;, &quot;ptr&quot;)
    pLoadLibrary := DllCall(&quot;GetProcAddress&quot;, &quot;ptr&quot;, hKernel32, &quot;astr&quot;, &quot;LoadLibraryW&quot;, &quot;ptr&quot;)
    If !(hProcess := DllCall(&quot;OpenProcess&quot;, &quot;uint&quot;, AccessRights, &quot;int&quot;, 0, &quot;uint&quot;, PID, &quot;ptr&quot;)) {
        MsgBox, Ошибка OpenProcess: %A_LastError%
        Return 0
    }
    RetVal := 0
    cbDllName := (StrLen(DllName) + 1) * 2
    If !(pDllName := DllCall(&quot;VirtualAllocEx&quot;, &quot;ptr&quot;, hProcess
                                             , &quot;ptr&quot;, 0
                                             , &quot;ptr&quot;, cbDllName
                                             , &quot;uint&quot;, 0x3000   ; MEM_RESERVE | MEM_COMMIT
                                             , &quot;uint&quot;, 4        ; PAGE_READWRITE
                                             , &quot;ptr&quot;)) {
        MsgBox, Ошибка VirtualAllocEx: %A_LastError%
        Goto, Close
    }
    If !DllCall(&quot;WriteProcessMemory&quot;, &quot;ptr&quot;, hProcess
                                    , &quot;ptr&quot;, pDllName
                                    , &quot;wstr&quot;, DllName
                                    , &quot;ptr&quot;, cbDllName
                                    , &quot;ptr *&quot;, cbWritten) {
        MsgBox, Ошибка WriteProcessMemory: %A_LastError%
        Goto, Free
    }
    If !(hThread := DllCall(&quot;CreateRemoteThread&quot;, &quot;ptr&quot;, hProcess
                                                , &quot;ptr&quot;, 0
                                                , &quot;ptr&quot;, 0
                                                , &quot;ptr&quot;, pLoadLibrary
                                                , &quot;ptr&quot;, pDllName
                                                , &quot;uint&quot;, 0
                                                , &quot;ptr&quot;, 0
                                                , &quot;ptr&quot;)) {
        MsgBox, Ошибка CreateRemoteThread: %A_LastError%
        Goto, Free
    }
    DllCall(&quot;CloseHandle&quot;, &quot;ptr&quot;, hThread)
    RetVal := 1
    Goto, Close
Free:
    DllCall(&quot;VirtualFreeEx&quot;, &quot;ptr&quot;, hProcess, &quot;ptr&quot;, pDllName, &quot;ptr&quot;, 0, &quot;uint&quot;, 0x8000)
    ; 0x8000 = MEM_RELEASE
Close:
    DllCall(&quot;CloseHandle&quot;, &quot;ptr&quot;, hProcess)
    Return RetVal
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-23T17:06:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105485#p105485</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105481#p105481" />
			<content type="html"><![CDATA[<p>Если не сложно переведите функцию пожалуйста.<br />Просто странно что продвинутый диспетчер задач все видит.<br />Кстати есть программа процесс хакер она тоже может видеть модули и прочее. Она открыта.<br />Вот ее исходный код:<br /><a href="https://github.com/processhacker2/processhacker2">https://github.com/processhacker2/processhacker2</a><br />Могли бы вы пожалуйста глянуть и сказать возможно ли оттуда вытащить или сделать на подобии что бы так же показывало все модули?</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-23T12:47:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105481#p105481</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105480#p105480" />
			<content type="html"><![CDATA[<p>Перевести код на АНК? Можно, конечно. Да, если упорно не видится только одна DLL, то причина в ней должна быть. По логике. Может, есть способ как-то замаскировать присутствие DLL в процессе, и она при загрузке это делает. А может, в чём другом дело.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-23T11:42:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105480#p105480</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105462#p105462" />
			<content type="html"><![CDATA[<p>Помню у меня был рабочий инжектор на autoit. Вот нашел его. В конце функция инжекта:<br /></p><div class="codebox"><pre><code>#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n

#RequireAdmin
#include &lt;GUIConstants.au3&gt;

GUICreate(&quot;Beispiel&quot;, 275, 100)
GUISetBkColor(0xFFFFFF)
GUICtrlCreateLabel(&quot;Prozess:&quot;, 10, 10, 50, 17)
$I_ProcessName = GUICtrlCreateInput(&quot;&quot;, 65, 10, 200, 21)
GUICtrlCreateLabel(&quot;DLL:&quot;, 10, 40, 50, 17)
$I_DllPath = GUICtrlCreateInput(&quot;&quot;, 65, 40, 150, 21)
$B_SearchDll = GUICtrlCreateButton(&quot;...&quot;, 225, 40, 40, 25)
$R_Auto = GUICtrlCreateRadio(&quot;Automatisch&quot;, 10, 75, 75, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$R_Man = GUICtrlCreateRadio(&quot;Manuell&quot;, 130, 75, 55, 17)
$B_Inject = GUICtrlCreateButton(&quot;Injizieren&quot;, 190, 70, 75, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState()

$Injected = False

Do
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $B_SearchDll
            GUICtrlSetData($I_DllPath, FileOpenDialog(&quot;Dll&quot;, @HomeDrive, &quot;Dynamic Link Library (*.dll)&quot;, 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 &gt; 0 Then
            _InjectDll($ProcessId, GUICtrlRead($I_DllPath))
            _Message(@error)
            $Injected = True
            ;Exit
        EndIf
    EndIf

    Sleep(10)
Until $Msg == $GUI_EVENT_CLOSE



Func _Message($ErrorCode)
    If $ErrorCode &lt;&gt; 0 Then
        MsgBox(48, &quot;Fehler&quot;, &quot;Es ist ein Fehler aufgetreten!&quot; &amp; @CRLF &amp; &quot;Fehlercode: &quot; &amp; @error)
    Else
        MsgBox(64, &quot;Info&quot;, &quot;Injektion erfolgreich!&quot;)
    EndIf
EndFunc


;=================================================================================================
; Function:            _InjectDll($ProcessId, $DllPath)
; Description:        Injects a .dll into a running program.
; Return Value(s):    On Success - Returns true
;                    On Failure - Returns false
;                    @Error - 0 = No error.
;                             1 = Invalid ProcessId.
;                             2 = File does not exist.
;                             3 = File is not a .dll (invalid file).
;                             4 = Failed to open &#039;Advapi32.dll&#039;.
;                             5 = Failed to get the full path.
;                             6 = Failed to open the process.
;                             7 = Failed to call &#039;GetModuleHandle&#039;.
;                             8 = Failed to call &#039;GetProcAddress&#039;.
;                             9 = Failed to call &#039;VirtualAllocEx&#039;.
;                             10 = Failed to write the memory.
;                             11 = Failed to create the &#039;RemoteThread&#039;.
; Author(s):        KillerDeluxe
;=================================================================================================

Func _InjectDll($ProcessId, $DllPath)
    If $ProcessId == 0 Then Return SetError(1, &quot;&quot;, False)
    If Not(FileExists($DllPath)) Then Return SetError(2, &quot;&quot;, False)
    If Not(StringRight($DllPath, 4) == &quot;.dll&quot;) Then Return SetError(3, &quot;&quot;, False)

    $Kernel32 = DllOpen(&quot;kernel32.dll&quot;)
    If @error Then Return SetError(4, &quot;&quot;, False)

    $DLL_Path = DllStructCreate(&quot;char[255]&quot;)
    DllCall($Kernel32, &quot;DWORD&quot;, &quot;GetFullPathNameA&quot;, &quot;str&quot;, $DllPath, &quot;DWORD&quot;, 255, &quot;ptr&quot;, DllStructGetPtr($DLL_Path), &quot;int&quot;, 0)
    If @error Then Return SetError(5, &quot;&quot;, False)

    $hProcess = DllCall($Kernel32, &quot;DWORD&quot;, &quot;OpenProcess&quot;, &quot;DWORD&quot;, 0x1F0FFF, &quot;int&quot;, 0, &quot;DWORD&quot;, $ProcessId)
    If @error Then Return SetError(6, &quot;&quot;, False)

    $hModule = DllCall($Kernel32, &quot;DWORD&quot;, &quot;GetModuleHandleA&quot;, &quot;str&quot;, &quot;kernel32.dll&quot;)
    If @error Then Return SetError(7, &quot;&quot;, False)

    $lpStartAddress = DllCall($Kernel32, &quot;DWORD&quot;, &quot;GetProcAddress&quot;, &quot;DWORD&quot;, $hModule[0], &quot;str&quot;, &quot;LoadLibraryA&quot;)
    If @error Then Return SetError(8, &quot;&quot;, False)

    $lpParameter = DllCall($Kernel32, &quot;DWORD&quot;, &quot;VirtualAllocEx&quot;, &quot;int&quot;, $hProcess[0], &quot;int&quot;, 0, &quot;ULONG_PTR&quot;, DllStructGetSize($DLL_Path), &quot;DWORD&quot;, 0x3000, &quot;int&quot;, 4)
    If @error Then Return SetError(9, &quot;&quot;, False)

    DllCall(&quot;kernel32.dll&quot;, &quot;BOOL&quot;, &quot;WriteProcessMemory&quot;, &quot;int&quot;, $hProcess[0], &quot;DWORD&quot;, $lpParameter[0], &quot;str&quot;, DllStructGetData($DLL_Path, 1), &quot;ULONG_PTR&quot;, DllStructGetSize($DLL_Path), &quot;int&quot;, 0)
    If @error Then Return SetError(10, &quot;&quot;, False)

    $hThread = DllCall($Kernel32, &quot;int&quot;, &quot;CreateRemoteThread&quot;, &quot;DWORD&quot;, $hProcess[0], &quot;int&quot;, 0, &quot;int&quot;, 0, &quot;DWORD&quot;, $lpStartAddress[0], &quot;DWORD&quot;, $lpParameter[0], &quot;int&quot;, 0, &quot;int&quot;, 0)
    If @error Then Return SetError(11, &quot;&quot;, False)

    DllCall($Kernel32, &quot;BOOL&quot;, &quot;CloseHandle&quot;, &quot;DWORD&quot;, $hProcess[0])
    DllClose($Kernel32)

    Return SetError(0, &quot;&quot;, True)
EndFunc</code></pre></div><p>Проверил и тот же самый результат. Видит два модуля из трех. По моему в этом случаю тут зависит от самого модуля.<br />Кстати возможно ли создать подобное для AHK?</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-22T16:40:06Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105462#p105462</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105455#p105455" />
			<content type="html"><![CDATA[<p>Поскольку использованный вами метод инжектирования мне неизвестен, то и воспроизвести его у себя я не могу, а без этого никаких идей у меня нет.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-22T13:16:21Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105455#p105455</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105454#p105454" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>А как смотрели? Если список модулей большой и вы его смотрите в MsgBox, то конец списка может ею отрезаться. Попробуйте его помещать в буфер обмена и потом вставлять в текстовый редактор.</p></blockquote></div><p>я сразу в текстовый редактор помещал.</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-22T12:12:15Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105454#p105454</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105443#p105443" />
			<content type="html"><![CDATA[<p>А как смотрели? Если список модулей большой и вы его смотрите в MsgBox, то конец списка может ею отрезаться. Попробуйте его помещать в буфер обмена и потом вставлять в текстовый редактор.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-22T02:59:14Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105443#p105443</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105440#p105440" />
			<content type="html"><![CDATA[<p>Взял 3 разных длл(например назовем их &quot;а&quot;, &quot;б&quot; и &quot;в&quot;). Инжектил 3-мя инжекторами. Два инжектора взяты из интернета, третий использовал в 4иt инжiн. И каждый раз видело только два модуля(например &quot;а&quot; и &quot;б&quot;), а 3тий модуль не видело(модуль &quot;в&quot;).<br />Продвинутый диспетчер задач &quot;Process explorer&quot; все модули видел.</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-21T23:31:16Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105440#p105440</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105424#p105424" />
			<content type="html"><![CDATA[<p>Не знаю, это надо смотреть. А как вы её инжектите?</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2016-06-21T15:44:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105424#p105424</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105423#p105423" />
			<content type="html"><![CDATA[<p>Скажите пожалуйста почему если я инжектю длл скрипт не&nbsp; видит этот модуль в процессе? Притом если я использую продвинутый диспетчер задач то он видит этот модуль.</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-21T15:37:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105423#p105423</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: список модулей процесса]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=105387#p105387" />
			<content type="html"><![CDATA[<p>Спасибо огромное за два метода!</p>]]></content>
			<author>
				<name><![CDATA[Dworkin]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27052</uri>
			</author>
			<updated>2016-06-19T19:51:26Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=105387#p105387</id>
		</entry>
</feed>
