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


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


  Mostrar Temas
Páginas: 1 2 [3] 4 5 6 7
21  Programación / Programación Visual Basic / Generic Sever Editor Class [SRC] en: 19 Septiembre 2008, 18:28 pm
Bueno me harte de que pregunten esto un millon de veces, aca les dejo un codigo super simple para leer y escribir datos al final de un EXE. Creditos a E0N por la funcion para calcular el EOF

Clase:

Código
  1. '---------------------------------------------------------------------------------------
  2. ' Module      : cEditSvr
  3. ' DateTime    : 19/09/2008 13:23
  4. ' Author      : Cobein
  5. ' Mail        : cobein27@hotmail.com
  6. ' WebPage     : http://www.advancevb.com.ar
  7. ' Purpose     : Read Write data at EOF
  8. ' Usage       : At your own risk
  9. ' Requirements: None
  10. ' Distribution: You can freely use this code in your own
  11. '               applications, but you may not reproduce
  12. '               or publish this code on any web site,
  13. '               online service, or distribute as source
  14. '               on any media without express permission.
  15. '
  16. ' History     : 19/09/2008 First Cut....................................................
  17. '---------------------------------------------------------------------------------------
  18. Option Explicit
  19.  
  20. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
  21.  
  22. Private c_pBag      As New PropertyBag
  23. Private c_sFile     As String
  24. Private c_lEOF      As Long
  25. Public c_bHasData  As Boolean
  26.  
  27. '---------------------------------------------------------------------------------------
  28. ' Procedure : GetEOF
  29. ' Author    : E0N
  30. ' Purpose   : Calculate EOF
  31. '---------------------------------------------------------------------------------------
  32. Private Function GetEOF(sPath As String) As Long
  33.    Dim vbData() As Byte
  34.    Dim PE As Long, NumberOfSections As Integer
  35.    Dim BeginLastSection As Long
  36.    Dim RawSize As Long, RawOffset As Long
  37.  
  38.    Open sPath For Binary As #1
  39.        ReDim vbData(LOF(1) - 1)
  40.        Get #1, , vbData
  41.    Close #1
  42.  
  43.    Call CopyMemory(PE, vbData(&H3C), 4)
  44.    Call CopyMemory(NumberOfSections, vbData(PE + &H6), 2)
  45.    BeginLastSection = PE + &HF8 + ((NumberOfSections - 1) * &H28)
  46.    Call CopyMemory(RawSize, vbData(BeginLastSection + 16), 4)
  47.    Call CopyMemory(RawOffset, vbData(BeginLastSection + 20), 4)
  48.    GetEOF = RawSize + RawOffset
  49. End Function
  50.  
  51. Public Function ExeFile(sPath As String) As Boolean
  52.    c_sFile = sPath
  53.    c_lEOF = GetEOF(c_sFile)
  54.  
  55.    If Not FileLen(c_sFile) = c_lEOF Then
  56.        c_bHasData = True
  57.  
  58.        Dim vbData() As Byte
  59.  
  60.        Open c_sFile For Binary As #1
  61.        ReDim vbData(LOF(1) - c_lEOF - 1)
  62.        Seek #1, c_lEOF + 1
  63.        Get #1, , vbData
  64.        Close #1
  65.        '+++++++++++++++++++++++++++++++++++++++++++++++++++++
  66.        'At this point you can Decrypt the byte array [vbData]
  67.        '+++++++++++++++++++++++++++++++++++++++++++++++++++++
  68.        Set c_pBag = New PropertyBag
  69.        c_pBag.Contents = vbData
  70.    End If
  71.  
  72. End Function
  73.  
  74. Public Sub WriteProp(sName As String, vVal As Variant)
  75.    c_pBag.WriteProperty sName, vVal
  76. End Sub
  77.  
  78. Public Function ReadProp(sName As String) As Variant
  79.    ReadProp = c_pBag.ReadProperty(sName)
  80. End Function
  81.  
  82. Public Function WriteData(sDstFile As String) As Boolean
  83.    Dim vbData() As Byte
  84.  
  85.    Open c_sFile For Binary Access Read As #1
  86.    ReDim vbData(LOF(1) - 1)
  87.    Get #1, , vbData
  88.    Close #1
  89.  
  90.    Open sDstFile For Binary Access Write As #1
  91.    Put #1, , vbData
  92.    vbData = c_pBag.Contents
  93.    '+++++++++++++++++++++++++++++++++++++++++++++++++++++
  94.    'At this point you can Encrypt the byte array [vbData]
  95.    '+++++++++++++++++++++++++++++++++++++++++++++++++++++
  96.    Put #1, , vbData
  97.    Close #1
  98.  
  99. End Function
  100.  

Como llamarlo

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.  
  5.    Dim c As New cEditSvr
  6.    c.ExeFile "c:\proyecto1.exe"
  7.    c.WriteProp "IP", "123.123.123.123"
  8.    c.WriteProp "Port", 1234
  9.    c.WriteData "c:\test.exe"
  10.  
  11.  
  12.    Set c = New cEditSvr
  13.    c.ExeFile "c:\test.exe"
  14.    Debug.Print c.ReadProp("IP")
  15.    Debug.Print c.ReadProp("Port")
  16. End Sub
  17.  
  18.  
22  Programación / Programación Visual Basic / Split replacement en: 17 Septiembre 2008, 04:04 am
Estaba al pe.. asi que hice esto una funcion que imita a la funcion Split, al parecer el split es detectado por la heuristica de los AVs asi que esto podria ser una buena opcion supongo.

Bueno no se porque pero esto me esta modificando la variable Expre ssion (lo separe para que no lo modifique) por epresionje

Código
  1. '---------------------------------------------------------------------------------------
  2. ' Procedure : SplitAlter
  3. ' DateTime  : 16/09/2008 22:58
  4. ' Author    : Cobein
  5. ' Mail      : cobein27@yahoo.com
  6. ' Purpose   : Complete Split Replacement
  7. '---------------------------------------------------------------------------------------
  8. Private Function SplitAlter(ByVal epresionje As String, Optional ByVal Delimiter As String, Optional ByVal Limit As Long = -1) As String()
  9.    Dim lLastPos    As Long
  10.    Dim lIncrement  As Long
  11.    Dim lExpLen     As Long
  12.    Dim lDelimLen   As Long
  13.    Dim lUbound     As Long
  14.    Dim svTemp()    As String
  15.  
  16.    lExpLen = Len(epresionje)
  17.  
  18.    If Delimiter = vbNullString Then Delimiter = " "
  19.    lDelimLen = Len(Delimiter)
  20.    If Limit = 0 Then GoTo QuitHere
  21.    If lExpLen = 0 Then GoTo QuitHere
  22.    If InStr(1, epresionje, Delimiter, vbBinaryCompare) = 0 Then GoTo QuitHere
  23.  
  24.    ReDim svTemp(0)
  25.    lLastPos = 1
  26.    lIncrement = 1
  27.  
  28.    Do
  29.        If lUbound + 1 = Limit Then
  30.            svTemp(lUbound) = Mid$(epresionje, lLastPos)
  31.            Exit Do
  32.        End If
  33.        lIncrement = InStr(lIncrement, epresionje, Delimiter, vbBinaryCompare)
  34.        If lIncrement = 0 Then
  35.            If Not lLastPos = lExpLen Then
  36.                svTemp(lUbound) = Mid$(epresionje, lLastPos)
  37.            End If
  38.            Exit Do
  39.        End If
  40.        svTemp(lUbound) = Mid$(epresionje, lLastPos, lIncrement - lLastPos)
  41.        lUbound = lUbound + 1
  42.        ReDim Preserve svTemp(lUbound)
  43.        lLastPos = lIncrement + lDelimLen
  44.        lIncrement = lLastPos
  45.    Loop
  46.  
  47.    ReDim Preserve svTemp(lUbound)
  48.    SplitAlter = svTemp
  49.  
  50.    Exit Function
  51.  
  52. QuitHere:
  53.    ReDim SplitAlter(-1 To -1)
  54. End Function
  55.  
23  Programación / Programación Visual Basic / TheBug [SRC] en: 16 Septiembre 2008, 21:08 pm
Bueno, estaba trabajando en este proyecto y me gustaria ver que opinan del mismo, esta incompleto para mi gusto pero es totalmente funcional.

TheBug is an application that lets you monitor debug output on your local system. It is capable of displaying Win32 debug output generated by standard debug print APIs, so you don’t need a debugger to catch the debug output your applications generate, and you don't need to modify your applications to use non-Windows debug functions in order to view its debug output.

Descaraga: http://www.uploadsourcecode.com.ar/d/HGGHHpVJsjtBbWOcgrobJcGiksO3Ghtb

24  Programación / Programación Visual Basic / Juego [SRC] en: 11 Septiembre 2008, 12:27 pm
Bueno estaba aburrido y me puse a hacer este jueguito de naves que nunca termine, esta hecho estilo old skool, con graficos hechos de caracteres, si alguno se quiere reir un rato...

http://www.uploadsourcecode.com.ar/d/nrrL1VV4RSDioBzfNwZHBKoUD6z4cu9D
25  Programación / Programación Visual Basic / Cryptosy [SRC] en: 8 Septiembre 2008, 17:18 pm
Bueno producto del aburrimiento me dedique a hacer este "crypter", no es FUD ni nada magico pero funciona bastante bien

http://www.uploadsourcecode.com.ar/d/bph0xHw4opViUVfGjq9YVsiew4L2538p
26  Programación / Programación Visual Basic / Detectar Debugger (SRC) en: 1 Septiembre 2008, 21:17 pm
Código:
Private Declare Function OutputDebugStringA Lib "kernel32" (ByVal lpString As String) As Long

Private Sub Form_Load()
    If IsDebuggerActive Then
        MsgBox "Debugger Present"
    End If
End Sub

Private Function IsDebuggerActive() As Boolean
    IsDebuggerActive = Not (OutputDebugStringA("=)") = 1)
End Function
27  Programación / Programación Visual Basic / Call API By Name Usin vtable Patch en: 1 Septiembre 2008, 00:54 am
Modulo de Clase
Código
  1. '---------------------------------------------------------------------------------------
  2. ' Module      : cCallAPIByName
  3. ' DateTime    : 31/08/2008 19:40
  4. ' Author      : Cobein
  5. ' Mail        : cobein27@hotmail.com
  6. ' WebPage     : http://www.advancevb.com.ar
  7. ' Purpose     : Call APIs by name
  8. ' Usage       : At your own risk
  9. ' Requirements: None
  10. ' Distribution: You can freely use this code in your own
  11. '               applications, but you may not reproduce
  12. '               or publish this code on any web site,
  13. '               online service, or distribute as source
  14. '               on any media without express permission.
  15. '
  16. ' Credits     : Arne Elster, original callpointer function.
  17. '
  18. ' History     : 31/08/2008 First Cut....................................................
  19. '---------------------------------------------------------------------------------------
  20. Option Explicit
  21.  
  22. Private Declare Sub CpyMem Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal dlen As Long)
  23. Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
  24. Private Declare Function LoadLibraryA Lib "kernel32" (ByVal lpLibFileName As String) As Long
  25.  
  26. Public Function DoNotCall() As Long
  27. '
  28. End Function
  29.  
  30. Public Function CallAPIByName(ByVal sLib As String, ByVal sMod As String, ParamArray Params()) As Long
  31.    Dim lPtr                As Long
  32.    Dim bvASM(&HEC00& - 1)  As Byte
  33.    Dim i                   As Long
  34.    Dim lMod                As Long
  35.  
  36.    lMod = GetProcAddress(LoadLibraryA(sLib), sMod)
  37.    If lMod = 0 Then Exit Function
  38.  
  39.    lPtr = VarPtr(bvASM(0))
  40.    CpyMem ByVal lPtr, &H59595958, &H4:            lPtr = lPtr + 4
  41.    CpyMem ByVal lPtr, &H5059, &H2:                lPtr = lPtr + 2
  42.    For i = UBound(Params) To 0 Step -1
  43.        CpyMem ByVal lPtr, &H68, &H1:              lPtr = lPtr + 1
  44.        CpyMem ByVal lPtr, CLng(Params(i)), &H4:   lPtr = lPtr + 4
  45.    Next
  46.    CpyMem ByVal lPtr, &HE8, &H1:                  lPtr = lPtr + 1
  47.    CpyMem ByVal lPtr, lMod - lPtr - 4, &H4:       lPtr = lPtr + 4
  48.    CpyMem ByVal lPtr, &HC3, &H1
  49.  
  50.    Dim lVTE                As Long
  51.    Dim lRet                As Long
  52.  
  53.    CpyMem lVTE, ByVal ObjPtr(Me), &H4
  54.    lVTE = lVTE + &H1C
  55.    CpyMem lRet, ByVal lVTE, &H4
  56.    CpyMem ByVal lVTE, VarPtr(bvASM(0)), &H4
  57.    CallAPIByName = DoNotCall
  58.    CpyMem ByVal lVTE, lRet, &H4
  59. End Function
  60.  

Como Llamarlo
Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Dim c As New cCallAPIByName
  5.  
  6.    c.CallAPIByName "user32", "MessageBoxW", 0, VarPtr(ByVal "Test"), VarPtr(ByVal "Test"), 0
  7.  
  8. End Sub
  9.  
28  Programación / Programación Visual Basic / RichTextBox Class [Source] en: 13 Agosto 2008, 21:31 pm
Bueno aca les dejo una mini clase para crear controles RichTextBox en tiempo de ejecucion, es muy simple pero viene ideal para EULA, Readme o Help files.

http://www.uploadsourcecode.com.ar/d/IxpzMQ8JDQDdsy6njvxsLYf70SivC04o
29  Programación / Programación Visual Basic / Plugin Sample [Source] en: 8 Agosto 2008, 19:36 pm
Bueno ya vi que preguntaron esto mil veces asi que arme un ejemplo de como pueden hacer y usar plugins, el ejemplo no necesita que se registren las librerias, valida los plugins, obtiene descripciones etc. Es facil de comprender asi que espero que no pregunten mas esto =)

Descarga: http://www.uploadsourcecode.com.ar/d/CbxSm5kMQm8NLMQAROtzXc52yWAFiFWC
30  Programación / Programación Visual Basic / Userland Rootkit test [Source] en: 7 Agosto 2008, 18:52 pm
Bueno aca les dejo algo que estaba haciendo para como se dice por aca "sacarme la leche", es un pseudo rootkit que se inyecta y hookea la API MessageBoxW, el ejemplo se inyecta en el notepad y "consume" los messagebox como por ejemplo al querer reemplazar un archivo, pueden usar ProcessExplorer para ver la libreria en memoria y DebugView para ver las llamadas a la API.

El ejemplo es muy basico pero funciona correctamente, hay incluida una version compilada para los que no saben como hacerlo.... no hay mucho mas para decir.

Descarga: http://www.uploadsourcecode.com.ar/d/lNS2csLimZ1aQwIb5U6MryTxW0Wk6Ost
Páginas: 1 2 [3] 4 5 6 7
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines