четверг, 21 марта 2013 г.

Process Explorer Project




Imports System.Runtime.InteropServices
Public Class Form1
    Dim WithEvents pr As Process
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each Process In System.Diagnostics.Process.GetProcesses() ' Получаем Все процессы в LB
            ListBox1.Items.Add(Process.ProcessName)
        Next
    End Sub
    Private Sub TaskHook()
        pr = Process.GetProcessesByName(ListBox1.SelectedItem)(0) ' Отлавливаем завершение процесса
        pr.EnableRaisingEvents = True
    End Sub
    Private Sub ProcEx() Handles pr.Exited
        MsgBox("Process Closed")
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        ListBox1.SelectedItems.Clear()
        For i As Integer = 0 To ListBox1.Items.Count - 1
            If ListBox1.Items(i).ToString().Contains(TextBox1.Text) Then ' Исчем процесс в списке
                ListBox1.SetSelected(i, True)
            End If
        Next
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            TaskHook()
            Dim классскрина As New СкриншотОкнаПоЗаголовку
            Dim process1 As Process = Process.GetProcessesByName(ListBox1.SelectedItem)(0)
            Dim title As String = process1.MainWindowTitle()
            Label1.Text = "H_WT :" & title.ToString
            PictureBox1.Image = классскрина.скрин_отдельного_окна(title)
            'Label2.Text = process1.MainModule.FileVersionInfo.ProductName
            Label3.Text = process1.MainModule.FileVersionInfo.CompanyName
            Label4.Text = process1.MainModule.FileVersionInfo.ProductVersion
            Label5.Text = process1.MainModule.FileVersionInfo.FileDescription
        Catch ex As Exception
            Label2.Text = "none"
            Label3.Text = "none"
            Label4.Text = "none"
            Label5.Text = "none"
        End Try

    End Sub

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub
End Class

Public Class СкриншотОкнаПоЗаголовку
     _
    Private Shared Function FindWindow( _
      ByVal lpClassName As String, _
      ByVal lpWindowName As String) As IntPtr
    End Function
    Public Shared Function FindWindow1(ByVal windowName As String, ByVal wait As Boolean) As Integer
        Dim hWnd As Integer = FindWindow(Nothing, windowName)
        While wait AndAlso hWnd = 0
            System.Threading.Thread.Sleep(500)
            hWnd = FindWindow(Nothing, windowName)
        End While
        Return hWnd
    End Function
    Function скрин_отдельного_окна(ByVal заголовок_окна As String) As Image
        Return CaptureWindow(FindWindow1(заголовок_окна, False))
    End Function
    Public Shared Function CaptureWindow(ByVal WindowHandle As IntPtr) As Image

        Dim windowRect As New User32.RECT()
        User32.GetWindowRect(WindowHandle, windowRect)
        Dim width As Integer = windowRect.right - windowRect.left + 1
        Dim height As Integer = windowRect.bottom - windowRect.top + 1

        User32.SetWindowPos(WindowHandle, CType(User32.HWND_TOPMOST, System.IntPtr), 0, 0, 0, 0, _
         User32.SWP_NOMOVE Or User32.SWP_NOSIZE Or User32.SWP_FRAMECHANGED)

        Dim hdcSrc As IntPtr = User32.GetWindowDC(WindowHandle)
        Dim hdcDest As IntPtr = GDI32.CreateCompatibleDC(hdcSrc)

        Dim hBitmap As IntPtr = GDI32.CreateCompatibleBitmap(hdcSrc, width, height)

        Dim hOld As IntPtr = GDI32.SelectObject(hdcDest, hBitmap)

        GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, _
         0, 0, GDI32.SRCCOPY)

        User32.SetWindowPos(WindowHandle, CType(User32.HWND_NOTOPMOST, System.IntPtr), 0, 0, 0, 0, _
         User32.SWP_NOMOVE Or User32.SWP_NOSIZE Or User32.SWP_FRAMECHANGED)

        GDI32.SelectObject(hdcDest, hOld)
        GDI32.DeleteDC(hdcDest)
        User32.ReleaseDC(WindowHandle, hdcSrc)
        Dim img As Image = Image.FromHbitmap(hBitmap)
        GDI32.DeleteObject(hBitmap)
        Return img
    End Function
    Private Class User32

        Public Const SWP_FRAMECHANGED As Integer = &H20
        Public Const SWP_NOMOVE As Integer = &H2
        Public Const SWP_NOSIZE As Integer = &H1
        Public Const SWP_NOZORDER As Integer = &H4
        Public Const HWND_TOPMOST As Integer = -1
        Public Const HWND_NOTOPMOST As Integer = -2

         _
        Public Structure RECT
            Public left As Integer
            Public top As Integer
            Public right As Integer
            Public bottom As Integer
        End Structure

         _
        Public Shared Function GetWindowDC(ByVal hWnd As IntPtr) As IntPtr
        End Function

         _
        Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As IntPtr
        End Function

         _
        Public Shared Function GetWindowRect(ByVal hWnd As IntPtr, ByRef rect As RECT) As IntPtr
        End Function

         _
        Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, _
         ByVal uFlags As UInteger) As  Boolean
        End Function
    End Class
    Private Class GDI32

        Public Const SRCCOPY As Integer = &HCC0020

         _
        Public Shared Function BitBlt(ByVal hObject As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hObjectSource As IntPtr, _
         ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As Integer) As Boolean
        End Function

         _
        Public Shared Function CreateCompatibleBitmap(ByVal hDC As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As IntPtr
        End Function

         _
        Public Shared Function CreateCompatibleDC(ByVal hDC As IntPtr) As IntPtr
        End Function

         _
        Public Shared Function DeleteDC(ByVal hDC As IntPtr) As Boolean
        End Function

         _
        Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Boolean
        End Function

         _
        Public Shared Function SelectObject(ByVal hDC As IntPtr, ByVal hObject As IntPtr) As IntPtr
        End Function
    End Class
End Class

среда, 20 марта 2013 г.

Listbox Tutorial


[Save , Load , Search , Clear]


Public Class Form1

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Add(TextBox1.Text)
    End Sub 'Add

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim ofd As New SaveFileDialog
        With ofd
            .FileName = "*.txt"
            .Title = "Choose a dir..."
            .Filter = "TxtFile(*.txt)|*.txt"
            .InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            If .ShowDialog = Windows.Forms.DialogResult.OK Then
                Try
                    Dim w As New IO.StreamWriter(.FileName)
                    For i = 0 To ListBox1.Items.Count - 1
                        w.WriteLine(ListBox1.Items.Item(i))
                    Next
                    w.Close()
                Catch ex As Exception
                    MsgBox(ex.ToString)
                End Try
            End If
        End With
    End Sub 'Save

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ListBox1.Items.Clear()
    End Sub 'Clear

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        For i As Integer = 0 To ListBox1.Items.Count - 1
            If ListBox1.Items(i).ToString().Contains(TextBox1.Text) Then
                ListBox1.SetSelected(i, True)
            Else
                ListBox1.SelectedItems.Clear()
            End If
        Next
    End Sub 'Search
End Class


среда, 23 января 2013 г.

Adf.ly bot






Source Code [v 0.1]

Imports Microsoft.Win32
Public Class Form1
    Dim proxy As New wvp
    Dim one As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Enabled = False
        helpfunction()
    End Sub
    Sub setproxy()
        If Form2.ListBox1.Items.Count = 0 Then
            If MsgBox(" No proxy countine?", vbYesNo, "") = vbYes Then
                navigate()
            Else
                Button1.Enabled = True
                Return
            End If
        Else
            Try
                If one = Nothing Then
                    Form2.ListBox1.SelectedIndex = 0
                    one = "FUCK !"
                End If
                    Dim items As String = Form2.ListBox1.SelectedItem.ToString
                    Dim ip As String = items.Split(":"c).First
                    Dim port As String = items.Split(":"c).Last
                    Form2.ListBox1.SelectedIndex += 1
                    proxy.SetProxy(ip.ToString, Convert.ToInt16(port.ToString))
                    TextBox4.Text = "Wait for loading proxy..."
                    WaitCounter.Start()
                    Delay(20)
                    navigate()
            Catch ex As Exception
                If MsgBox("Bad proxy. Countine with out it?" + vbNewLine + " [" + ex.ToString + "]", vbYesNo, "") = vbYes Then
                    navigate()
                Else
                    Return
                End If
            End Try
        End If
    End Sub
    Private Function helpfunction()
        setproxy()
    End Function
    Private Function navigate()
        If TextBox1.Text = Nothing Then
            MsgBox("No Link", vbOKOnly, "")
            Button1.Enabled = True

        Else
            WebBrowser1.Navigate(TextBox1.Text)
            TextBox4.Text = "Navigating borwser..."
            WaitCounter.Start()
            Delay(20)
            Try
                WebBrowser1.Document.GetElementById("skip_button").InvokeMember("click")
                TextBox3.Text = TextBox3.Text + 1
                TextBox4.Text = "Skip Button clicked !"
                Delay(10)
                setproxy()
            Catch ex As Exception
                TextBox4.Text = "Excaption!" & ex.ToString
                TextBox5.Text = +1
                Delay(10)
                setproxy()
            End Try
        End If
    End Function
    Private Sub Wait_tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WaitCounter.Tick
        TextBox2.Text = TextBox2.Text + 1

        TextBox1.Enabled = False
        Button1.Enabled = False

        Button3.Enabled = False
        Button4.Enabled = False
        Button5.Enabled = False
        If TextBox2.Text > 30 Then
            WaitCounter.Stop()

            TextBox1.Enabled = True
            Button1.Enabled = True
            Button3.Enabled = True
            Button4.Enabled = True
            Button5.Enabled = True
            TextBox2.Text = 0
        End If
    End Sub
    ' -------> ------> ------> ' Not used functions !
    Sub Delay(ByVal dblSecs As Double)
        Const OneSec As Double = 1.0# / (1440.0# * 60.0#)
        Dim dblWaitTil As Date
        Now.AddSeconds(OneSec)
        dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs)
        Do Until Now > dblWaitTil
            Application.DoEvents() ' Allow windows messages to be processed
        Loop
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Form2.Show()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        WaitCounter.Start()
        Delay(20)
        proxy.DisableProxy()
        WebBrowser1.Navigate("http://www.ipaddrs.com/")
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL inetcpl.cpl")
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Application.Restart()
    End Sub
End Class
REM x M4TPAC 
Public Class wvp
    Sub DisableProxy()
        Dim regKey As RegistryKey
        Try
            regKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", RegistryKeyPermissionCheck.ReadWriteSubTree)
            regKey.SetValue("ProxyEnable", False, RegistryValueKind.DWord)
            regKey.Close()

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
    Public Sub SetProxy(ByVal ServerName As String, ByVal port As Integer)
        Dim regkey1 As RegistryKey
        regkey1 = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", RegistryKeyPermissionCheck.ReadWriteSubTree)
        regkey1.SetValue("ProxyServer", ServerName + ":" + port.ToString(), RegistryValueKind.Unknown)
        regkey1.SetValue("ProxyEnable", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryValueKind.DWord)
        regkey1.Close()
    End Sub
End Class

Download Project !


четверг, 6 декабря 2012 г.

IconChanger



Icon Changer



Public Class IconInjector
         _
        Private Class NativeMethods
             _
            Public Shared Function BeginUpdateResource( _
            ByVal fileName As String, _
             ByVal deleteExistingResources As Boolean) As IntPtr
            End Function
             _
            Public Shared Function UpdateResource( _
            ByVal hUpdate As IntPtr, _
            ByVal type As IntPtr, _
            ByVal name As IntPtr, _
            ByVal language As Short, _
             _
            ByVal data() As Byte, _
            ByVal dataSize As Integer) As  Boolean
            End Function
             _
            Public Shared Function EndUpdateResource( _
            ByVal hUpdate As IntPtr, _
             ByVal discard As Boolean) As  Boolean
            End Function
        End Class
         _
        Private Structure ICONDIR
            Public Reserved As UShort
            Public Type As UShort
            Public Count As UShort
            ' The native structure has an array of ICONDIRENTRYs as a final field.
        End Structure
         _
        Private Structure ICONDIRENTRY
            Public Width As Byte            ' Width, in pixels, of the image
            Public Height As Byte           ' Height, in pixels, of the image
            Public ColorCount As Byte       ' Number of colors in image (0 if >=8bpp)
            Public Reserved As Byte         ' Reserved ( must be 0)
            Public Planes As UShort         ' Color Planes
            Public BitCount As UShort       ' Bits per pixel
            Public BytesInRes As Integer   ' Length in bytes of the pixel data
            Public ImageOffset As Integer  ' Offset in the file where the pixel data starts.
        End Structure
         _
        Private Structure BITMAPINFOHEADER
            Public Size As UInteger
            Public Width As Integer
            Public Height As Integer
            Public Planes As UShort
            Public BitCount As UShort
            Public Compression As UInteger
            Public SizeImage As UInteger
            Public XPelsPerMeter As Integer
            Public YPelsPerMeter As Integer
            Public ClrUsed As UInteger
            Public ClrImportant As UInteger
        End Structure
         _
        Private Structure GRPICONDIRENTRY
            Public Width As Byte
            Public Height As Byte
            Public ColorCount As Byte
            Public Reserved As Byte
            Public Planes As UShort
            Public BitCount As UShort
            Public BytesInRes As Integer
            Public ID As UShort
        End Structure
        Public Shared Sub InjectIcon(ByVal exeFileName As String, ByVal iconFileName As String)
            InjectIcon(exeFileName, iconFileName, 1, 1)
        End Sub
        Public Shared Sub InjectIcon(ByVal exeFileName As String, ByVal iconFileName As String, ByVal iconGroupID As UInteger, ByVal iconBaseID As UInteger)
            Const RT_ICON = 3UI
            Const RT_GROUP_ICON = 14UI
            Dim iconFile As IconFile = iconFile.FromFile(iconFileName)
            Dim hUpdate = NativeMethods.BeginUpdateResource(exeFileName, False)
            Dim data = iconFile.CreateIconGroupData(iconBaseID)
            NativeMethods.UpdateResource(hUpdate, New IntPtr(RT_GROUP_ICON), New IntPtr(iconGroupID), 0, data, data.Length)
            For i = 0 To iconFile.ImageCount - 1
                Dim image = iconFile.ImageData(i)
                NativeMethods.UpdateResource(hUpdate, New IntPtr(RT_ICON), New IntPtr(iconBaseID + i), 0, image, image.Length)
            Next
            NativeMethods.EndUpdateResource(hUpdate, False)
        End Sub
        Private Class IconFile
            Private iconDir As New ICONDIR
            Private iconEntry() As ICONDIRENTRY
            Private iconImage()() As Byte
            Public ReadOnly Property ImageCount As Integer
                Get
                    Return iconDir.Count
                End Get
            End Property
            Public ReadOnly Property ImageData(ByVal index As Integer) As Byte()
                Get
                    Return iconImage(index)
                End Get
            End Property
            Private Sub New()
            End Sub
            Public Shared Function FromFile(ByVal filename As String) As IconFile
                Dim instance As New IconFile
                Dim fileBytes() As Byte = IO.File.ReadAllBytes(filename)
                Dim pinnedBytes = GCHandle.Alloc(fileBytes, GCHandleType.Pinned)
                instance.iconDir = DirectCast(Marshal.PtrToStructure(pinnedBytes.AddrOfPinnedObject, GetType(ICONDIR)), ICONDIR)
                instance.iconEntry = New ICONDIRENTRY(instance.iconDir.Count - 1) {}
                instance.iconImage = New Byte(instance.iconDir.Count - 1)() {}
                Dim offset = Marshal.SizeOf(instance.iconDir)
                Dim iconDirEntryType = GetType(ICONDIRENTRY)
                Dim size = Marshal.SizeOf(iconDirEntryType)
                For i = 0 To instance.iconDir.Count - 1
                    ' Grab the structure.
                    Dim entry = DirectCast(Marshal.PtrToStructure(New IntPtr(pinnedBytes.AddrOfPinnedObject.ToInt64 + offset), iconDirEntryType), ICONDIRENTRY)
                    instance.iconEntry(i) = entry
                    ' Grab the associated pixel data.
                    instance.iconImage(i) = New Byte(entry.BytesInRes - 1) {}
                    Buffer.BlockCopy(fileBytes, entry.ImageOffset, instance.iconImage(i), 0, entry.BytesInRes)
                    offset += size
                Next
                pinnedBytes.Free()
                Return instance
            End Function
            Public Function CreateIconGroupData(ByVal iconBaseID As UInteger) As Byte()
                Dim sizeOfIconGroupData As Integer = Marshal.SizeOf(GetType(ICONDIR)) + Marshal.SizeOf(GetType(GRPICONDIRENTRY)) * ImageCount
                Dim data(sizeOfIconGroupData - 1) As Byte
                Dim pinnedData = GCHandle.Alloc(data, GCHandleType.Pinned)
                Marshal.StructureToPtr(iconDir, pinnedData.AddrOfPinnedObject, False)
                Dim offset = Marshal.SizeOf(iconDir)
                For i = 0 To ImageCount - 1
                    Dim grpEntry As New GRPICONDIRENTRY
                    Dim bitmapheader As New BITMAPINFOHEADER
                    Dim pinnedBitmapInfoHeader = GCHandle.Alloc(bitmapheader, GCHandleType.Pinned)
                    Marshal.Copy(ImageData(i), 0, pinnedBitmapInfoHeader.AddrOfPinnedObject, Marshal.SizeOf(GetType(BITMAPINFOHEADER)))
                    pinnedBitmapInfoHeader.Free()
                    grpEntry.Width = iconEntry(i).Width
                    grpEntry.Height = iconEntry(i).Height
                    grpEntry.ColorCount = iconEntry(i).ColorCount
                    grpEntry.Reserved = iconEntry(i).Reserved
                    grpEntry.Planes = bitmapheader.Planes
                    grpEntry.BitCount = bitmapheader.BitCount
                    grpEntry.BytesInRes = iconEntry(i).BytesInRes
                    grpEntry.ID = CType(iconBaseID + i, UShort)
                    Marshal.StructureToPtr(grpEntry, New IntPtr(pinnedData.AddrOfPinnedObject.ToInt64 + offset), False)
                    offset += Marshal.SizeOf(GetType(GRPICONDIRENTRY))
                Next
                pinnedData.Free()
                Return data
            End Function
        End Class
    End Class

\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\
\\\\\\\\\\
\\\\\\\\
\\\\
\\
For Call I.C. Function Use This Command : IconInjector.InjectIcon(Set Here Exe File , Set Here Icon)


среда, 24 октября 2012 г.

Crypting String


MD5 String Crypt

1)

Md5StringCrypt
Public Class Form1

    Private Sub btnEncrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEncrypt.Click
        txtOutput.Text = StringToMD5(txtInput.Text)
    End Sub


    Private Function StringToMD5(ByVal Content As String) As String
        Dim M5 As New Security.Cryptography.MD5CryptoServiceProvider
        Dim ByteString() As Byte = System.Text.Encoding.ASCII.GetBytes(Content)
        ByteString = M5.ComputeHash(ByteString)
        Dim FinalString As String = Nothing
        For Each bt As Byte In ByteString
            FinalString = bt.ToString("x6")
        Next
        Return FinalString
    End Function
End Class

Download Project:

Mediafire

2)

Public Class Form1
    Dim DES As New System.Security.Cryptography.TripleDESCryptoServiceProvider
    Dim Hash As New System.Security.Cryptography.MD5CryptoServiceProvider

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            DES.Key = Hash.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text))
            DES.Mode = Security.Cryptography.CipherMode.ECB
            Dim DESEncrypter As System.Security.Cryptography.ICryptoTransform = DES.CreateEncryptor
            Dim Buffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox2.Text)
            TextBox2.Text = Convert.ToBase64String(DESEncrypter.TransformFinalBlock(Buffer, 0, Buffer.Length))
        Catch ex As Exception
            MessageBox.Show("The following error(s) have occurred: " & ex.Message)
        End Try
    End Sub
End Class