elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .  (Leído 4,471 veces)
**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
[SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« en: 20 Diciembre 2017, 18:02 pm »

Bueno como dice el titulo es un Injector de archivos dll . bueno yo lo uso mas que todo al jugar HALO o CS 1.6 .     :rolleyes:  :rolleyes:  :rolleyes: HACKS jejeje.

source code :

[SOURCE-CODE] DLL Injector v0.2.4 Alpha .

Programa :

DLL Injector v0.2.4 Alpha

captura del programa :

                                                  

                                                   COMENTEN CUALQUIER CRITICA O COMENTARIO .  :D

PD : La parte de RUN Tiene algunos pequeños bug al inyectar el DLL de resto funciona de maravilla. XD


« Última modificación: 20 Diciembre 2017, 18:15 pm por **Aincrad** » En línea



Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #1 en: 20 Diciembre 2017, 20:29 pm »

Primero que nada, GRACIAS por compartir en el foro. Ahora, vamos con las críticas constructivas:



1.

¿Has pensado que ocurrirá si el usuario ha decidido instalar Firefox o Chrome en otro directorio, o si usa una versión portable, o si no se instaló ninguno de esos dos navegadores?.

Código
  1. If My.Computer.FileSystem.FileExists("C:\Program Files\Google\Chrome\Application\chrome.exe") Then
  2.    Dim Pr As New Process
  3.    Dim Psi As New ProcessStartInfo("C:\Program Files\Google\Chrome\Application\chrome.exe")
  4.    Psi.Arguments = "https://www.facebook.com/salvador.osvaldo.1"
  5.    Pr.StartInfo = Psi
  6.    Pr.StartInfo.WindowStyle = ProcessWindowStyle.Normal
  7.    Pr.Start()
  8. Else
  9.    If My.Computer.FileSystem.FileExists("C:\Program Files\Mozilla Firefox\firefox.exe") Then
  10.        Dim Prm As New Process
  11.        Dim Psis As New ProcessStartInfo("C:\Program Files\Mozilla Firefox\firefox.exe")
  12.        Psis.Arguments = "https://www.facebook.com/salvador.osvaldo.1"
  13.        Prm.StartInfo = Psis
  14.        Prm.StartInfo.WindowStyle = ProcessWindowStyle.Normal
  15.        Prm.Start()
  16.    Else
  17.        System.Diagnostics.Process.Start("https://www.facebook.com/salvador.osvaldo.1")
  18.    End If
  19. End If

...Como programador, es un punto positivo para ti que intentes controlar las posibles "variables" de cada configuración de sistema operativo en el que se vaya a usar tu programa, sin embargo, en esta ocasión es algo innecesario (y de todas formas, incompleto), debes dejar que ShellEx se encargue él solo de iniciar el navegador predefinido en el sistema, tú por tu parte tan solo tienes que "iniciar" la dirección url (como si se tratase de un programa).



2.

Una regla básica y universal en la programación es que se deben declarar nombres descriptivos para los miembros/métodos... ¿esto que narices es?:

Cita de: código fuente
Código
  1. If DLLs.Items.Count > 0 Then
  2.            run2()
  3.            ters()
  4.            reae()
  5.        Else
  6.            run2()
  7.        End If

Me enfado solo de verlo (y vamos a obviar que además los nombres no están capitalizados en Camel-Case, eso no es tan importante, pero bueno). run2, ters, reae,... Ay Dios. Si compartes un código fuente para que los demás lo puedan analizar y aprender algo nuevo, lo mínimo que puedes hacer es facilitarles un poco la comprensión escribiendo un nombre decente (que al menos no sean 4 letras aleatorias), o dejar una linea de comentario describiendo el propósito del método...



3.

PD : La parte de RUN Tiene algunos pequeños bug al inyectar el DLL de resto funciona de maravilla. XD

Es normal que tengas "pequeños bugs" y mil cosas más, puesto que estás usando el tipo de declaraciones obsoletas de VB6 (sentencia Declare Function) en lugar de usar la plataforma de invocación de .NET Framework, Platform Invoking. Aparte, los tipos de las funciones nativas que declaraste no son portables, es decir, no son compatibles con 64 Bits... en general casi todos esos parámetros de tipo "Integer" (digo casi todos, por que depende de la definición de la función nativa) debes cambiarlos por un tipo de tamaño dinámico como es IntPtr.

Antes de distribuir un código fuente como mínimo debes pasarle un análisis de código en Visual Studio (click derecho -> "Analyze" -> "Run Code Analysis on Solution") y corregir todos los warnings que te saldrán... la mitad de ellos referentes a lo que te acabo de decir, la portabilidad.

Yo en tu lugar directamente eliminaría todo este código que tienes al principio de la clase Form1:
Código
  1. Public Const PROCESS_VM_READ = &H10
  2. Public Const TH32CS_SNAPPROCESS = &H2
  3. Public Const MEM_COMMIT = 4096
  4. Public Const PAGE_READWRITE = 4
  5. Public Const PROCESS_CREATE_THREAD = (&H2)
  6. Public Const PROCESS_VM_OPERATION = (&H8)
  7. Public Const PROCESS_VM_WRITE = (&H20)
  8. Dim DLLFileName As String
  9. Public Declare Function ReadProcessMemory Lib "kernel32" ( _
  10. ByVal hProcess As Integer, _
  11. ByVal lpBaseAddress As Integer, _
  12. ByVal lpBuffer As String, _
  13. ByVal nSize As Integer, _
  14. ByRef lpNumberOfBytesWritten As Integer) As Integer
  15.  
  16. Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" ( _
  17. ByVal lpLibFileName As String) As Integer
  18.  
  19. Public Declare Function VirtualAllocEx Lib "kernel32" ( _
  20. ByVal hProcess As Integer, _
  21. ByVal lpAddress As Integer, _
  22. ByVal dwSize As Integer, _
  23. ByVal flAllocationType As Integer, _
  24. ByVal flProtect As Integer) As Integer
  25.  
  26. Public Declare Function WriteProcessMemory Lib "kernel32" ( _
  27. ByVal hProcess As Integer, _
  28. ByVal lpBaseAddress As Integer, _
  29. ByVal lpBuffer As String, _
  30. ByVal nSize As Integer, _
  31. ByRef lpNumberOfBytesWritten As Integer) As Integer
  32.  
  33. Public Declare Function GetProcAddress Lib "kernel32" ( _
  34. ByVal hModule As Integer, ByVal lpProcName As String) As Integer
  35.  
  36. Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" ( _
  37. ByVal lpModuleName As String) As Integer
  38.  
  39. Public Declare Function CreateRemoteThread Lib "kernel32" ( _
  40. ByVal hProcess As Integer, _
  41. ByVal lpThreadAttributes As Integer, _
  42. ByVal dwStackSize As Integer, _
  43. ByVal lpStartAddress As Integer, _
  44. ByVal lpParameter As Integer, _
  45. ByVal dwCreationFlags As Integer, _
  46. ByRef lpThreadId As Integer) As Integer
  47.  
  48. Public Declare Function OpenProcess Lib "kernel32" ( _
  49. ByVal dwDesiredAccess As Integer, _
  50. ByVal bInheritHandle As Integer, _
  51. ByVal dwProcessId As Integer) As Integer
  52.  
  53. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
  54. ByVal lpClassName As String, _
  55. ByVal lpWindowName As String) As Integer
  56.  
  57. Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" ( _
  58. ByVal hObject As Integer) As Integer

y lo reemplazaría por esto otro (todas estas definiciones las he extraido de mi framework comercial ElektroKit):
Código
  1. Imports System.Diagnostics.CodeAnalysis
  2. Imports System.Runtime.ConstrainedExecution
  3. Imports System.Runtime.InteropServices
  4. Imports System.Security
  5. Imports System.Text
  6. Imports System.Threading
  7. Imports Microsoft.Win32.SafeHandles
  8.  
  9. <Flags>
  10. Friend Enum LoadLibraryFlags As UInteger
  11.    DontResolveDllReferences = &H1
  12.    IgnoreCodeAuthzLevel = &H10
  13.    LoadLibraryAsDataFile = &H2
  14.    LoadLibraryAsDataFileExclusive = &H40
  15.    LoadLibraryAsImageResource = &H20
  16.    LoadLibrarySearchApplicationDir = &H200
  17.    LoadLibrarySearchDefaultDirs = &H1000
  18.    LoadLibrarySearchDllLoadDir = &H100
  19.    LoadLibrarySearchSystem32 = &H800
  20.    LoadLibrarySearchUserDirs = &H400
  21.    LoadWithAlteredSearchPath = &H8
  22. End Enum
  23.  
  24. <Flags>
  25. Friend Enum MemoryAllocationType As UInteger
  26.    Commit = &H1000
  27.    Reserve = &H2000
  28.    Reset = &H80000
  29.    ResetUndo = &H1000000
  30.    Physical = &H400000
  31.    TopDown = &H100000
  32.    LargePages = &H20000000
  33. End Enum
  34.  
  35. <Flags>
  36. Friend Enum MemoryProtectionOptions As UInteger
  37.    Execute = &H10
  38.    ExecuteRead = &H20
  39.    ExecuteReadWrite = &H40
  40.    ExecuteWriteCopy = &H80
  41.    NoAccess = &H1
  42.    [ReadOnly] = &H2
  43.    ReadWrite = &H4
  44.    WriteCopy = &H8
  45.    Guard = &H100
  46.    NoCache = &H200
  47.    WriteCombine = &H400
  48. End Enum
  49.  
  50. <Flags>
  51. Friend Enum ProcessAccessRights As Integer
  52.    AllAccess = (ProcessAccessRights.StandardRightsRequired Or ProcessAccessRights.Synchronize Or &HFFFF)
  53.    CreateThread = &H2
  54.    SetSessionId = &H4
  55.    VirtualMemoryOperation = &H8
  56.    VirtualMemoryRead = &H10
  57.    VirtualMemoryWrite = &H20
  58.    DuplicateHandle = &H40
  59.    CreateProcess = &H80
  60.    SetQuota = &H100
  61.    SetInformation = &H200
  62.    QueryInformation = &H400
  63.    SuspendResume = &H800
  64.    QueryLimitedInformation = &H1000
  65.    Synchronize = StandardAccessRights.Synchronize
  66.    Delete = StandardAccessRights.Delete
  67.    ReadControl = StandardAccessRights.ReadControl
  68.    WriteDac = StandardAccessRights.WriteDac
  69.    WriteOwner = StandardAccessRights.WriteOwner
  70.    StandardRightsRequired = StandardAccessRights.StandardRightsRequired
  71. End Enum
  72.  
  73. <Flags>
  74. Friend Enum StandardAccessRights As Integer
  75.    Delete = &H10000
  76.    ReadControl = &H20000
  77.    WriteDac = &H40000
  78.    WriteOwner = &H80000
  79.    Synchronize = &H100000
  80.    StandardRightsRequired = &HF0000
  81.    StandardRightsRead = StandardAccessRights.ReadControl
  82.    StandardRightsWrite = StandardAccessRights.ReadControl
  83.    StandardRightsExecute = StandardAccessRights.ReadControl
  84.    StandardRightsAll = &H1F0000
  85. End Enum
  86.  
  87. <Flags>
  88. Friend Enum ThreadCreationFlags As UInteger
  89.    CreateSuspended = &H4
  90.    StackSizeParamIsAReservation = &H10000
  91. End Enum
  92.  
  93. ''' <summary>
  94. ''' Represents a handle to a module returned by <see cref="NativeMethods.LoadLibrary"/>
  95. ''' or <see cref="NativeMethods.LoadLibraryEx"/> functions.
  96. ''' </summary>
  97. Public NotInheritable Class SafeModuleHandle : Inherits SafeHandleZeroOrMinusOneIsInvalid
  98.  
  99.    <SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")>
  100.    Public Sub New()
  101.        MyBase.New(ownsHandle:=True)
  102.    End Sub
  103.  
  104.    <ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)>
  105.    Protected Overrides Function ReleaseHandle() As Boolean
  106.        Return NativeMethods.FreeLibrary(Me)
  107.    End Function
  108.  
  109. End Class
  110.  
  111. <DebuggerStepThrough>
  112. <StructLayout(LayoutKind.Sequential)>
  113. Friend Structure SecurityAttributes
  114.    Friend Length As Integer
  115.    Friend SecurityDescriptor As IntPtr
  116.    Friend InheritHandle As Integer
  117. End Structure
  118.  
  119. <SuppressUnmanagedCodeSecurity>
  120. Friend NotInheritable Class NativeMethods
  121.  
  122.    Private Sub New()
  123.    End Sub
  124.  
  125.    <DllImport("Kernel32.dll", SetLastError:=True)>
  126.    Friend Shared Function CloseHandle(ByVal hObject As IntPtr
  127.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  128.    End Function
  129.  
  130.    <DllImport("kernel32.dll", SetLastError:=True)>
  131.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  132.                                              ByVal threadAttributes As IntPtr,
  133.                                              ByVal stackSize As IntPtr,
  134.                                              ByVal startAddress As IntPtr,
  135.                                              ByVal threadParameter As IntPtr,
  136.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  137.                                              ByRef refThreadId As UInteger
  138.    ) As IntPtr
  139.    End Function
  140.  
  141.    <DllImport("kernel32.dll", SetLastError:=True)>
  142.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  143.                                              ByVal threadAttributes As IntPtr,
  144.                                              ByVal stackSize As IntPtr,
  145.                                              ByVal startAddress As UIntPtr,
  146.                                              ByVal threadParameter As IntPtr,
  147.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  148.                                              ByRef refThreadId As UInteger
  149.    ) As IntPtr
  150.    End Function
  151.  
  152.    <DllImport("kernel32.dll", SetLastError:=True)>
  153.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  154.                                              ByVal threadAttributes As IntPtr,
  155.                                              ByVal stackSize As IntPtr,
  156.                                              ByVal startAddress As ThreadStart,
  157.                                              ByVal threadParameter As IntPtr,
  158.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  159.                                              ByRef refThreadId As UInteger
  160.    ) As IntPtr
  161.    End Function
  162.  
  163.    <DllImport("kernel32.dll", SetLastError:=True)>
  164.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  165.                                       <[In]> ByRef refThreadAttributes As SecurityAttributes,
  166.                                              ByVal stackSize As IntPtr,
  167.                                              ByVal startAddress As IntPtr,
  168.                                              ByVal threadParameter As IntPtr,
  169.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  170.                                              ByRef refThreadId As UInteger
  171.    ) As IntPtr
  172.    End Function
  173.  
  174.    <DllImport("kernel32.dll", SetLastError:=True)>
  175.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  176.                                       <[In]> ByRef refThreadAttributes As SecurityAttributes,
  177.                                              ByVal stackSize As IntPtr,
  178.                                              ByVal startAddress As UIntPtr,
  179.                                              ByVal threadParameter As IntPtr,
  180.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  181.                                              ByRef refThreadId As UInteger
  182.    ) As IntPtr
  183.    End Function
  184.  
  185.    <DllImport("kernel32.dll", SetLastError:=True)>
  186.    Friend Shared Function CreateRemoteThread(ByVal hProcess As IntPtr,
  187.                                       <[In]> ByRef refThreadAttributes As SecurityAttributes,
  188.                                              ByVal stackSize As IntPtr,
  189.                                              ByVal startAddress As ThreadStart,
  190.                                              ByVal threadParameter As IntPtr,
  191.                <MarshalAs(UnmanagedType.U4)> ByVal creationFlags As ThreadCreationFlags,
  192.                                              ByRef refThreadId As UInteger
  193.    ) As IntPtr
  194.    End Function
  195.  
  196.    <DllImport("User32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  197.    Friend Shared Function FindWindow(ByVal className As String,
  198.                                      ByVal windowName As String
  199.    ) As IntPtr
  200.    End Function
  201.  
  202.    <DllImport("User32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  203.    Friend Shared Function FindWindowEx(ByVal hwndParent As IntPtr,
  204.                                        ByVal hwndChildAfter As IntPtr,
  205.                                        ByVal strClassName As String,
  206.                                        ByVal strWindowName As String
  207.    ) As IntPtr
  208.    End Function
  209.  
  210.    <DllImport("User32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  211.    Friend Shared Function FindWindowEx(ByVal hwndParent As HandleRef,
  212.                                        ByVal hwndChildAfter As HandleRef,
  213.                                        ByVal strClassName As String,
  214.                                        ByVal strWindowName As String
  215.    ) As IntPtr
  216.    End Function
  217.  
  218.    <DllImport("Kernel32.dll", SetLastError:=True)>
  219.    Friend Shared Function FreeLibrary(ByVal handle As IntPtr
  220.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  221.    End Function
  222.  
  223.    <DllImport("Kernel32.dll", SetLastError:=True)>
  224.    Friend Shared Function FreeLibrary(ByVal handle As SafeModuleHandle
  225.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  226.    End Function
  227.  
  228.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  229.    Friend Shared Function GetModuleHandle(ByVal moduleName As String
  230.    ) As IntPtr
  231.    End Function
  232.  
  233.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  234.    Friend Shared Function GetProcAddress(ByVal hModule As IntPtr,
  235.                                          ByVal procName As String
  236.    ) As IntPtr
  237.    End Function
  238.  
  239.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  240.    Friend Shared Function GetProcAddress(ByVal hModule As SafeModuleHandle,
  241.                                          ByVal procName As String
  242.    ) As IntPtr
  243.    End Function
  244.  
  245.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  246.    Friend Shared Function LoadLibrary(ByVal fileName As String
  247.    ) As SafeModuleHandle
  248.    End Function
  249.  
  250.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  251.    Friend Shared Function LoadLibraryEx(ByVal fileName As String,
  252.                                         ByVal hFile As IntPtr,
  253.           <MarshalAs(UnmanagedType.U4)> ByVal flags As LoadLibraryFlags
  254.    ) As SafeModuleHandle
  255.    End Function
  256.  
  257.    <DllImport("Kernel32.dll", SetLastError:=True)>
  258.    Friend Shared Function OpenProcess(
  259.         <MarshalAs(UnmanagedType.U4)> ByVal processAccess As ProcessAccessRights,
  260.                                       ByVal inheritHandle As Boolean,
  261.                                       ByVal pid As Integer
  262.    ) As IntPtr
  263.    End Function
  264.  
  265.    <DllImport("Kernel32.dll", SetLastError:=True)>
  266.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  267.                                             ByVal baseAddress As IntPtr,
  268.                                             ByVal buffer As IntPtr,
  269.                                             ByVal size As IntPtr,
  270.                                             ByRef refNumberOfBytesRead As Integer
  271.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  272.    End Function
  273.  
  274.    <DllImport("Kernel32.dll", SetLastError:=True)>
  275.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  276.                                             ByVal baseAddress As IntPtr,
  277.                                             ByVal buffer As IntPtr,
  278.                                             ByVal size As UInteger,
  279.                                             ByRef refNumberOfBytesRead As Integer
  280.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  281.    End Function
  282.  
  283.    <DllImport("Kernel32.dll", SetLastError:=True)>
  284.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  285.                                             ByVal baseAddress As IntPtr,
  286.                                       <Out> ByVal buffer As Byte(),
  287.                                             ByVal size As UInteger,
  288.                                             ByRef refNumberOfBytesRead As Integer
  289.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  290.    End Function
  291.  
  292.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  293.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  294.                                             ByVal baseAddress As IntPtr,
  295.                                       <Out> ByVal buffer As StringBuilder,
  296.                                             ByVal size As Integer,
  297.                                             ByRef refNumberOfBytesRead As Integer
  298.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  299.    End Function
  300.  
  301.    <DllImport("Kernel32.dll", SetLastError:=True)>
  302.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  303.                                             ByVal baseAddress As UIntPtr,
  304.                                             ByVal buffer As IntPtr,
  305.                                             ByVal size As IntPtr,
  306.                                             ByRef refNumberOfBytesRead As Integer
  307.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  308.    End Function
  309.  
  310.    <DllImport("Kernel32.dll", SetLastError:=True)>
  311.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  312.                                             ByVal baseAddress As UIntPtr,
  313.                                             ByVal buffer As IntPtr,
  314.                                             ByVal size As Integer,
  315.                                             ByRef refNumberOfBytesRead As Integer
  316.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  317.    End Function
  318.  
  319.    <DllImport("Kernel32.dll", SetLastError:=True)>
  320.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  321.                                             ByVal baseAddress As UIntPtr,
  322.                                       <Out> ByVal buffer As Byte(),
  323.                                             ByVal size As Integer,
  324.                                             ByRef refNumberOfBytesRead As Integer
  325.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  326.    End Function
  327.  
  328.    <DllImport("Kernel32.dll", SetLastError:=True, CharSet:=CharSet.Ansi, BestFitMapping:=False, ThrowOnUnmappableChar:=True)>
  329.    Friend Shared Function ReadProcessMemory(ByVal hProcess As IntPtr,
  330.                                             ByVal baseAddress As UIntPtr,
  331.                                       <Out> ByVal buffer As StringBuilder,
  332.                                             ByVal size As Integer,
  333.                                             ByRef refNumberOfBytesRead As Integer
  334.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  335.    End Function
  336.    <DllImport("Kernel32.dll", SetLastError:=True)>
  337.    Friend Shared Function VirtualAlloc(ByVal address As IntPtr,
  338.                                        ByVal size As UInteger,
  339.          <MarshalAs(UnmanagedType.U4)> ByVal allocationType As MemoryAllocationType,
  340.          <MarshalAs(UnmanagedType.U4)> ByVal protection As MemoryProtectionOptions
  341.    ) As IntPtr
  342.    End Function
  343.  
  344.    <DllImport("Kernel32.dll", SetLastError:=True)>
  345.    Friend Shared Function VirtualAlloc(ByVal address As UIntPtr,
  346.                                        ByVal size As UInteger,
  347.          <MarshalAs(UnmanagedType.U4)> ByVal allocationType As MemoryAllocationType,
  348.          <MarshalAs(UnmanagedType.U4)> ByVal protection As MemoryProtectionOptions
  349.    ) As UIntPtr
  350.    End Function
  351.  
  352.    <DllImport("Kernel32.dll", ExactSpelling:=True, SetLastError:=True)>
  353.    Friend Shared Function VirtualAllocEx(ByVal hProcess As IntPtr,
  354.                                          ByVal address As IntPtr,
  355.                                          ByVal size As UInteger,
  356.            <MarshalAs(UnmanagedType.U4)> ByVal allocationType As MemoryAllocationType,
  357.            <MarshalAs(UnmanagedType.U4)> ByVal protection As MemoryProtectionOptions
  358.    ) As IntPtr
  359.    End Function
  360.  
  361.    <DllImport("Kernel32.dll", ExactSpelling:=True, SetLastError:=True)>
  362.    Friend Shared Function VirtualAllocEx(ByVal hProcess As IntPtr,
  363.                                          ByVal address As UIntPtr,
  364.                                          ByVal size As UInteger,
  365.            <MarshalAs(UnmanagedType.U4)> ByVal allocationType As MemoryAllocationType,
  366.            <MarshalAs(UnmanagedType.U4)> ByVal protection As MemoryProtectionOptions
  367.    ) As UIntPtr
  368.    End Function
  369.  
  370.    <DllImport("Kernel32.dll", SetLastError:=True)>
  371.    Friend Shared Function WriteProcessMemory(ByVal hProcess As IntPtr,
  372.                                              ByVal baseAddress As IntPtr,
  373.                                              ByVal buffer As Byte(),
  374.                                              ByVal size As IntPtr,
  375.                                        <Out> ByRef refNumberOfBytesWritten As IntPtr
  376.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  377.    End Function
  378.  
  379.    <DllImport("Kernel32.dll", SetLastError:=True)>
  380.    Friend Shared Function WriteProcessMemory(ByVal hProcess As IntPtr,
  381.                                              ByVal baseAddress As UIntPtr,
  382.                                              ByVal buffer As Byte(),
  383.                                              ByVal size As IntPtr,
  384.                                        <Out> ByRef refNumberOfBytesWritten As IntPtr
  385.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  386.    End Function
  387.  
  388.    <DllImport("Kernel32.dll", SetLastError:=True)>
  389.    Friend Shared Function WriteProcessMemory(ByVal hProcess As IntPtr,
  390.                                              ByVal baseAddress As IntPtr,
  391.                                              ByVal buffer As IntPtr,
  392.                                              ByVal size As IntPtr,
  393.                                        <Out> ByRef refNumberOfBytesWritten As IntPtr
  394.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  395.    End Function
  396.  
  397.    <DllImport("Kernel32.dll", SetLastError:=True)>
  398.    Friend Shared Function WriteProcessMemory(ByVal hProcess As IntPtr,
  399.                                              ByVal baseAddress As UIntPtr,
  400.                                              ByVal buffer As IntPtr,
  401.                                              ByVal size As IntPtr,
  402.                                        <Out> ByRef refNumberOfBytesWritten As IntPtr
  403.    ) As <MarshalAs(UnmanagedType.Bool)> Boolean
  404.    End Function
  405.  
  406. End Class

...Evidentemente vas a tener que realizar las adaptaciones necesarias en el resto de tu código, puesto que los parámetros de las funciones cambian de tipo (son portables), del código que tenías, al que te acabo de mostrar.

PD: fíjate que especifiqué el set de caracteres ANSI para las funcioens que toman un string, quizás quieras cambiarlo según tus necesidades.

Saludos.


« Última modificación: 20 Diciembre 2017, 20:44 pm por Eleкtro » En línea

**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #2 en: 20 Diciembre 2017, 20:44 pm »

ahh . corregiré esos errores . XD

acerca del punto 1 .
Citar
¿Has pensado que ocurrirá si el usuario ha decidido instalar Firefox o Chrome en otro directorio, o si usa una versión portable, o si no se instaló ninguno de esos dos navegadores?.

si lo tome en cuenta , por eso es que primero comprueba si esta el croome.exe , si no esta, comprueba si existe el firefox.exe y si tampoco lo encuentra, abre el link normal mediante:

 
Código
  1. System.Diagnostics.Process.Start()


Perdona mi ignorancia, pero no entiendo estas importaciones, me la podrías explicar?

Código
  1. Imports System.Diagnostics.CodeAnalysis
  2. Imports System.Runtime.ConstrainedExecution
  3. Imports System.Runtime.InteropServices
  4. Imports Microsoft.Win32.SafeHandles
« Última modificación: 20 Diciembre 2017, 20:47 pm por **Aincrad** » En línea



Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #3 en: 20 Diciembre 2017, 20:48 pm »

no entiendo estas importaciones, me la podrías explicar?

¿Que significa exactamente cuando dices "no entiendo estas importaciones"?, no sé si entiendo lo que estás preguntando exactamente. Eso son importaciones de namespaces necesarias para varios miembros en la clase que te mostré.

Saludos
« Última modificación: 20 Diciembre 2017, 20:50 pm por Eleкtro » En línea

**Aincrad**


Desconectado Desconectado

Mensajes: 668



Ver Perfil WWW
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #4 en: 20 Diciembre 2017, 21:07 pm »

olvida la pregunta , me puse a analizar un poco y ya .

PD : Al remplazar el código por el que me pusiste me laza errores por doquier.
 a ti también te salen?
En línea



Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #5 en: 21 Diciembre 2017, 10:23 am »

PD : Al remplazar el código por el que me pusiste me laza errores por doquier.
 a ti también te salen?

No es una simple cuestión de copiar y pegar (no voy a modificarte todo el proyecto para hacer yo todas las correcciones, solo compartí contigo los P/Invokes que deberías usar en tu proyecto), como ya te comenté:

Cita de: Elektro
...Evidentemente vas a tener que realizar las adaptaciones necesarias en el resto de tu código, puesto que los parámetros de las funciones cambian de tipo (son portables), del código que tenías, al que te acabo de mostrar.

Te van a salir muchos errores por que en tu código original usas tipos diferentes para llamar a esas funciones, entre otras cosas.

Saludos
« Última modificación: 21 Diciembre 2017, 10:25 am por Eleкtro » En línea

Maurice_Lupin


Desconectado Desconectado

Mensajes: 356

GPS


Ver Perfil WWW
Re: [SOURCE-CODE] DLL Injector v0.2.4 Alpha .
« Respuesta #6 en: 22 Diciembre 2017, 02:20 am »

Gracias por compartir tu código **Aincrad**, como me decía un maestro: Puede no ser lo más bello del mundo pero es tu bebe y trabajo ha acostado parirlo :D

Tienes que amarlo.
En línea

Un error se comete al equivocarse.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines