Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Skrypt] Metin2Hack 3w1 by Phoenix_PL


Rekomendowane odpowiedzi

Opublikowano

Proszę bardzo, macie tutaj kod mojego hacka/bota:

 

 

$inipath = @ScriptDir&"/opt.ini"
$a = @ScriptDir&"/log.txt"
$b = @CRLF&@MDAY&"-"&@MON&"-"&@YEAR&" "&@HOUR&":"&@MIN&":"&@SEC&" ("&@MSEC&") ==> "
$error = "0"
$s1 = "0"
$s2 = "0"
$s3 = "0"
$s4 = "0"
$s5 = "0"
$s6 = "0"
Func end()
FileWrite ($a, $b&"Zamykanie programu...")
FileClose ($a)
Exit
EndFunc
Func pause()
$x = MouseGetPos (0)
$y = MouseGetPos (1)
ToolTip ("Hack zatrzymany... Kliknij ponownie F12 zeby go wznowić", $x, $y)
FileWrite ($a, $b&"Program został zatrzymany")
While 1
 Sleep (100)
 HotKeySet ("{F12}", "petla")
WEnd
EndFunc
If FileExists ($a) Then
FileOpen ($a)
FileWrite ($a, @CRLF&$b&"Inicjalizacja programu...")
Else
FileOpen ($a)
FileWrite ($a, @MDAY&"-"&@MON&"-"&@YEAR&" "&@HOUR&":"&@MIN&":"&@SEC&" ("&@MSEC&") ==> Inicjalizacja programu...")
EndIf

If FileExists ($inipath) Then
FileWrite ($a, $b&"Pobieranie ustawień z pliku ""opt.ini""")
$hp_key = IniRead ($inipath, "keys", "hp_potion_key", "error")
$magic_key = IniRead ($inipath, "keys", "magic_potion_key", "error")
$autopot_hp = IniRead ($inipath, "options", "autopotion_hp", "error")
$autopot_magic = IniRead ($inipath, "options", "autopotion_magic", "error")
$autopickup = IniRead ($inipath, "options", "autopickup", "error")
$autoskill = IniRead ($inipath, "options", "autoskill", "error")
$skill1 = IniRead ($inipath, "keys", "skill1", "error")
$skill2 = IniRead ($inipath, "keys", "skill2", "error")
$skill3 = IniRead ($inipath, "keys", "skill3", "error")
$skill4 = IniRead ($inipath, "keys", "skill4", "error")
$skill5 = IniRead ($inipath, "keys", "skill5", "error")
$skill6 = IniRead ($inipath, "keys", "skill6", "error")
Else
FileWrite ($a, $b&"[***BŁĄD***] Nie mozna znaleźć pliku ustawień!")
MsgBox (16, "Błąd!", "Nie mozna znaleźć pliku ustawień! Umiesć prawidłowy plik ustawień w folderze z botem, i uruchom go ponownie!")
end()
EndIf
FileWrite ($a, $b&"[*****SPRAWDZANIE USTAWIEŃ*****]")
If $autopickup = "1" or $autopickup = "0" Then
FileWrite ($a, $b&"[options]autopickup - """&$autopickup&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [options]autopickup - """&$autopickup&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $autopot_hp = "1" or $autopot_hp = "0" Then
FileWrite ($a, $b&"[options]autopot_hp - """&$autopot_hp&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [options]autopotion_hp - """&$autopot_hp&""" - [bŁAD - Nieprawidłowa wartosć]")
EndIf
If $autopot_magic = "1" or $autopot_magic = "0" Then
FileWrite ($a, $b&"[options]autopot_magic - """&$autopot_magic&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [options]autopot_magic - """&$autopot_magic&""" - [bŁAD - Nieprawidłowa wartosć]")
EndIf
If $hp_key = "1" or $hp_key = "2" or $hp_key = "3" or $hp_key = "4" or $hp_key = "F1" or $hp_key = "F2" or $hp_key = "F3" or $hp_key = "F4" Then
FileWrite ($a, $b&"[keys]hp_key - """&$hp_key&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]hp_key - """&$hp_key&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $magic_key = "1" or $magic_key = "2" or $magic_key = "3" or $magic_key = "4" or $magic_key = "F1" or $magic_key = "F2" or $magic_key = "F3" or $magic_key = "F4" Then
FileWrite ($a, $b&"[keys]magic_key - """&$magic_key&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]magic_key - """&$magic_key&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill1 = "1" or $skill1 = "2" or $skill1 = "3" or $skill1 = "4" or $skill1 = "F1" or $skill1 = "F2" or $skill1 = "F3" or $skill1 = "F4" Or $skill1 = "0" Then
FileWrite ($a, $b&"[keys]skill1 - """&$skill1&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill1 - """&$skill1&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill2 = "1" or $skill2 = "2" or $skill2 = "3" or $skill2 = "4" or $skill2 = "F1" or $skill2 = "F2" or $skill2 = "F3" or $skill2 = "F4" Or $skill2 = "0" Then
FileWrite ($a, $b&"[keys]skill2 - """&$skill2&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill2 - """&$skill2&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill3 = "1" or $skill3 = "2" or $skill3 = "3" or $skill3 = "4" or $skill3 = "F1" or $skill3 = "F2" or $skill3 = "F3" or $skill3 = "F4" Or $skill3 = "0" Then
FileWrite ($a, $b&"[keys]skill3 - """&$skill3&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill3 - """&$skill3&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill4 = "1" or $skill4 = "2" or $skill4 = "3" or $skill4 = "4" or $skill4 = "F1" or $skill4 = "F2" or $skill4 = "F3" or $skill4 = "F4" Or $skill4 = "0" Then
FileWrite ($a, $b&"[keys]skill4 - """&$skill4&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill4 - """&$skill4&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill5 = "1" or $skill5 = "2" or $skill5 = "3" or $skill5 = "4" or $skill5 = "F1" or $skill5 = "F2" or $skill5 = "F3" or $skill5 = "F4" Or $skill5 = "0" Then
FileWrite ($a, $b&"[keys]skill5 - """&$skill5&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill5 - """&$skill5&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $skill6 = "1" or $skill6 = "2" or $skill6 = "3" or $skill6 = "4" or $skill6 = "F1" or $skill6 = "F2" or $skill6 = "F3" or $skill6 = "F4" Or $skill6 = "0" Then
FileWrite ($a, $b&"[keys]skill6 - """&$skill6&""" - [OK]")
Else
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]skill6 - """&$skill6&""" - [bŁĄD - Nieprawidłowa wartosć]")
EndIf
If $hp_key = $magic_key or $hp_key = $skill1 or $hp_key = $skill2 or $hp_key = $skill3 or $hp_key = $skill4 or $hp_key = $skill5 or $hp_key = $skill6 Then
FileWrite ($a, $b&"[***ERROR***] [keys]hp_key & [keys]magic_key - """&$hp_key&" & "&$magic_key&""" - [bŁĄD - Wartosci są takie same!]")
$error = "1"
Else
FileWrite ($a, $b&"[keys]hp_key & [keys]magic_key - """&$hp_key&" & "&$magic_key&""" - [OK]")
EndIf
If $magic_key = $hp_key or $magic_key = $skill1 or $magic_key = $skill2 or $magic_key = $skill3 or $magic_key = $skill4 or $magic_key = $skill5 or $magic_key = $skill6 Then
$error = "1"
FileWrite ($a, $b&"[***ERROR***] [keys]magic_key & [keys]hp_key - """&$magic_key&" & "&$hp_key&""" - [bŁĄD - Wartosci są takie same!]")
Else
FileWrite ($a, $b&"[keys]magic_key & [keys]hp_key - """&$magic_key&" & "&$hp_key&""" - [OK]")
EndIf
If $error = "1" Then
MsgBox (16, "Bład!", "Plik ustawień nieprawidłowy! Sprawdź ustawienia, i uruchom ponownie program!")
FileWrite ($a, $b&"[***ERROR***] Plik ustawień nieprawidłowy!")
end()
EndIf

If $hp_key = "F1" Then
$hp_key = "{F1}"
EndIf
If $hp_key = "F2" Then
$hp_key = "{F2}"
EndIf
If $hp_key = "F3" Then
$hp_key = "{F3}"
EndIf
If $hp_key = "F4" Then
$hp_key = "{F4}"
EndIf
If $magic_key = "F1" Then
$magic_key = "{F1}"
EndIf
If $magic_key = "F2" Then
$magic_key = "{F2}"
EndIf
If $magic_key = "F3" Then
$magic_key = "{F3}"
EndIf
If $magic_key = "F4" Then
$magic_key = "{F4}"
EndIf
If $skill1 = "F1" Then
$skill1 = "{F1}"
EndIf
If $skill1 = "F2" Then
$skill1 = "{F2}"
EndIf
If $skill1 = "F3" Then
$skill1 = "{F3}"
EndIf
If $skill1 = "F4" Then
$skill1 = "{F4}"
EndIf
If $skill2 = "F1" Then
$skill2 = "{F1}"
EndIf
If $skill2 = "F2" Then
$skill2 = "{F2}"
EndIf
If $skill2 = "F3" Then
$skill2 = "{F3}"
EndIf
If $skill2 = "F4" Then
$skill2 = "{F4}"
EndIf
If $skill3 = "F1" Then
$skill3 = "{F1}"
EndIf
If $skill3 = "F2" Then
$skill3 = "{F2}"
EndIf
If $skill3 = "F3" Then
$skill3 = "{F3}"
EndIf
If $skill3 = "F4" Then
$skill3 = "{F4}"
EndIf
If $skill4 = "F1" Then
$skill4 = "{F1}"
EndIf
If $skill4 = "F2" Then
$skill4 = "{F2}"
EndIf
If $skill4 = "F3" Then
$skill4 = "{F3}"
EndIf
If $skill4 = "F4" Then
$skill4 = "{F4}"
EndIf
If $skill5 = "F1" Then
$skill5 = "{F1}"
EndIf
If $skill5 = "F2" Then
$skill5 = "{F2}"
EndIf
If $skill5 = "F3" Then
$skill5 = "{F3}"
EndIf
If $skill5 = "F4" Then
$skill5 = "{F4}"
EndIf
If $skill6 = "F1" Then
$skill6 = "{F1}"
EndIf
If $skill6 = "F2" Then
$skill6 = "{F2}"
EndIf
If $skill6 = "F3" Then
$skill6 = "{F3}"
EndIf
If $skill6 = "F4" Then
$skill6 = "{F4}"
EndIf
If ($skill1 = "0") Then
$s1 = "1"
EndIf
If ($skill2 = "0") Then
$s2 = "1"
EndIf
If ($skill3 = "0") Then
$s3 = "1"
EndIf
If ($skill4 = "0") Then
$s4 = "1"
EndIf
If ($skill5 = "0") Then
$s5 = "1"
EndIf
If ($skill6 = "0") Then
$s6 = "1"
EndIf
If WinExists ("METIN2") Then
Else
MsgBox (16, "Błąd!", "Włącz Metina2, i uruchom ponownie program!")
FileWrite ($a, $b&"[***ERROR***] Metin2 nie został uruchomiony!")
end()
EndIf
FileWrite ($a, $b&"[*****SUKCES*****] Pomyslnie uruchomienie programu!")
MsgBox (64, "Uruchomiono program!", "Pomyslnie uruchomiono MT2 AutoPot&AutoPickUp&SkillReload Hack by Phoenix_PL"&@CRLF&"Zanim uruchomisz hack, upewnij się ze jesies zalogowany w grze"&@CRLF&"Zeby spauzować i wznowić program, kliknij F12"&@CRLF&"Żeby wyłaczyć program, kliknij F10, lub znajdź ikonkę programu w trayu, kliknij na nią prawym przyciskiem myszy, i wybierz opcję ""Exit"""&@CRLF&"Miłej zabawy !")
FileWrite ($a, $b&"Oczekiwanie na przełączenie na okno Metin2")
$tmp = MsgBox (32+4, "Pytanie", "Przełączyć na okno Metin2?")
If $tmp = 6 Then
WinActivate ("METIN2")
EndIf
Func petla()
WinWaitActive ("METIN2")
If WinActive ("METIN2") Then
FileWrite ($a, $b&"Uruchamianie głównej pętli programu")
While 1
If $autopickup = "1" Then
 Send ("z")
EndIf
If $autopot_hp = "1" Then
 Send ($hp_key)
EndIf
If $autopot_magic = "1" Then
 Send ($magic_key)
EndIf
If $autoskill = "1" And $s1 = "0" Then
 Send ($skill1)
EndIf
If $autoskill = "1" And $s2 = "0" Then
 Send ($skill2)
EndIf
If $autoskill = "1" And $s3 = "0" Then
 Send ($skill3)
EndIf
If $autoskill = "1" And $s4 = "0" Then
 Send ($skill4)
EndIf
If $autoskill = "1" And $s5 = "0" Then
 Send ($skill5)
EndIf
If $autoskill = "1" And $s6 = "0" Then
 Send ($skill6)
EndIf
HotKeySet ("{F12}", "pause")
HotKeySet ("{F10}", "end")
WEnd
EndIf
EndFunc
petla()

 

 

Link do oryginalnego tematu: http://www.mpcforum....-by-phoenix-pl/

 

PS: Wskażcie co ewentualnie poprawić, bo na 100% jest coś do poprawienia!

W załączniku jest plik .au3

MT2Bot.zip

846331404756772371599.jpeg
Opublikowano

Może przerób go na działającego w tle?

Chyba można używać ASM w autoit:)

Do auto skill i pick up moge dać ci funkcje...

 

 

screen-10.png

 

Click skill slot(używanie skillów ze slotu)

MOV ECX,DWORD PTR DS:[0081373C]
PUSH EDX  /1,2,3,4,5...
CALL metin2cl.00455C10
CALL metin2cl.005859D0

 

Pick up

MOV ECX,DWORD PTR DS:[0081373C]
CALL metin2cl.0044EA50

eh...

Opublikowano

Może przerób go na działającego w tle?

Chyba można używać ASM w autoit:)

Do auto skill i pick up moge dać ci funkcje...

 

 

screen-10.png

 

Click skill slot(używanie skillów ze slotu)

MOV ECX,DWORD PTR DS:[0081373C]
PUSH EDX  /1,2,3,4,5...
CALL metin2cl.00455C10
CALL metin2cl.005859D0

 

Pick up

MOV ECX,DWORD PTR DS:[0081373C]
CALL metin2cl.0044EA50

Właśnie nie można używać asm.
Opublikowano
Opublikowano

nie ogarniam. jeśli wywołasz ten kod asm to zadziała on na aplikacji z autoit a nie na metinie czy czymtam chcesz ...

do wykonania tego 2 potrzebne jest inicjacja pamieci w metinie i utworzenie nowego wątku albo wstrzykniecie calego programu w proces metina czy jakieś inne okrężne drogi

Opublikowano

A nie lepiej pogrzebać w skryptach clienta? Są w pythonie napisane. Bawiłem się kiedyś, coś tam da radę wykombinować.

 

W Kamermodzie jest to właśnie tak zrobione. Można poszperać.

Opublikowano
nie ogarniam. jeśli wywołasz ten kod asm to zadziała on na aplikacji z autoit a nie na metinie czy czymtam chcesz ...

 

MOV ECX,DWORD PTR DS:[0081373C]
PUSH EDX  /1,2,3,4,5...
CALL metin2cl.00455C10
CALL metin2cl.005859D0

 

jak dla mnie to wywołuje komórki pamięci, które należą do danych metina (pewnie niepoprawnie to napisałem, ale co tam), więc będzie to miało wpływ na metina...

Opublikowano

jeśli byłoby w procesie metina to by miało, ale jest w oddzielnym. taki kod zadziała np. z wstrzykniętej dll do metina ale nie na odległość.

Opublikowano

rzal ma chyba rację. Zauważyłem, że wszystkie hacki (do Metina) wysyłające pakiety są wstrzykiwane doń z dll. Chociażby EasyMetin.

  • 2 miesiące temu...
Opublikowano

ale ASM da się użyć. jeśli nie to mnie poprawcie ;)

 

oto przykładowy skrypt:

 

#include <ASM.au3>
; Initial an asm object
Global $Asm = AsmInit()
Demo1()
Func Demo1()
; Demo 1: Using Parameters
AsmReset($Asm)
AsmAdd($Asm, "push ebp")
AsmAdd($Asm, "mov ebp, esp")
AsmAdd($Asm, "mov eax, [ebp + 08]")
AsmAdd($Asm, "add eax, [ebp + 0c]")
AsmAdd($Asm, "pop ebp")
AsmAdd($Asm, "retn 8")
ConsoleWrite(String(AsmGetBinary($Asm)) & @CRLF)
$Ret = MemoryFuncCall("int", AsmGetPtr($Asm), "int", 1, "int", 2)
MsgBox(0, "Demo 1: Using Parameters", "1 + 2 = " & $Ret[0])
EndFunc
; Release the asm object
AsmExit($Asm)
Exit

 

 

załączam biblioteki.

 

jeśli nie o to chodziło to sorry :)

Opublikowano

I tutaj się z wami zgodzę.

Niestety, teraz żeby jakiś hack działał, musi zaistnieć w procesie Metina, i trzeba go do tego procesu zaincludować, wstrzyknąc, czy jak to tam się jeszcze nazywa

Tak więc, mój bot jak na chwilę obecną jest bezużyteczny :]

846331404756772371599.jpeg
Opublikowano

zezwolisz żebym przerobił na C+ ?

jak mi się uda to oczywiście dam DL.

odrazu mówię że zrobię go jako bibliotekę DLL więc Injector wymagany z dobrym obejściem ; ]

  • 7 miesięcy temu...
Opublikowano

Może przerób go na działającego w tle?

Chyba można używać ASM w autoit:)

Do auto skill i pick up moge dać ci funkcje...

 

 

screen-10.png

 

Click skill slot(używanie skillów ze slotu)

MOV ECX,DWORD PTR DS:[0081373C]
PUSH EDX /1,2,3,4,5...
CALL metin2cl.00455C10
CALL metin2cl.005859D0

 

Pick up

MOV ECX,DWORD PTR DS:[0081373C]
CALL metin2cl.0044EA50

Jaka to składnia? Intelowska?

/ GA-970A-UD3 / FX-6300 / Sapphire Xtreme 5830 / OCZ ZS 550W / Brutus M23 /

| MPC Coders Team | MPC Gold Member | C#, C++, PHP, (N)ASM, AutoIT, Python, Java |

Opublikowano

Istnieje też include <Inject.au3>

Trza tylko do przerobić na najnowszą wersje

 

 

#include-once
; #INDEX# =======================================================================================================================
; Title .........: Inject UDF library for AutoIt v3
; AutoIt Version : 3.3.4, Inject.au3 v 1.0 (31/1/2010)
; Language ......: English
; Description ...: Functions for getting process information and for in/ejecting a .dll file into/off a process
; Requirements ..: NomadMemory.au3, Memory.au3, WinAPI.au3, Kernel32.dll  ;Script has to be compiled in x86 Mode  ;#RequireAdmin
; Author(s) .....: Deathly Assassin (http://www.autoitbot.de)
; ===============================================================================================================================
; #REQUIRED INCLUDES# ===========================================================================================================
#include <Memory.au3>
#include <WinAPI.au3>
#include <NomadMemory.au3>
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
;_InjectAttachDll
;_InjectDetachDllEx
;_InjectDetachDll
;_InjectModulInfo
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name...........: _InjectAttachDll
; Description ...: Injects a .dll file into a process
; Syntax.........: _InjectAttachDll($sPath, $PID)
; Parameters ....: $sPath - Path and filename of the .dll file to be injected
;				  $PID - A process identifier
; Return values .: Success  - Returns hModule of the injected dll
;				  Failure  - Returns @Error of the failed function and sets @Error:
;				  |@error = 1 - _MemoryOpen failed -> $PID might be wrong
;				  |@error = 2 - _MemoryWrite failed -> "SeDebugPrivilege" might not have been set. #RequireAdmin might solve this problem / $sPath might not have been found
;	   |@error = 3 - DllOpen failed -> kernel32.dll might not have been found
;	   |@error = 4 - GetExitCodeThread failed
; Author ........: Deathly Assassin (http://www.autoitbot.de)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================

Func _InjectAttachDll($sPath, $PID)
Local $hRemote, $iLen = StringLen($sPath), $hProcess, $pAllocAdresse, $aError, $hOpen, $pLoadLibraryA
SetPrivilege("SeDebugPrivilege", 1)
SetError(0)
$hProcess = _MemoryOpen($PID)
$aError = @error
If $aError Then
 SetError(1)
 Return $aError
EndIf
$pAllocAdresse = _MemVirtualAllocEx($hProcess[1], 0, $iLen + 1, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
_MemoryWrite($pAllocAdresse, $hProcess, $sPath, 'char[' & $iLen & ']')
$aError = @error
If $aError Then
 SetError(2)
 Return $aError
EndIf
$hOpen = DllOpen("Kernel32.dll")
$aError = @error
If $aError Then
 SetError(3)
 Return $aError
EndIf
$pLoadLibraryA = DllCall($hOpen, "HANDLE", "GetProcAddress", "HANDLE", _WinAPI_GetModuleHandle("kernel32.dll"), "str", "LoadLibraryA")
$hRemote = DllCall($hOpen, "HANDLE", "CreateRemoteThread", "HANDLE", $hProcess[1], "int", 0, "int", 0, "DWORD", $pLoadLibraryA[0], "ptr", $pAllocAdresse, "DWORD", 0, "DWORD*", 0)
_WinAPI_WaitForSingleObject($hRemote[0])
$vStruct = DllStructCreate("HANDLE;")
DllCall($hOpen, "BOOL", "GetExitCodeThread", "HANDLE", $hRemote[0], "ptr", DllStructGetPtr($vStruct, 1))
$aError = DllStructGetData($vStruct, 1)
DllClose($hOpen)
_MemVirtualFreeEx($hProcess, $pAllocAdresse, $iLen, $MEM_DECOMMIT)
_MemoryClose($hProcess)
If $aError = False Then
 SetError(4)
 Return $aError
EndIf
Return $aError
EndFunc   ;==>_InjectAttachDll
; #FUNCTION# ====================================================================================================================
; Name...........: _InjectDetachDllEx
; Description ...: Ejects a .dll file off a process
; Syntax.........: _InjectDetachDllEx($hModule, $PID)
; Parameters ....: $hModule - hModule of the dll to be ejected
;				  $PID - A process identifier
; Return values .: Success  - Returns True
;				  Failure  - Returns @Error of the failed function and sets @Error:
;				  |@error = 1 - _MemoryOpen failed -> $PID might be wrong
;	   |@error = 2 - DllOpen failed -> kernel32.dll might not have been found
;				  |@error = 3 - GetExitCodeThread failed -> "SeDebugPrivilege" might not have been set. #RequireAdmin might solve this problem
; Author ........: Deathly Assassin (http://www.autoitbot.de)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================

Func _InjectDetachDllEx($hModule, $PID)
Local $hRemote, $hProcess, $aError, $hOpen, $pFreeLibrary
SetPrivilege("SeDebugPrivilege", 1)
SetError(0)
$hProcess = _MemoryOpen($PID)
$aError = @error
If $aError Then
 SetError(1)
 Return $aError
EndIf

$hOpen = DllOpen("Kernel32.dll")
$aError = @error
If $aError Then
 SetError(2)
 Return $aError
EndIf
$pFreeLibrary = DllCall($hOpen, "HANDLE", "GetProcAddress", "HANDLE", _WinAPI_GetModuleHandle("kernel32.dll"), "str", "FreeLibrary")
$hRemote = DllCall($hOpen, "HANDLE", "CreateRemoteThread", "HANDLE", $hProcess[1], "int", 0, "int", 0, "DWORD", $pFreeLibrary[0], "ptr", $hModule, "DWORD", 0, "DWORD*", 0)
_WinAPI_WaitForSingleObject($hRemote[0])
$vStruct = DllStructCreate("BOOL;")
$aError=DllCall($hOpen, "BOOL", "GetExitCodeThread", "HANDLE", $hRemote[0], "ptr", DllStructGetPtr($vStruct, 1))
$aError = DllStructGetData($vStruct, 1)
DllClose($hOpen)
_MemoryClose($hProcess)
If $aError = False Then
 SetError(3)
 Return $aError
EndIf
Return $aError
EndFunc   ;==>_InjectDetachDllEx
; #FUNCTION# ====================================================================================================================
; Name...........: _InjectDetachDll
; Description ...: Ejects a .dll file off a process
; Syntax.........: _InjectDetachDll($sPath, $PID)
; Parameters ....: $sPath - Path of the dll to be ejected
;				  $PID - A process identifier
; Return values .: Success  - Returns True
;				  Failure  - Returns -1 and sets @Error or -1 / Returns the return of _InjectDetachDllEx and sets _InjectDetachDllEx's @Error
;				  |@error = -1 - _InjectModulInfo failed -> Return=1:Wrong PID;  Return=2:DllOpen failed -> kernel32.dll might not have been found
;	   |@error = -2 - Modul wasn't found
; Author ........: Deathly Assassin (http://www.autoitbot.de)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================

Func _InjectDetachDll($sPath, $PID)
Local $aArray, $i, $aError
$aArray = _InjectModulInfo($PID)
If @error Then
 SetError(-1)
 Return $aError
EndIf
For $i = 0 To UBound($aArray) - 1
 If $aArray[$i][9] = $sPath Then
  Return _InjectDetachDllEx($aArray[$i][7], $PID)
 EndIf
Next
SetError(-2)
Return -1
EndFunc   ;==>_InjectDetachDll
; #FUNCTION# ====================================================================================================================
; Name...........: _InjectModulInfo
; Description ...: Returns information about every modul in the specified process
; Syntax.........: _InjectModulInfo($PID)
; Parameters ....: $PID - A process identifier
; Return values .: Success  - Returns an 2d array with the modules and there information
;				  Failure  - Returns -1 and sets @Error:
;				  |@error = 1 - Wrong PID
;				  |@error = 2 - DllOpen failed -> kernel32.dll might not have been found
; Author ........: Deathly Assassin (http://www.autoitbot.de)
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================

Func _InjectModulInfo($PID)
Local $hModule, $hSnapshot, $hOpen, $iCount = 0, $aArray[1][10], $i
If Not ProcessExists($PID) Then
 SetError(1)
 Return -1
EndIf
SetPrivilege("SeDebugPrivilege", 1)
$hOpen = DllOpen("Kernel32.dll")
If @error Then
 SetError(2)
 Return -1
EndIf
$vMODULEENTRY32 = DllStructCreate("DWORD dwSize; DWORD th32ModuleID; DWORD th32ProcessID; DWORD GlblcntUsage; DWORD ProccntUsage; ptr modBaseAddr; DWORD modBaseSize; HANDLE hModule; CHAR szModule[256]; CHAR szExePath[260];")
DllStructSetData($vMODULEENTRY32, 1, DllStructGetSize($vMODULEENTRY32))
$hSnapshot = DllCall($hOpen, "HANDLE", "CreateToolhelp32Snapshot", "DWORD", 8, "DWORD", $PID)
DllCall($hOpen, "BOOL", "Module32First", "HANDLE", $hSnapshot[0], "ptr", DllStructGetPtr($vMODULEENTRY32))
Do
 ReDim $aArray[$iCount + 1][10]
 For $i = 1 To 10
  $aArray[$iCount][$i - 1] = DllStructGetData($vMODULEENTRY32, $i)
 Next
 $iCount += 1
 $aError = DllCall($hOpen, "BOOL", "Module32Next", "HANDLE", $hSnapshot[0], "ptr", DllStructGetPtr($vMODULEENTRY32))
Until Not $aError[0]
DllClose($hOpen)
Return $aArray
EndFunc   ;==>_InjectModulInfo

 

 

 

Wymagany NomadMemory

1375799776-U359635.jpg

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...