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

 

 


Tema destacado: Curso de javascript por TickTack


  Mostrar Temas
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12
21  Programación / Programación Visual Basic / mMemory - WriteProcessMemory/vbaCopyBytes/RtlMoveMemory replacement [NOAPI!!!] en: 31 Octubre 2011, 13:19 pm
Hace mucho tiempo que no toqueteaba a mi querido VB6 :P Así que aquí estoy con otra primicia chicoooos!!! :laugh: :laugh:

Este modulito que os presento permite trabajar con la memoria sin el uso de ningún API!!!!

Eso sí! Tenéis que desactivar la comprobación de límites de matrices :P Os pongo una foto:

Además solo funciona compilado, como muchos otros hacks el IDE no permite tocar demasiado :-\ :xD

Y como todos estáis deseando aquí viene el sencillo pero eficaz código :)
Código
  1. '---------------------------------------------------------------------------------------
  2. ' Module    : mMemory
  3. ' Author    : Karcrack
  4. ' Date      : 20/09/2011
  5. ' Purpose   : Work with memory withouth using any API
  6. ' History   : 20/09/2011 First cut .....................................................
  7. '---------------------------------------------------------------------------------------
  8.  
  9. Option Explicit
  10.  
  11. Private bvHack(0)               As Byte
  12. Private lHackDelta              As Long
  13. Private bInitialized            As Boolean
  14.  
  15. Public Function Initialize() As Boolean
  16.    On Error GoTo Error_Handle
  17.  
  18.    bvHack(-1) = bvHack(-1) 'Error check
  19.    lHackDelta = VarPtr(bvHack(0))
  20.  
  21.    Initialize = True
  22.    bInitialized = Initialize
  23.    Exit Function
  24. Error_Handle:
  25.    If Err.Number = 9 Then Debug.Print "Remember to tick 'Remove array boundary check' and compile before using"
  26.    End
  27. End Function
  28.  
  29. Public Function GetByte(ByVal lPtr As Long) As Byte
  30.    If bInitialized Then GetByte = bvHack(lPtr - lHackDelta)
  31. End Function
  32.  
  33. Public Function GetWord(ByVal lPtr As Long) As Integer
  34.    If bInitialized Then GetWord = MakeWord(GetByte(lPtr + &H0), GetByte(lPtr + &H1))
  35. End Function
  36.  
  37. Public Function GetDWord(ByVal lPtr As Long) As Long
  38.    If bInitialized Then GetDWord = MakeDWord(GetWord(lPtr + &H0), GetWord(lPtr + &H2))
  39. End Function
  40.  
  41. Public Sub PutByte(ByVal lPtr As Long, ByVal bByte As Byte)
  42.    If bInitialized Then bvHack(lPtr - lHackDelta) = bByte
  43. End Sub
  44.  
  45. Public Sub PutWord(ByVal lPtr As Long, ByVal iWord As Integer)
  46.    If bInitialized Then Call PutByte(lPtr + &H0, iWord And &HFF): Call PutByte(lPtr + &H1, (iWord And &HFF00&) \ &H100)
  47. End Sub
  48.  
  49. Public Sub PutDWord(ByVal lPtr As Long, ByVal lDWord As Long)
  50.    If bInitialized Then Call PutWord(lPtr + &H0, IIf(lDWord And &H8000&, lDWord Or &HFFFF0000, lDWord And &HFFFF&)): Call PutWord(lPtr + &H2, (lDWord And &HFFFF0000) \ &H10000)
  51. End Sub
  52.  
  53. Private Function MakeWord(ByVal loByte As Byte, ByVal hiByte As Byte) As Integer '[http://www.xbeat.net/vbspeed/c_MakeWord.htm#MakeWord02]
  54.    If hiByte And &H80 Then
  55.        MakeWord = ((hiByte * &H100&) Or loByte) Or &HFFFF0000
  56.    Else
  57.        MakeWord = (hiByte * &H100) Or loByte
  58.    End If
  59. End Function
  60.  
  61. Private Function MakeDWord(ByVal LoWord As Integer, ByVal HiWord As Integer) As Long '[http://www.xbeat.net/vbspeed/c_MakeDWord.htm#MakeDWord05]
  62.    MakeDWord = (HiWord * &H10000) Or (LoWord And &HFFFF&)
  63. End Function

Si saco un poco de tiempo libre hago una clase chuli piruli con este mismo sistema :)

Happy codin' ::)
22  Programación / Programación Visual Basic / [VB6][SNIPPET] mAPIPatchByID - Carga APIs dinamicamente (Late binding) en: 23 Abril 2011, 15:34 pm
Código
  1. '---------------------------------------------------------------------------------------
  2. ' Module    : mAPIPatchByID
  3. ' Author    : Karcrack
  4. ' Now       : 23/04/2011 14:13
  5. ' Purpose   : Patch API functions by ID
  6. ' History   : 23/04/2011 First cut .........................................................
  7. '---------------------------------------------------------------------------------------
  8.  
  9. Option Explicit
  10.  
  11. 'KERNEL32
  12. Private Declare Function NtWriteVirtualMemory Lib "NTDLL" (ByVal hProcess As Long, ByRef lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
  13.  
  14. Public Sub PatchAPIAddr(ByVal lID As Long, ByVal lAddr As Long)
  15.    Dim hInstance       As Long
  16.    Dim lExtTablePtr    As Long
  17.  
  18.    hInstance = App.hInstance
  19.    lExtTablePtr = GetDWORD(GetDWORD((hInstance + GetDWORD(hInstance + GetDWORD(hInstance + &H3C) + &H28)) + &H1) + &H30) + &H234
  20.    If GetDWORD(lExtTablePtr + &H4) >= lID Then
  21.        Call PutDWORD(GetDWORD(GetDWORD(GetDWORD(lExtTablePtr) + (8 * lID) + 4) + &H19), lAddr)
  22.    End If
  23. End Sub
  24.  
  25. Private Sub PutDWORD(ByVal lAddr As Long, ByVal lDWORD As Long)
  26.    Call NtWriteVirtualMemory(-1, ByVal lAddr, lDWORD, 4, ByVal 0&)
  27. End Sub
  28.  
  29. Private Function GetDWORD(ByVal lAddr As Long) As Long
  30.    Call NtWriteVirtualMemory(-1, GetDWORD, ByVal lAddr, 4, ByVal 0&)
  31. End Function

Para que sirve? Para cargar APIs dinamicamente :D

Un ejemplo:
Código
  1. Option Explicit
  2.  
  3. 'USER32
  4. Private Declare Function MessageBox Lib "nadaesloqueparece" Alias "Karcrack" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
  5. 'KERNEL32
  6. Private Declare Function GetProcAddress Lib "KERNEL32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
  7. Private Declare Function LoadLibrary Lib "KERNEL32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  8.  
  9. Sub Main()
  10.    Call PatchAPIAddr(2, GetProcAddress(LoadLibrary("USER32"), "MessageBoxA"))
  11.    Call MessageBox(0, "Te has fijado en la declaracion del API 'MessageBox'?", "Hola :)", 0)
  12. End Sub
  13.  
Otro un poco mas enrevesado:
Código
  1. Option Explicit
  2.  
  3. 'USER32
  4. Private Declare Function fnc1& Lib "whatever" (ByVal a&, ByVal b&, ByVal c&, ByVal d&)
  5. Private Declare Function fnc2& Lib "whatever" (ByVal a&, ByVal b&)
  6. 'KERNEL32
  7. Private Declare Function GetProcAddress Lib "KERNEL32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
  8. Private Declare Function LoadLibrary Lib "KERNEL32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  9.  
  10. Private Const u32$ = "ZXJW87"
  11. Private Const msgbx$ = "RjxxfljGt}\"
  12. Private Const ktmr$ = "PnqqYnrjw"
  13. Private Const stmr$ = "XjyYnrjw"
  14. Private x&
  15. Private bo&
  16.  
  17. Sub Main()
  18.    Dim p&
  19.  
  20.    p = GetProcAddress(LoadLibrary(d(u32)), d(stmr))
  21.    Call PatchAPIAddr(3, p)
  22.    x = fnc1(0, 0, 2 * 1000, AddressOf tproc)
  23.    p = GetProcAddress(LoadLibrary(d(u32)), d(msgbx))
  24.    Call PatchAPIAddr(3, p)
  25.    p = GetProcAddress(LoadLibrary(d(u32)), d(ktmr))
  26.    Call PatchAPIAddr(2, p)
  27.    bo = 1
  28.    While bo
  29.        DoEvents
  30.    Wend
  31. End Sub
  32.  
  33. Private Function d$(s$)
  34.    Dim i&
  35.    d = s
  36.    For i = 1 To Len(d)
  37.        Mid$(d, i, 1) = Chr$(Asc(Mid$(d, i, 1)) - 5)
  38.    Next i
  39. End Function
  40.  
  41. Private Function tproc&(ByVal a&, ByVal b&, ByVal c&, ByVal d&)
  42.    If fnc1(0, StrPtr("Seguimos?"), StrPtr(":)"), vbYesNo) = vbNo Then
  43.        bo = 0
  44.        Call fnc2(0, x)
  45.    End If
  46. End Function

Los ejemplos han de ir en un modulo aparte puesto después del modulo 'mAPIPatchByID' para que los IDs se correspondiesen... en caso contrario hay que calcular los IDs usando por ejemplo el OllyDbg :P

Cualquier duda preguntad!
23  Programación / Programación Visual Basic / [ANTI] AmISandboxied() - Saber si estamos siendo ejecutados dentro de Sandboxie en: 13 Marzo 2011, 20:42 pm
Código
  1. Option Explicit
  2. 'NTDLL
  3. Private Declare Function RtlGetCurrentPeb Lib "NTDLL" () As Long
  4. 'MSVBVM60
  5. Private Declare Sub GetMem4 Lib "MSVBVM60" (ByVal Addr As Long, ByRef RetVal As Long)
  6.  
  7. '---------------------------------------------------------------------------------------
  8. ' Procedure : AmISandboxied
  9. ' Author    : Karcrack
  10. ' Date      : 13/03/2011
  11. ' Purpose   : Know if we are running under Sandboxie
  12. '---------------------------------------------------------------------------------------
  13. '
  14. Public Function AmISandboxied() As Boolean
  15.    Dim lUPP        As Long         '&RTL_USER_PROCESS_PARAMETERS
  16.    Dim lFlags      As Long         'RTL_USER_PROCESS_PARAMETERS.Flags
  17.  
  18.    Call GetMem4(RtlGetCurrentPeb() + &H10, lUPP)
  19.    Call GetMem4(lUPP + &H8, lFlags)
  20.    AmISandboxied = (lFlags <> 1)
  21. End Function
Bien simple, por alguna razon desconocida PEB.RTL_USER_PROCESS_PARAMETERS.Flags es distinto cuando esta siendo ejecutado dentro de Sandboxie ;)
24  Programación / Programación Visual Basic / [ANTI] IsOdbg() - Saber si estas siendo debuggeado por el OllyDebugger en: 12 Marzo 2011, 13:45 pm
Código
  1. Option Explicit
  2. 'KERNEL32
  3. Private Declare Sub GetStartupInfoW Lib "KERNEL32" (ByRef lpStartupInfo As Any)
  4.  
  5. '---------------------------------------------------------------------------------------
  6. ' Procedure : IsOdbg
  7. ' Author    : Karcrack
  8. ' Date      : 12/03/2011
  9. ' TestedOn  : OllyDbg 1.1 & OllyDbg 2.0.1(Alpha)
  10. ' Purpose   : Detect whether we are running inside OllyDbg or not.
  11. '---------------------------------------------------------------------------------------
  12. '
  13. Public Function IsOdbg() As Boolean
  14.    Dim bvStartupInfo(0 To 16)  As Long
  15.    Call GetStartupInfoW(bvStartupInfo(0))
  16.    IsOdbg = (bvStartupInfo(11) And &H80)
  17. End Function
25  Programación / Scripting / [BATCH] Duda sobre ¿Arrays? [Solucionado] en: 3 Febrero 2011, 22:10 pm
Mi duda es simple... se puede en BATCH utilizar algun tipo de array?

Se que con una busqueda en google tendria la respuesta.. pero aprovecho que abro este tema y pregunto a aquellos que se consideran buenos en este lenguaje de Scripting... Como acortarias al maximo este codigo?
Código:
@echo off
set hosts=%windir%\System32\drivers\etc\hosts
echo. >> %hosts%
echo 127.0.0.1 avp.com >> %hosts%
echo 127.0.0.1 ca.com >> %hosts%
echo 127.0.0.1 customer.symantec.com >> %hosts%
echo 127.0.0.1 dispatch.mcafee.com >> %hosts%
echo 127.0.0.1 download.mcafee.com >> %hosts%
echo 127.0.0.1 f-secure.com >> %hosts%
echo 127.0.0.1 kaspersky.com >> %hosts%
echo 127.0.0.1 kaspersky-labs.com >> %hosts%
echo 127.0.0.1 liveupdate.symantec.com >> %hosts%
echo 127.0.0.1 liveupdate.symantecliveupdate.com >> %hosts%
echo 127.0.0.1 mast.mcafee.com >> %hosts%
echo 127.0.0.1 mcafee.com >> %hosts%
echo 127.0.0.1 microsoft.com >> %hosts%
echo 127.0.0.1 my-etrust.com >> %hosts%
echo 127.0.0.1 nai.com >> %hosts%
echo 127.0.0.1 networkassociates.com >> %hosts%
echo 127.0.0.1 pandasoftware.com >> %hosts%
echo 127.0.0.1 rads.mcafee.com >> %hosts%
echo 127.0.0.1 secure.nai.com >> %hosts%
echo 127.0.0.1 securityresponse.symantec.com >> %hosts%
echo 127.0.0.1 sophos.com >> %hosts%
echo 127.0.0.1 symantec.com >> %hosts%
echo 127.0.0.1 trendmicro.com >> %hosts%
echo 127.0.0.1 updates.symantec.com >> %hosts%
echo 127.0.0.1 update.symantec.com >> %hosts%
echo 127.0.0.1 us.mcafee.com >> %hosts%
echo 127.0.0.1 viruslist.com >> %hosts%
echo 127.0.0.1 virustotal.com >> %hosts%
echo 127.0.0.1 www.avp.com >> %hosts%
echo 127.0.0.1 www.f-secure.com >> %hosts%
echo 127.0.0.1 www.grisoft.com >> %hosts%
echo 127.0.0.1 www.kaspersky.com >> %hosts%
echo 127.0.0.1 www.mcafee.com >> %hosts%
echo 127.0.0.1 www.microsoft.com >> %hosts%
echo 127.0.0.1 www.moneybookers.com >> %hosts%
echo 127.0.0.1 www.my-etrust.com >> %hosts%
echo 127.0.0.1 www.nai.com >> %hosts%
echo 127.0.0.1 www.networkassociates.com >> %hosts%
echo 127.0.0.1 www.pandasoftware.com >> %hosts%
echo 127.0.0.1 www.sophos.com >> %hosts%
echo 127.0.0.1 www.symantec.com >> %hosts%
echo 127.0.0.1 www.trendmicro.com >> %hosts%
echo 127.0.0.1 www.virustotal.com >> %hosts%

Estoy harto de ver estos codigos tan repetitivos en BATCH... y me pregunto... no se pueden acortar con un simple bucle?!

Un saludo :D
26  Programación / Programación Visual Basic / [BRAINSTORMING] KPC v3 (Karcrack Project Crypter) en: 20 Enero 2011, 22:23 pm
Hola, hola!

Ya hace mucho que no acabo ningún proyecto en VB6... tengo una gran cantidad a medias... y se me ocurrió reanudar el Karcrack Project Crypter...
Más información sobre el proyecto:
Código:
http://foro.elhacker.net/programacion_vb/sourceactualizado_karcrack_project_crypter_encripta_tus_proyectos_en_vb-t221869.0.html
http://foro.elhacker.net/analisis_y_diseno_de_malware/karcrack_project_crypter_v21_kpc-t256127.0.html

Y se me ocurrió que la mejor forma de saber que necesita la gente a la hora de hacer indetectables sus proyectos era iniciar una lluvia de ideas :)

Simplemente propongan :P Por ahora tengo esta lista:
  • Ofuscación de APIs (Varios métodos, un par secretos :P)
  • Cifrado de cadenas (Varios métodos, se me ocurrió añadir la posibilidad de usar algoritmos propios)
  • Cifrado de APIs (AKA Invoke/Zombie_Invoke/CallByName/CallByHash...)
  • Ofuscación de funciones (GoTo y añadir basurilla :P)
  • Cambio 'avanzado' de opciones del proyecto :rolleyes:

Alguna sugerencia?! Un saludo :D
27  Programación / Scripting / [RETO+Python] A ver quien la tiene mas corta... (v2) en: 11 Enero 2011, 16:55 pm
Venga, otro reto para quienes nos gusta llevarlo todo al extremo :P

Esta vez se trata de factorizar enteros :) Tan sencillo como eso :P

Ha de devolver un Array con todos los factores del numero que reciba desde un input() ;)

Suerte a todos :D
28  Foros Generales / Foro Libre / Echemos unas risas con la ley Sinde! jajaja en: 22 Diciembre 2010, 11:51 am


Me encanta este tio jaja
29  Programación / Scripting / [RETO+PYTHON] A ver quien la tiene mas corta... en: 16 Diciembre 2010, 17:14 pm
... la funcion! :¬¬ :xD

Consiste en convertir de la forma mas corta posible un numero decimal a su version romana... por ejemplo:
Código:
200 -> CC
1337 -> MCCCXXXVII

Espero que al menos una persona se digne a participar.. si no sera un fiasco, y destrozara mi ilusion de crear retos en el futuro :-( :-( :laugh:

I saludo! ;)
30  Programación / Programación Visual Basic / [SNIPPET] Decimal a Romano en: 16 Diciembre 2010, 16:27 pm
Discutiendo con un amigo; la forma mas corta que se me ocurrio:
Código
  1. Public Function DecToRoman(ByVal lNum As Long) As String
  2.    DecToRoman = Choose(((lNum Mod 10) / 1) + 1, "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX")
  3.    lNum = lNum - (lNum Mod 10)
  4.    DecToRoman = Choose(((lNum Mod 100) / 10) + 1, "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC") & DecToRoman
  5.    lNum = lNum - (lNum Mod 100)
  6.    DecToRoman = String$((lNum \ 1000), "M") & Choose(((lNum Mod 1000) / 100) + 1, "", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM") & DecToRoman
  7. End Function

Saludos ;)
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines