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

 

 


Tema destacado: Recopilación Tutoriales y Manuales Hacking, Seguridad, Privacidad, Hardware, etc


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 74
71  Programación / Programación Visual Basic / Re: Cambiar Bits de otro proceso. en: 13 Diciembre 2011, 00:03 am
Hola ya me estoy reorientando, bien, si la idea es cambiar un array de Bytes por otro de un ejecutable externo, la idea era hacer un cheat par aun juego on line el cual creo que ya me vanearon asi que me lo meto en el ....
pero en fin volviendo al tema Gracias a lo que me paso Seba me puse a investigar un poco y me tope con el problema de ReadProcessMemory el cual desdusco que no me leia nada porque no se puede empezar a leer desde el bite 0

Código:
ReadProcessMemory ProcHandle, ByVal 0&, ByVal sBuffer, Len(sBuffer), BytesRead

hay una parte de la memoria que no se puede leer, lo cual se puede saber con VirtualQueryEx ((mbi.lType = MEM_PRIVATE) And (mbi.State = MEM_COMMIT))

como no se la dirección exacta en la memoria donde esta el array de bits que debo reemplazar tengo que buscar el array que tengo dentro del proceso, una vez encontrada la posición meter el nuevo array.

Saludos.



72  Programación / Programación Visual Basic / Cambiar Bits de otro proceso. en: 11 Diciembre 2011, 19:56 pm
Hola, se que esto ya se hablo en el foro, pero no recuerdo bien con que apis buscar, quiero modificar cierta parte de el array de bits de un proceso.
Se agradecen aportes.
73  Programación / Programación Visual Basic / Re: Acerca de los tipos Enum en: 20 Septiembre 2011, 11:33 am
prácticamente son un grupo de constantes, las ventajas de esto es que si declaras en el ide una variable como esa enumeración al escribir esa variable = te salta un menú con la enumeración.
74  Programación / Programación Visual Basic / Re: Píxeles y Bucle For en: 19 Septiembre 2011, 21:19 pm
Hola, si es masomenos lo que entiendo esta es la forma mas rapida

Código
  1. Option Explicit
  2. 'Autor: Leandro Ascierto
  3. 'Web: http://leandroascierto.com/blog/
  4. Private Declare Function CreateDIBSection Lib "gdi32" (ByVal hDC As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long
  5. Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
  6. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
  7. Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
  8. Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
  9. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  10. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  11. Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
  12. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
  13. Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Ptr() As Any) As Long
  14. Private Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal lOleColor As Long, ByVal lHPalette As Long, ByVal lColorRef As Long) As Long
  15. Private Declare Function SetCursorPos Lib "user32.dll" (ByVal x As Long, ByVal y As Long) As Long
  16.  
  17. Private Type RGBQUAD
  18.    rgbBlue As Byte
  19.    rgbGreen As Byte
  20.    rgbRed As Byte
  21.    rgbReserved As Byte
  22. End Type
  23.  
  24. Private Type BITMAPINFOHEADER
  25.    biSize As Long
  26.    biWidth As Long
  27.    biHeight As Long
  28.    biPlanes As Integer
  29.    biBitCount As Integer
  30.    biCompression As Long
  31.    biSizeImage As Long
  32.    biXPelsPerMeter As Long
  33.    biYPelsPerMeter As Long
  34.    biClrUsed As Long
  35.    biClrImportant As Long
  36. End Type
  37.  
  38. Private Type BITMAPINFO
  39.    bmiHeader As BITMAPINFOHEADER
  40.    bmiColors As RGBQUAD
  41. End Type
  42.  
  43. Private Type SAFEARRAYBOUND
  44.    cElements As Long
  45.    lLbound As Long
  46. End Type
  47.  
  48. Private Type SAFEARRAY2D
  49.    cDims As Integer
  50.    fFeatures As Integer
  51.    cbElements As Long
  52.    cLocks As Long
  53.    pvData As Long
  54.    Bounds(0 To 1) As SAFEARRAYBOUND
  55. End Type
  56.  
  57. Private Type POINTAPI
  58.    x As Long
  59.    y As Long
  60. End Type
  61.  
  62. Private Const DIB_RGB_COLORS = 0
  63. Private Const BI_RGB = 0&
  64.  
  65.  
  66. Private Function FindColorInScreen(ByVal oColor As OLE_COLOR, ByRef PT() As POINTAPI) As Long
  67.    Dim ScreenDC As Long
  68.    Dim TmpDC As Long
  69.    Dim hBmp As Long
  70.    Dim OldBmp As Long
  71.    Dim Addrs As Long
  72.    Dim x As Long
  73.    Dim y As Long
  74.    Dim lpBits() As Long
  75.    Dim BI As BITMAPINFO
  76.    Dim SA As SAFEARRAY2D
  77.    Dim W As Long, H As Long
  78.    Dim lColor As Long
  79.  
  80.    W = Screen.Width / Screen.TwipsPerPixelX
  81.    H = Screen.Height / Screen.TwipsPerPixelY
  82.  
  83.    With BI.bmiHeader
  84.        .biSize = Len(BI.bmiHeader)
  85.        .biWidth = W
  86.        .biHeight = H
  87.        .biPlanes = 1
  88.        .biBitCount = 32
  89.        .biCompression = BI_RGB
  90.        .biSizeImage = AlignScan(.biWidth, .biBitCount) * .biHeight
  91.    End With
  92.  
  93.    ScreenDC = GetDC(0)
  94.    TmpDC = CreateCompatibleDC(ScreenDC)
  95.    hBmp = CreateDIBSection(ScreenDC, BI, DIB_RGB_COLORS, Addrs, 0, 0)
  96.  
  97.    OldBmp = SelectObject(TmpDC, hBmp)
  98.  
  99.    Call BitBlt(TmpDC, 0, 0, W, H, ScreenDC, 0, 0, vbSrcCopy)
  100.  
  101.    Call ReleaseDC(0&, ScreenDC)
  102.  
  103.    With SA
  104.        .cbElements = 4
  105.        .cDims = 2
  106.        .Bounds(0).lLbound = 0
  107.        .Bounds(0).cElements = H
  108.        .Bounds(1).lLbound = 0
  109.        .Bounds(1).cElements = (BI.bmiHeader.biSizeImage \ .Bounds(0).cElements) \ 4
  110.        .pvData = Addrs
  111.    End With
  112.  
  113.    CopyMemory ByVal VarPtrArray(lpBits), VarPtr(SA), 4
  114.  
  115.    ReDim PT(0)
  116.  
  117.    lColor = ConvertColor(oColor)
  118.  
  119.    For y = H - 1 To 0 Step -1
  120.        For x = 0 To W - 1
  121.            If lpBits(x, y) = lColor Then
  122.                ReDim Preserve PT(FindColorInScreen)
  123.                With PT(FindColorInScreen)
  124.                    .x = x
  125.                    .y = H - y
  126.                End With
  127.                FindColorInScreen = FindColorInScreen + 1
  128.            End If
  129.        Next
  130.    Next
  131.  
  132.    CopyMemory ByVal VarPtrArray(lpBits), 0&, 4
  133.    Call DeleteObject(SelectObject(TmpDC, OldBmp))
  134.    Call DeleteDC(TmpDC)
  135. End Function
  136.  
  137. Private Function AlignScan(ByVal inWidth As Long, ByVal inDepth As Integer) As Long
  138.    AlignScan = (((inWidth * inDepth) + &H1F) And Not &H1F&) \ &H8
  139. End Function
  140.  
  141. Private Function ConvertColor(oColor As OLE_COLOR) As Long
  142.    Dim RGBA(0 To 3) As Byte
  143.    Dim BGRA(0 To 3) As Byte
  144.    OleTranslateColor oColor, 0, VarPtr(RGBA(0))
  145.    BGRA(0) = RGBA(2)
  146.    BGRA(1) = RGBA(1)
  147.    BGRA(2) = RGBA(0)
  148.    BGRA(3) = &HFF
  149.    CopyMemory ConvertColor, BGRA(0), 4&
  150. End Function
  151.  
  152. Private Sub Form_Load()
  153.    Dim lCount As Long
  154.    Dim PT() As POINTAPI
  155.    Me.AutoRedraw = True
  156.    lCount = FindColorInScreen(vbBlue, PT)
  157.    If lCount > 0 Then
  158.        SetCursorPos PT(0).x, PT(0).y
  159.        Dim i As Long
  160.        For i = 0 To lCount - 1
  161.            Debug.Print PT(i).x, PT(i).y
  162.        Next
  163.    End If
  164. End Sub
  165.  
75  Programación / Programación Visual Basic / Re: obtener longitud de una cadena sin LEN en: 7 Septiembre 2011, 11:37 am
Hola otra opcion con apis


Código:
Option Explicit
Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
Private Sub Form_Load()
    Dim s As String
    s = "Hola mundo"
    MsgBox lstrlenW(StrPtr(s))
End Sub

EDIT:  ahora que recuerdo si dentro de la cadena tenes un Nullchar chr(0) solo te cuenta hasta esa posición
76  Programación / Programación Visual Basic / puntero de una funcion con dos parametros. en: 4 Septiembre 2011, 20:47 pm
Hola, estoy intentando obtener el puntero de una funcion dentro de una clase tal como se habló dentro de este post, pero mi problema es que la funcion no tiene cuatro paramentros sino dos y cuando intento llamar a la funcion llega a funcionar pero inmediatamente  revienta el vb bien, no se como hay que modificar el ASM para indicar que la funcion tiene dos long como parametro.

esto es lo que estoy haciendo, intento disparar el callback de una webcam dentro de un modulo clase

Código:
Option Explicit
 
Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (ByVal lpszWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, ByVal hWndParent As Long, ByVal nID As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Const WM_USER                       As Long = &H400
Private Const WM_CAP_START                  As Long = WM_USER
Private Const WM_CAP_SET_CALLBACK_FRAME     As Long = WM_CAP_START + 5
Private Const WM_CAP_DRIVER_CONNECT         As Long = WM_CAP_START + 10
Private Const WM_CAP_DRIVER_DISCONNECT      As Long = WM_CAP_START + 11
Private Const WM_CAP_GET_VIDEOFORMAT        As Long = WM_CAP_START + 44
Private Const WM_CAP_GRAB_FRAME             As Long = WM_CAP_START + 60
 
Private Type VIDEOHDR
    lpData          As Long
    dwBufferLength  As Long
    dwBytesUsed     As Long
    dwTimeCaptured  As Long
    dwUser          As Long
    dwFlags         As Long
    dwReserved(3)   As Long
End Type

Private bvASM(40) As Byte
Private hwndCap As Long


Public Function FrameCallBack(ByVal lWnd As Long, ByVal lpVHdr As Long) As Long

    Debug.Print "FUNCIONA!"

End Function

Public Function Capture()
    Call SendMessage(hwndCap, WM_CAP_GRAB_FRAME, ByVal 0&, ByVal 0&)
End Function

Public Function CreateCaptureWindow() As Boolean

    hwndCap = capCreateCaptureWindowA(vbNullString, 0&, 0&, 0&, 0&, 0&, 0&, 0&)

    If hwndCap Then
        Call SendMessage(hwndCap, WM_CAP_SET_CALLBACK_FRAME, 0, GetAdressMe(Me))
        CreateCaptureWindow = True
    End If
End Function

Function capGetVideoFormat(ByVal hCapWnd As Long, ByVal CapFormatSize As Long, ByVal BmpFormat As Long) As Long
   capGetVideoFormat = SendMessage(hCapWnd, WM_CAP_GET_VIDEOFORMAT, CapFormatSize, BmpFormat)
End Function

Public Function DestroyCaptureWindow() As Boolean
    If hwndCap Then DestroyCaptureWindow = DestroyWindow(hwndCap): hwndCap = 0
End Function

Public Function ConnectDriver() As Boolean
    If hwndCap Then ConnectDriver = SendMessage(hwndCap, WM_CAP_DRIVER_CONNECT, 0&, 0&)
End Function

Public Function DisconnectDriver() As Boolean
    If hwndCap Then
        Call SendMessage(hwndCap, WM_CAP_SET_CALLBACK_FRAME, 0&, vbNull)
        DisconnectDriver = SendMessage(hwndCap, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
    End If
End Function


Private Function GetAdressMe(Obj As Object) As Long
    Dim WindowProcAddress As Long
    Dim pObj As Long
    Dim pVar As Long
 
    Dim i As Long
 
    For i = 0 To 40
        bvASM(i) = Choose(i + 1, &H55, &H8B, &HEC, &H83, &HC4, &HFC, &H8D, &H45, &HFC, &H50, &HFF, &H75, &H14, _
                                 &HFF, &H75, &H10, &HFF, &H75, &HC, &HFF, &H75, &H8, &H68, &H0, &H0, &H0, &H0, _
                                 &HB8, &H0, &H0, &H0, &H0, &HFF, &HD0, &H8B, &H45, &HFC, &HC9, &HC2, &H10, &H0)
    Next i
 
    pObj = ObjPtr(Obj)
 
    Call CopyMemory(pVar, ByVal pObj, 4)
    Call CopyMemory(WindowProcAddress, ByVal (pVar + 28), 4)
 
    Call LongToByte(pObj, bvASM, 23)
    Call LongToByte(WindowProcAddress, bvASM, 28)

    GetAdressMe = VarPtr(bvASM(0))
End Function
 

Private Sub LongToByte(ByVal lLong As Long, ByRef bReturn() As Byte, Optional i As Integer = 0)
    bReturn(i) = lLong And &HFF
    bReturn(i + 1) = (lLong And 65280) / &H100
    bReturn(i + 2) = (lLong And &HFF0000) / &H10000
    bReturn(i + 3) = ((lLong And &HFF000000) \ &H1000000) And &HFF
End Sub
 



en el formulario con un boton
Código:
Option Explicit
Dim C1 As Class1

Private Sub Command1_Click()
    C1.Capture
End Sub

Private Sub Form_Load()
    Set C1 = New Class1
    C1.CreateCaptureWindow
    C1.ConnectDriver
End Sub

Private Sub Form_Unload(Cancel As Integer)
    C1.DisconnectDriver
    C1.DestroyCaptureWindow
    Set C1 = Nothing
End Sub
77  Programación / Programación Visual Basic / Re: [RETO] Reemplazo de Funcion IsNumeric en: 11 Agosto 2011, 04:48 am
Hola, esta solo implementa una forma de comprobar el tipo de variable, pero al final utiliza el error para comprovar
Código:
Private Function IsNumeric_LeandroA(Expression) As Boolean
    Select Case VarType(Expression)
        Case vbBoolean, vbByte, vbInteger, vbLong, vbCurrency, vbDecimal, vbDouble, vbNull, vbEmpty, vbError
            IsNumeric_LeandroA = True
        Case vbArray, vbDataObject, vbDate, vbObject, vbUserDefinedType
            IsNumeric_LeandroA = False
        Case vbString
            If Val(Expression) <> 0 Then
                IsNumeric_LeandroA = True
            Else
                On Error Resume Next
                IsNumeric_LeandroA = Abs(Expression) + 1
            End If
    End Select
End Function

lo unico que gana en velocidad es si el parametro no fue definido como string.

Código:
 IsNumeric_LeandroA(85.54778)
 IsNumeric_LeandroA(-85.54778)
 IsNumeric_LeandroA(8554778)
 IsNumeric_LeandroA(me)
78  Programación / Programación Visual Basic / Re: No logro encontrar handle a SysListView32 de taskmanager en: 9 Julio 2011, 03:45 am
i = FindWindowEx(lparam, 0, "#32770", "")

Hola supuestamente el lparam es l handle de la ventana asi que no devias buscar la ventana  "#32770"  en caso que vos no tengas el lparam utilizas findwindow (no findwindowEx)

syslistivew32= FindWindowEx(lparam, ByVal 0&, "SysListView32", vbNullString)


te dejo un link que te va a sevir
http://www.recursosvisualbasic.com.ar/htm/listado-api/70-ocultar-administrador-tareas.htm
79  Programación / Programación Visual Basic / Re: Pregunta n00b visual basic 6, quitar borde al button en: 23 Junio 2011, 02:44 am
Hola se puede eliminar los bordes utilizando una region

Código
  1. Option Explicit
  2. Private Declare Function CreateRectRgn Lib "gdi32.dll" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
  3. Private Declare Function SetWindowRgn Lib "user32.dll" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
  4. Private Declare Function GetClientRect Lib "user32.dll" (ByVal hwnd As Long, ByRef lpRect As RECT) As Long
  5. Private Type RECT
  6.    Left As Long
  7.    Top As Long
  8.    Right As Long
  9.    Bottom As Long
  10. End Type
  11.  
  12. Private Sub Form_Load()
  13.    DeleteCmdBorder Command1.hwnd
  14. End Sub
  15.  
  16.  
  17. Private Sub DeleteCmdBorder(ByVal hwnd As Long)
  18.    Dim Rec As RECT
  19.    Dim hRgn As Long
  20.    GetClientRect hwnd, Rec
  21.    hRgn = CreateRectRgn(3, 3, Rec.Right - 3, Rec.Bottom - 3)
  22.    SetWindowRgn hwnd, hRgn, True
  23. End Sub
  24.  
80  Programación / Programación Visual Basic / Re: Problemas para leer un RSS (Microsoft.XMLDOM) en: 9 Junio 2011, 23:36 pm
Buena data seba, de todas formas la forma el de raul es una alternativa por si falla la primera, no es solo un rss de taringa sino es para cualquier rss de cualquier pagina.

SAludos.
Páginas: 1 2 3 4 5 6 7 [8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 74
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines