hacks wolfteam 2023 Saltar a contenido hacks wolfteam 2023
Publicado

SOURCE CODE

[ PixelAim ]

Información:

Autor: @Zabb, Eqeza, SensacFa, Jeskqq

Desarrollador: @Zabb & EqeZa

Versión: 0.6

+ Compatibilidad: Visual Studio 2010+

Lenguaje: VB.NET

 

Códigos:

Spoiler

Public Class Form1
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim bmp As New Bitmap(1, 1)
        Using g As Graphics = Graphics.FromImage(bmp)
            g.CopyFromScreen(Windows.Forms.Cursor.Position, New Point(0, 0), New Size(1, 1))
        End Using
        Dim pixel As Drawing.Color = bmp.GetPixel(0, 0)
        Label1.Text$ = bmp.GetPixel(0, 0).ToString
        Dim p As New Point
        p.X = (Me.Width / 2) - (Label1.Width / 2)
        p.Y = Label1.Top
        Label1.Location = p
        PictureBox1.BackColor = pixel
        Me.Invalidate()
    End Sub
End Class

---------------------------------------------------------------------------------------


Code Snippet

Private colorToFind As KnownColor = 4928371

Private Sub b_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b.Click

Threading.Thread.Sleep(1000)

Application.DoEvents()

Dim searchRectangle As New Rectangle(1, 1, 1280, 800)

Dim foundPt As Point = PixelSearch(searchRectangle, colorToFind)

Me.Text = String.Format("Pixel location in bitmap: ({0},{1})", foundPt.X.ToString, foundPt.Y.ToString)

' move mouse and click

Windows.Forms.Cursor.Position = New Point(foundPt.X + searchRectangle.X, foundPt.Y + searchRectangle.Y)

NativeMethods.MouseClick()

End Sub

' returns (-1, -1) if not found

Private Function PixelSearch(ByVal rec As Rectangle, ByVal colorToFind As Integer) As Point

' find the location in the bitmap

Dim x As Integer = -1

Dim y As Integer = -1

' First grab the screen

Using bm As New Bitmap(rec.Width, rec.Height)

' Copy a portion of the screen.

Dim topleft As Point = New Point(rec.X, rec.Y)

Using g As Graphics = Graphics.FromImage(bm)

g.CopyFromScreen(topleft, New Point, rec.Size)

End Using

' lock the bits

Dim bmd As BitmapData = bm.LockBits(New Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)

' copy all pixels out into an integer array.

Dim pixels(bm.Width * bm.Height - 1) As Integer

Marshal.Copy(bmd.Scan0, pixels, 0, pixels.Length)

' find the color

For i As Integer = 0 To pixels.Length - 1

If pixels(i) = colorToFind Then

x = i Mod bm.Width

y = i \ bm.Width

Exit For

End If

Next

' unlock bm

bm.UnlockBits(bmd)

End Using

Return New Point(x, y)

End Function

---------------------------------------------------------------------------------------

 


Code Snippet
Option Strict On
Option Explicit On

Imports System.ComponentModel
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices

Public Class Form1

    Private rand As Random
    Private colorToFind As Integer = &HFFFF0000 ' &HFF all rest are &HFE
    Private WithEvents b As New Button
    Private colorPoint As Point

    Sub New()
        ' This call is required by the Windows Form Designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.                
        b.Location = New Point(10, 10)
        b.Text = "go"
        Me.Controls.Add(b)
        rand = New Random
    End Sub

    ' Create a random colored bitmap, quickly.
    Private Function GetRandomColorBitmap(ByVal size As Size) As Bitmap
        Dim bm As New Bitmap(size.Width, size.Height)
        Dim bmd As BitmapData = bm.LockBits(New Rectangle(New Point, size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)
        Dim colors(size.Width * size.Height - 1) As Integer
        For i As Integer = 0 To colors.Length - 1
            colors(i) = rand.Next(Integer.MinValue, Integer.MaxValue) Or &HFE000000
        Next
        Marshal.Copy(colors, 0, bmd.Scan0, colors.Length)
        bm.UnlockBits(bmd)
        Return bm
    End Function

    ' The point just happens to be on the form, it can also be Off the form...
    Private Sub b_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b.Click
        b.Visible = False
        MessageBox.Show("I'm going to draw 1 pixel on the form with a unique red color, then I'm going to wait for 1 second, then I'm going to draw random mess all over the form, and redraw the pixel on top, then I'm going to move the mouse over the pixel and click.")
        Using g As Graphics = Me.CreateGraphics
            colorPoint = New Point(rand.Next(0, Me.ClientSize.Width), rand.Next(0, Me.ClientSize.Height))
            g.FillRectangle(New SolidBrush(Color.FromArgb(colorToFind)), New Rectangle(colorPoint, New Size(1, 1)))
            g.DrawEllipse(Pens.Black, New Rectangle(colorPoint.X - 10, colorPoint.Y - 10, 20, 20))
        End Using
        Threading.Thread.Sleep(1000)
        Dim backg As Bitmap = GetRandomColorBitmap(Me.ClientSize)
        Using g As Graphics = Graphics.FromImage(backg)
            g.FillRectangle(New SolidBrush(Color.FromArgb(colorToFind)), New Rectangle(colorPoint, New Size(1, 1)))
          End Using
        Me.BackgroundImage = backg
        Application.DoEvents()
        Dim searchRectangle As New Rectangle
        searchRectangle.Location = Me.PointToScreen(New Point) ' top left of client area
        searchRectangle.Size = Me.ClientSize
        Dim foundPt As Point = PixelSearch(searchRectangle, colorToFind)
        Me.Text = String.Format("Pixel location in bitmap: ({0},{1})", foundPt.X.ToString, foundPt.Y.ToString)
        ' move mouse and click
        Cursor.Position = New Point(foundPt.X + searchRectangle.X, foundPt.Y + searchRectangle.Y)
        NativeMethods.MouseClick()
    End Sub

    Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        b.Visible = True
        Dim pt As Point = Me.PointToClient(Cursor.Position)
        MessageBox.Show(String.Format("Point clicked:{0}{1}Color point:{2}", _
                pt.ToString, Environment.NewLine, colorPoint.ToString))
    End Sub

    ' returns (-1, -1) if not found
    Private Function PixelSearch(ByVal rec As Rectangle, ByVal colorToFind As Integer) As Point
        ' Right, there is one pixel on the form in the correct color.
        ' find the location in the bitmap
        Dim x As Integer = -1
        Dim y As Integer = -1
        ' First grab the screen
        Using bm As New Bitmap(rec.Width, rec.Height)
            ' Copy a portion of the screen. 
            Dim topleft As Point = New Point(rec.X, rec.Y)
            Using g As Graphics = Graphics.FromImage(bm)
                g.CopyFromScreen(topleft, New Point, rec.Size)
            End Using
            ' lock the bits
            Dim bmd As BitmapData = bm.LockBits(New Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)
            ' copy all pixels out into an integer array.
            Dim pixels(bm.Width * bm.Height - 1) As Integer
            Marshal.Copy(bmd.Scan0, pixels, 0, pixels.Length)
            ' find the color
            For i As Integer = 0 To pixels.Length - 1
                If pixels(i) = colorToFind Then
                    x = i Mod bm.Width
                    y = i \ bm.Width
                    Exit For
                End If
            Next
            ' unlock bm
            bm.UnlockBits(bmd)
        End Using
        Return New Point(x, y)
    End Function

End Class

Friend Class NativeMethods

    <DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function SendInput( _
ByVal cInputs As Integer, _
ByVal pInputs() As INPUT, _
ByVal cbSize As Integer) As Integer
    End Function

    Private Structure INPUT
        Public dwType As Integer
        Public mi As MOUSEINPUT
    End Structure

    <StructLayout(LayoutKind.Sequential)> _
    Private Structure MOUSEINPUT
        Public dx As Integer
        Public dy As Integer
        Public mouseData As UInteger
        Public dwFlags As UInteger
        Public time As UInteger
        Public dwExtraInfo As IntPtr
    End Structure

    Private Const INPUT_MOUSE As Integer = 0
    Private Const MOUSEEVENTF_LEFTDOWN As Integer = &H2
    Private Const MOUSEEVENTF_LEFTUP As Integer = &H4
    Private Const MOUSEEVENTF_MIDDLEDOWN As Integer = &H20
    Private Const MOUSEEVENTF_MIDDLEUP As Integer = &H40
    Private Const MOUSEEVENTF_MOVE As Integer = &H1
    Private Const MOUSEEVENTF_ABSOLUTE As Integer = &H8000
    Private Const MOUSEEVENTF_RIGHTDOWN As Integer = &H8
    Private Const MOUSEEVENTF_RIGHTUP As Integer = &H10

    ' not accurate!
    Public Shared Sub MoveMouseAndClick(ByVal x As Integer, ByVal y As Integer)
        Dim inputs(2) As INPUT
        For i As Integer = 0 To inputs.Length - 1
            inputs(i).dwType = INPUT_MOUSE
        Next
        inputs(0).mi.dwFlags = MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE
        ' oh, this isn't accurate. I've abandoned it and used Cursor.Position instead.
        inputs(0).mi.dx = Convert.ToInt32(Math.Ceiling(x * 65535 / Screen.PrimaryScreen.Bounds.Width))
        inputs(0).mi.dy = Convert.ToInt32(Math.Ceiling(y * 65535 / Screen.PrimaryScreen.Bounds.Height))
        inputs(1).mi.dwFlags = MOUSEEVENTF_LEFTDOWN
        inputs(2).mi.dwFlags = MOUSEEVENTF_LEFTUP
        Dim cbSize As Integer = Marshal.SizeOf(inputs(0))
        Dim result As Integer = SendInput(inputs.Length, inputs, cbSize)
        If result = 0 Then
            Throw New System.ComponentModel.Win32Exception
        End If
    End Sub

    Public Shared Sub MouseClick()
        Dim inputs(1) As INPUT
        For i As Integer = 0 To inputs.Length - 1
            inputs(i).dwType = INPUT_MOUSE
        Next
        inputs(0).mi.dwFlags = MOUSEEVENTF_LEFTDOWN
        inputs(1).mi.dwFlags = MOUSEEVENTF_LEFTUP
        Dim cbSize As Integer = Marshal.SizeOf(inputs(0))
        Dim result As Integer = SendInput(inputs.Length, inputs, cbSize)
        If result = 0 Then
            Throw New System.ComponentModel.Win32Exception
        End If
    End Sub
End Class

---------------------------------------------------------------------------------------



If Start = True Then
Do Until Stop = True
Try
Pixelsearch1
Mouseclick(pixelsearch1)
Catch
Try
Pixelsearch2
Mouseclick(pixelsearch2)
End Try
End Try
Loop
EndIf

---------------------------------------------------------------------------------------


Code Snippet
Option Strict On
Option Explicit On

Imports System.ComponentModel
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices

Public Class Form1

    Private rand As Random
    Private colorToFind As Integer = &HFFFF0000 ' &HFF all rest are &HFE
    Private WithEvents b As New Button
    Private colorPoint As Point

    Sub New()
        ' This call is required by the Windows Form Designer.
        InitializeComponent()
        ' Add any initialization after the InitializeComponent() call.                
        b.Location = New Point(10, 10)
        b.Text = "go"
        Me.Controls.Add(b)
        rand = New Random
    End Sub

    ' Create a random colored bitmap, quickly.
    Private Function GetRandomColorBitmap(ByVal size As Size) As Bitmap
        Dim bm As New Bitmap(size.Width, size.Height)
        Dim bmd As BitmapData = bm.LockBits(New Rectangle(New Point, size), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)
        Dim colors(size.Width * size.Height - 1) As Integer
        For i As Integer = 0 To colors.Length - 1
            colors(i) = rand.Next(Integer.MinValue, Integer.MaxValue) Or &HFE000000
        Next
        Marshal.Copy(colors, 0, bmd.Scan0, colors.Length)
        bm.UnlockBits(bmd)
        Return bm
    End Function

    ' The point just happens to be on the form, it can also be Off the form...
    Private Sub b_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b.Click
        b.Visible = False
        MessageBox.Show("I'm going to draw 1 pixel on the form with a unique red color, then I'm going to wait for 1 second, then I'm going to draw random mess all over the form, and redraw the pixel on top, then I'm going to move the mouse over the pixel and click.")
        Using g As Graphics = Me.CreateGraphics
            colorPoint = New Point(rand.Next(0, Me.ClientSize.Width), rand.Next(0, Me.ClientSize.Height))
            g.FillRectangle(New SolidBrush(Color.FromArgb(colorToFind)), New Rectangle(colorPoint, New Size(1, 1)))
            g.DrawEllipse(Pens.Black, New Rectangle(colorPoint.X - 10, colorPoint.Y - 10, 20, 20))
        End Using
        Threading.Thread.Sleep(1000)
        Dim backg As Bitmap = GetRandomColorBitmap(Me.ClientSize)
        Using g As Graphics = Graphics.FromImage(backg)
            g.FillRectangle(New SolidBrush(Color.FromArgb(colorToFind)), New Rectangle(colorPoint, New Size(1, 1)))
          End Using
        Me.BackgroundImage = backg
        Application.DoEvents()
        Dim searchRectangle As New Rectangle
        searchRectangle.Location = Me.PointToScreen(New Point) ' top left of client area
        searchRectangle.Size = Me.ClientSize
        Dim foundPt As Point = PixelSearch(searchRectangle, colorToFind)
        Me.Text = String.Format("Pixel location in bitmap: ({0},{1})", foundPt.X.ToString, foundPt.Y.ToString)
        ' move mouse and click
        Cursor.Position = New Point(foundPt.X + searchRectangle.X, foundPt.Y + searchRectangle.Y)
        NativeMethods.MouseClick()
    End Sub

    Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
        b.Visible = True
        Dim pt As Point = Me.PointToClient(Cursor.Position)
        MessageBox.Show(String.Format("Point clicked:{0}{1}Color point:{2}", _
                pt.ToString, Environment.NewLine, colorPoint.ToString))
    End Sub

    ' returns (-1, -1) if not found
    Private Function PixelSearch(ByVal rec As Rectangle, ByVal colorToFind As Integer) As Point
        ' Right, there is one pixel on the form in the correct color.
        ' find the location in the bitmap
        Dim x As Integer = -1
        Dim y As Integer = -1
        ' First grab the screen
        Using bm As New Bitmap(rec.Width, rec.Height)
            ' Copy a portion of the screen. 
            Dim topleft As Point = New Point(rec.X, rec.Y)
            Using g As Graphics = Graphics.FromImage(bm)
                g.CopyFromScreen(topleft, New Point, rec.Size)
            End Using
            ' lock the bits
            Dim bmd As BitmapData = bm.LockBits(New Rectangle(0, 0, bm.Width, bm.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)
            ' copy all pixels out into an integer array.
            Dim pixels(bm.Width * bm.Height - 1) As Integer
            Marshal.Copy(bmd.Scan0, pixels, 0, pixels.Length)
            ' find the color
            For i As Integer = 0 To pixels.Length - 1
                If pixels(i) = colorToFind Then
                    x = i Mod bm.Width
                    y = i \ bm.Width
                    Exit For
                End If
            Next
            ' unlock bm
            bm.UnlockBits(bmd)
        End Using
        Return New Point(x, y)
    End Function

End Class

Friend Class NativeMethods

    <DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function SendInput( _
ByVal cInputs As Integer, _
ByVal pInputs() As INPUT, _
ByVal cbSize As Integer) As Integer
    End Function

    Private Structure INPUT
        Public dwType As Integer
        Public mi As MOUSEINPUT
    End Structure

    <StructLayout(LayoutKind.Sequential)> _
    Private Structure MOUSEINPUT
        Public dx As Integer
        Public dy As Integer
        Public mouseData As UInteger
        Public dwFlags As UInteger
        Public time As UInteger
        Public dwExtraInfo As IntPtr
    End Structure

    Private Const INPUT_MOUSE As Integer = 0
    Private Const MOUSEEVENTF_LEFTDOWN As Integer = &H2
    Private Const MOUSEEVENTF_LEFTUP As Integer = &H4
    Private Const MOUSEEVENTF_MIDDLEDOWN As Integer = &H20
    Private Const MOUSEEVENTF_MIDDLEUP As Integer = &H40
    Private Const MOUSEEVENTF_MOVE As Integer = &H1
    Private Const MOUSEEVENTF_ABSOLUTE As Integer = &H8000
    Private Const MOUSEEVENTF_RIGHTDOWN As Integer = &H8
    Private Const MOUSEEVENTF_RIGHTUP As Integer = &H10

    ' not accurate!
    Public Shared Sub MoveMouseAndClick(ByVal x As Integer, ByVal y As Integer)
        Dim inputs(2) As INPUT
        For i As Integer = 0 To inputs.Length - 1
            inputs(i).dwType = INPUT_MOUSE
        Next
        inputs(0).mi.dwFlags = MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE
        ' oh, this isn't accurate. I've abandoned it and used Cursor.Position instead.
        inputs(0).mi.dx = Convert.ToInt32(Math.Ceiling(x * 65535 / Screen.PrimaryScreen.Bounds.Width))
        inputs(0).mi.dy = Convert.ToInt32(Math.Ceiling(y * 65535 / Screen.PrimaryScreen.Bounds.Height))
        inputs(1).mi.dwFlags = MOUSEEVENTF_LEFTDOWN
        inputs(2).mi.dwFlags = MOUSEEVENTF_LEFTUP
        Dim cbSize As Integer = Marshal.SizeOf(inputs(0))
        Dim result As Integer = SendInput(inputs.Length, inputs, cbSize)
        If result = 0 Then
            Throw New System.ComponentModel.Win32Exception
        End If
    End Sub

    Public Shared Sub MouseClick()
        Dim inputs(1) As INPUT
        For i As Integer = 0 To inputs.Length - 1
            inputs(i).dwType = INPUT_MOUSE
        Next
        inputs(0).mi.dwFlags = MOUSEEVENTF_LEFTDOWN
        inputs(1).mi.dwFlags = MOUSEEVENTF_LEFTUP
        Dim cbSize As Integer = Marshal.SizeOf(inputs(0))
        Dim result As Integer = SendInput(inputs.Length, inputs, cbSize)
        If result = 0 Then
            Throw New System.ComponentModel.Win32Exception
        End If
    End Sub
End Class

No todos los codigos son correctos porque el original lo perdi, así que deje todos los que probamos para que tu mismo apliques el codigo de forma que te sirva.

 

 

Publicaciones recomendadas

No posts to show

Únete a la conversación

Puede publicar ahora y registrarse más tarde. Si tiene una cuenta, iniciar sesión para publicar con su cuenta.
Nota: Tu publicación requerirá la aprobación de un moderador antes de que sea visible.

Invitado
Responder a este tema...

Información importante

Hemos colocado cookies en su dispositivo para ayudar a mejorar este sitio web. Puede ajustar la configuración de sus cookies, de lo contrario asumiremos que está de acuerdo en continuar.

Account

Navigation

Buscar

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.
The popup will be closed in 20 segundos...
SOPORTE