Página 1 de 1

Dll Inject

Publicado: 18 Ago 2012, 20:21
por M3
Buenas los dejo a disfutar este code que empeze a algunos dias , testeado en XP e W732 , no ay probado en otros SO , asi que no se , se podem reportar se agradece , espero siva a mas de uno , los dejo el Code e una Dll para probar el funcionamiento ,


MsgBox DLL ==>> [Enlace externo eliminado para invitados]


se tienem duda preguntem ,


Saludos


Código: Seleccionar todo


Const $sProcess = "Anotador.exe"
Const $sDLLtoInject = @ScriptDir & "\MsgBox.dll"
Const $sKernel32 = DllOpen("Kernel32")


#cs========================================================#

Autor : M3
Proposito : Injetar una Dll en un processo
Flecha: 18/08/2012
Uso :sInjectMyDll(ProcessExists($sProcess), $sDLLtoInject)

#ce========================================================#


sInjectMyDll(ProcessExists($sProcess), $sDLLtoInject)

Func sInjectMyDll($sProcess, $sDLLtoInject)



		Local $sHandle, $sRemote, $sGetModuleHandle, $sLoadLibrary, $sThread


		$sHandle = OpenProcess(2035711, 0, $sProcess)


		$sRemote = VirtualAllocEx($sHandle, 0, 4096, 4096, 4)




			For $i = 0 To StringLen($sDLLtoInject)


			$sReturn = DllCall($sKernel32, "none", "WriteProcessMemory", "int", $sHandle, "int", $sRemote + $i, "int*", _
			Asc(StringMid($sDLLtoInject, $i + 1, 1)), "int", 1, "int", 0)


			Next



		$sGetModuleHandle = DllCall($sKernel32, "long", "GetModuleHandleA", "str", "Kernel32")



		$sGetModuleHandle = $sGetModuleHandle[0]



		$sLoadLibrary = DllCall($sKernel32, "long", "GetProcAddress", "long", $sGetModuleHandle, "str", "LoadLibraryA")



		$sLoadLibrary = $sLoadLibrary[0]



		$sThread = CreateRemoteThread ($sHandle, 0, 0, $sLoadLibrary, $sRemote, 0, 0)



		If $sThread > 0 Then

		$sThread = True

		Else

		MsgBox ("","Erro en la Injeccion","Processo a injetar no existe")

		SetError(-1)

		Return 1

		EndIf



		CloseHandle ($sThread)
		CloseHandle ($sHandle)


		Return 1


EndFunc


Func OpenProcess($iAccess, $bInherit, $iProcessID)

		Local $bResult = DllCall("Kernel32", "int", "OpenProcess", "int", $iAccess, "int", $bInherit, "int", $iProcessID)
		If @error Or Not IsArray($bResult) Then Return SetError(-1)
		Return $bResult[0]

EndFunc




Func VirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $iProtect)

		Local $bResult = DllCall("Kernel32", "ptr", "VirtualAllocEx", "int", $hProcess, "ptr", $pAddress, "int", $iSize, "int", $iAllocation, "int", $iProtect)
		If @error Or Not IsArray($bResult) Then Return SetError(-1)
		Return $bResult[0]

EndFunc




Func CloseHandle($hObject)

		Local $bResult = DllCall("Kernel32", "int", "CloseHandle", "int", $hObject)
		If @error Or Not IsArray($bResult) Then Return SetError(-1)
		Return $bResult[0]

EndFunc




Func CreateRemoteThread($hProcess, $lpThreadAttributes, $dwStackSize, $lpStartAddress, $lpParameter, $dwCreationFlags, $lpThreadId)

		Local $Return
		$Return = DllCall("Kernel32", "int", "CreateRemoteThread", "int", $hProcess, "ptr", $lpThreadAttributes, "int", $dwStackSize, "int", $lpStartAddress, "ptr", $lpParameter, "int", $dwCreationFlags, "int", $lpThreadId)
		Return $Return[0]

EndFunc


Pues nada

Re: Dll Inject

Publicado: 18 Ago 2012, 21:33
por jorge705
wow M3 cada vez mejor .-. gracias

Re: Dll Inject

Publicado: 18 Ago 2012, 22:04
por Himanen
que bueno tio... en cuanto tenga un rato lo pruebo... Saludos Master!!

Re: Dll Inject

Publicado: 19 Ago 2012, 05:23
por M3
Gracias tios , ao final quedo bueno esta Modificaccion espero gustem e sirva

los dejo un scan del compilado

Fichero: Inject.exe
Fecha/Hora: 19/8/2012 05:28:02 GMT +1
Tamaño: 279679 Bytes
MD5: cf0b07930b2d65967d18a3bc5d65ffa6
SHA1: 92ec9a0d1a89e7a585b0448972a594a1cf2b90ea
Detecciones: 1/35
Estado: INFECTADO

AVG Free - Limpio
ArcaVir - Limpio
Avast 5 - Limpio
AntiVir (Avira) - Limpio
BitDefender - Limpio
VirusBuster Internet Security - Limpio
Clam Antivirus - Limpio
COMODO Internet Security - Limpio
Dr.Web - Limpio
eTrust-Vet - Limpio
F-PROT Antivirus - Limpio
F-Secure Internet Security - Limpio
G Data - Limpio
IKARUS Security - Limpio
Kaspersky Antivirus - Limpio
McAfee - Limpio
MS Security Essentials - Limpio
ESET NOD32 - Limpio
Norman - Limpio
Norton Antivirus - Limpio
Panda Security - Limpio
A-Squared - Limpio
Quick Heal Antivirus - Limpio
Rising Antivirus - Limpio
Solo Antivirus - Limpio
Sophos - Limpio
Trend Micro Internet Security - Limpio
VBA32 Antivirus - infected Malware-Cryptor.Inject.gen
Vexira Antivirus - Limpio
Zoner AntiVirus - Limpio
Ad-Aware - Limpio
BullGuard - Limpio
Immunet Antivirus - Limpio
K7 Ultimate - Limpio
VIPRE - Limpio

[Enlace externo eliminado para invitados]