论坛: 黑客进阶 标题: QQ消息群炸机(全源码) 复制本贴地址    
作者: jianphu [jianphu]    论坛用户   登录
全部代码在Windows Server 2003 + Visual Studio.net 2003中运行并通过,作者开始时写的题目为《QQ消息轰炸机》,但编译后发现并不是轰炸,却可以“群炸”,后来通读一遍代码后发现确实是“群炸”机,至于开头中的注释,应该是作者的本意或者是笔误吧,不管怎么说,这些实实在在的代码可以帮助程序设计爱好者更多更好的学习。

'

***************************************
'QQ消息轰炸机源代码(VB.NET)
'wgscd 2005-1-1

'***************************************
Public Class Form1
    Inherits System.Windows.Forms.Form
    Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
    Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
    Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As String) As Int32
    'Private Const WM_PASTE As Int32 = &H302
    Private Const WM_SETTEXT As Int32 = &HC
    Private Const WM_KEYDOWN As Int32 = &H100
    Private Const WM_KEYUP As Int32 = &H101
    Private Const WM_LBUTTONDOWN As Int32 = &H201
    Private Const WM_LBUTTONUP As Int32 = &H202

    'Private Const WM_SHOWWINDOW As Int32 = &H18
    Private Const SW_NORMAL As Int32 = 1
    Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Int32, ByVal nCmdShow As Int32) As Int32
    'Private Declare Function GetLastError Lib "kernel32.dll" () As Int32
    Private Const SW_SHOWNOACTIVATE As Int32 = 4
    Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String) As Int32
    Private Const SW_HIDE As Int32 = 0
    Private Const SW_SHOW As Int32 = 5

    Dim sMess As String
    Dim hwnd, hwnd2, hwnd3, i, iDelay As Int32
    Dim hWndTalk(20), hWndEdit(20), hWndSend(20) As Int32
    Dim MyThread As Threading.Thread
#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。

    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents ButtonRefresh As System.Windows.Forms.Button
    Friend WithEvents ButtonStart As System.Windows.Forms.Button
    Friend WithEvents ButtonStop As System.Windows.Forms.Button
    Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
    Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.ButtonRefresh = New System.Windows.Forms.Button
        Me.ButtonStart = New System.Windows.Forms.Button
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.RadioButton2 = New System.Windows.Forms.RadioButton
        Me.RadioButton1 = New System.Windows.Forms.RadioButton
        Me.ButtonStop = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'ButtonRefresh
        '
        Me.ButtonRefresh.Location = New System.Drawing.Point(16, 80)
        Me.ButtonRefresh.Name = "ButtonRefresh"
        Me.ButtonRefresh.Size = New System.Drawing.Size(56, 24)
        Me.ButtonRefresh.TabIndex = 0
        Me.ButtonRefresh.Text = "刷新"
        '
        'ButtonStart
        '
        Me.ButtonStart.Location = New System.Drawing.Point(16, 116)
        Me.ButtonStart.Name = "ButtonStart"
        Me.ButtonStart.Size = New System.Drawing.Size(56, 24)
        Me.ButtonStart.TabIndex = 1
        Me.ButtonStart.Text = "开始"
        '
        'TextBox1
        '
        Me.TextBox1.AutoSize = False
        Me.TextBox1.Location = New System.Drawing.Point(16, 216)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(256, 88)
        Me.TextBox1.TabIndex = 3
        Me.TextBox1.Text = "/cy 轰炸美国,从你开始. "
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(24, 200)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(91, 17)
        Me.Label1.TabIndex = 4
        Me.Label1.Text = "请输入发送内容"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.ListView1)
        Me.GroupBox1.Controls.Add(Me.RadioButton2)
        Me.GroupBox1.Controls.Add(Me.RadioButton1)
        Me.GroupBox1.Controls.Add(Me.ButtonStop)
        Me.GroupBox1.Controls.Add(Me.ButtonStart)
        Me.GroupBox1.Controls.Add(Me.ButtonRefresh)
        Me.GroupBox1.Location = New System.Drawing.Point(16, 8)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(248, 184)
        Me.GroupBox1.TabIndex = 9
        Me.GroupBox1.TabStop = False
        '
        'ListView1
        '
        Me.ListView1.CheckBoxes = True
        Me.ListView1.Location = New System.Drawing.Point(96, 24)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(144, 152)
        Me.ListView1.TabIndex = 12
        Me.ListView1.View = System.Windows.Forms.View.List
        '
        'RadioButton2
        '
        Me.RadioButton2.Location = New System.Drawing.Point(12, 40)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(88, 24)
        Me.RadioButton2.TabIndex = 1
        Me.RadioButton2.Text = "直到我叫停"
        '
        'RadioButton1
        '
        Me.RadioButton1.Checked = True
        Me.RadioButton1.Location = New System.Drawing.Point(12, 17)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(88, 24)
        Me.RadioButton1.TabIndex = 0
        Me.RadioButton1.TabStop = True
        Me.RadioButton1.Text = "只发一次"
        '
        'ButtonStop
        '
        Me.ButtonStop.Location = New System.Drawing.Point(16, 152)
        Me.ButtonStop.Name = "ButtonStop"
        Me.ButtonStop.Size = New System.Drawing.Size(56, 24)
        Me.ButtonStop.TabIndex = 11
        Me.ButtonStop.Text = "停止"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(96, 312)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(184, 24)
        Me.Label3.TabIndex = 10
        Me.Label3.Text = "---自由奔腾 wgscd----"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.Color.SkyBlue
        Me.ClientSize = New System.Drawing.Size(280, 325)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.GroupBox1)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form1"
        Me.Text = "QQ消息群炸机"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub ButtonRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRefresh.Click
        ListView1.Items.Clear()  '清除元素
        ''''''''''''''''''''''''''''''''''''''''''''''''
        hwnd = 0
        i = 0
        Dim str As String
        While 1
            hwnd = FindWindowEx(0, hwnd, "#32770", vbNullString)
            If hwnd = 0 Then
                Exit While
            Else
                Str = New String(Chr(0), 50)
                GetWindowText(hwnd, Str, 50)
                Str = Str.TrimEnd(Chr(0))
                If Str.StartsWith("与 " And Str.EndsWith(" 聊天中" Then
                    '聊天主窗口hwnd--子窗口hwnd2(发送BUTTON 和 hwnd3 的父窗口)--hwnd3(文本编辑框的父窗口)--文本编辑窗口句柄
                    hWndTalk(i) = hwnd      '聊天主窗口句柄
                    hwnd2 = FindWindowEx(hwnd, 0, "#32770", vbNullString)  '发送按钮 和 文本编辑框 的父窗口
                    '''''''''''''''''''''''''''''''''''''''''''
                    hWndSend(i) = FindWindowEx(hwnd2, 0, vbNullString, "发送(&s)"  '发送BUTTON 句柄
                    '''''''''''''''''''''''''''''''''''''''''''
                    hwnd3 = FindWindowEx(hwnd2, 0, "AfxWnd42", vbNullString)        '文本编辑框的父窗口
                    hWndEdit(i) = FindWindowEx(hwnd3, 0, "RICHEDIT", vbNullString)  '文本编辑框的句柄
                    '''''''''''''''''''''''''''''''''''
                    i += 1
                    Str = Str.Substring(2)
                    Str = Str.Replace(" 聊天中", ""
                    Dim item As Windows.Forms.ListViewItem
                    item = ListView1.Items.Add(Str)
                    item.Checked = True
                    '''''''''''''''''''''''''''''''''''
                End If
            End If
        End While

    End Sub

    Private Sub ButtonStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStop.Click
        If (Not MyThread Is Nothing) Then
            MyThread.Abort()
        End If
        ButtonStart.Enabled = True
    End Sub

    Private Sub ButtonStart_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonStart.Click
        sMess = Me.TextBox1.Text.ToString
        If sMess = "" Then
            MsgBox("请输入发送内容!"
            Exit Sub
        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        '以下求延迟毫秒数
        iDelay = 0
        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).Checked = True Then
                iDelay += 1        '共有多少个窗口,要发送信息
            End If
        Next
        If iDelay = 0 Then
            MsgBox("请选择至少一个聊天对象,必须打开聊天窗口,再按刷新即可。"
            Exit Sub
        End If
        iDelay = 3100 - iDelay * 1000  '延迟多少秒,发送的窗口越少,延迟秒数越大
        If iDelay < 0 Then
            iDelay = 0
        End If
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        If RadioButton1.Checked Then    '只发一次
            SendMess()
        Else                            '不停地发,直到用户中止
            MyThread = New Threading.Thread(AddressOf SendMessUntil)
            MyThread.Start()
            ButtonStart.Enabled = False
        End If
    End Sub
    Private Sub SendMess()
        For i = 0 To ListView1.Items.Count - 1
            If ListView1.Items(i).Checked = True Then
                SendMessage(hWndEdit(i), WM_SETTEXT, 0, sMess & "hhhhhhhh"
                System.Threading.Thread.Sleep(iDelay)
                SendMessage(hWndSend(i), WM_LBUTTONDOWN, 0, 0)
                SendMessage(hWndSend(i), WM_LBUTTONUP, 0, 0)
            End If
        Next
    End Sub
    Private Sub SendMessUntil()
        While 1
            SendMess()
        End While
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ButtonRefresh_Click(Nothing, Nothing)
    End Sub

    Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If (Not MyThread Is Nothing) Then
            MyThread.Abort()
        End If
    End Sub

End Class



地主 发表时间: 05-03-12 16:09

回复: a7611679_ [a7611679_]   论坛用户   登录
收藏先!

B1层 发表时间: 05-03-12 17:15

回复: nebulae [nebulae]   论坛用户   登录


B2层 发表时间: 05-04-02 01:00

回复: liuluo [liuluo]   论坛用户   登录
已另存为

B3层 发表时间: 05-04-02 09:57

回复: ndbf123 [ndbf123]   论坛用户   登录
路过!!!

B4层 发表时间: 05-04-06 15:36

回复: yunyun520 [yunyun520]   论坛用户   登录
路过!支持先!!!

B5层 发表时间: 05-04-07 16:07

回复: zffh123 [zffh123]   论坛用户   登录


B6层 发表时间: 05-04-07 21:02

回复: zhangli019 [zhangli019]   论坛用户   登录
不太明白!

B7层 发表时间: 05-04-07 23:18

回复: musttoo [musttoo]   论坛用户   登录
支持...等我会了...再拜师
�u�q�k~�rzzZ
�v(o-.-o)�u
�q�i�瘢�~.
┇�nQ一Q�n┊
┇�]我�]�n┊
┇�]�n�]�n┊


B8层 发表时间: 05-04-10 22:45

回复: wxngzybb [wxngzybb]   论坛用户   登录
没什么新意,主要的技术就是找到窗口,和使用一个sendmessage函数


B9层 发表时间: 05-04-12 17:19

回复: VeryBest [x1234521]   论坛用户   登录
楼上的,难道你有更好的方法吗 ?
对于这样的东西都是用得到句柄,然后SEND的,如果你有好的方法可以说出来,如果没有,请尊重作者的劳动成果!!!

B10层 发表时间: 05-04-18 12:55

回复: wxngzybb [wxngzybb]   论坛用户   登录
如果腾讯在那个"发送"按钮的消息上挂个钩子,只允许接受授权消息,比如,每当发来一个左键抬起时,相应检查一个全局变量,看它是否置位,而且这个变量可以很复杂,这样的话,人家就这一点点技术,你的这大段代码就无效了.这种方最多100行编码

还有一种方法可以绕过这个hook机制,可以提取本机QQ消息包的特性,比如地址,封包规则(不一定全懂)等,直接构造数据包发送出去,这样程序独立于QQ,而不是寄借QQ的功能

B11层 发表时间: 05-04-18 14:34

回复: wxngzybb [wxngzybb]   论坛用户   登录
MSDN上的阐述,相信腾讯的技术专家不会联这个都不知道
The MessageProc hook procedure is an application-defined or library-defined callback function used with the SetWindowsHookEx function. The system calls this function after an input event occurs in a dialog box, message box, menu, or scroll bar, but before the message generated by the input event is processed. The hook procedure can monitor messages for a dialog box, message box, menu, or scroll bar created by a particular application or all applications.


B12层 发表时间: 05-04-18 14:47

回复: newzwmail [newzwmail]   论坛用户   登录
已收藏,谢谢

B13层 发表时间: 05-04-19 12:52

论坛: 黑客进阶

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号