yzm.frm
资源名称:qq.rar [点击查看]
上传用户:luoweizhao
上传日期:2022-08-01
资源大小:1290k
文件大小:12k
源码类别:
外挂编程
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
- Begin VB.Form yzm
- BorderStyle = 1 'Fixed Single
- Caption = "请输入验证码"
- ClientHeight = 2775
- ClientLeft = 10275
- ClientTop = 6975
- ClientWidth = 3990
- Icon = "yzm.frx":0000
- LinkTopic = "Form8"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2775
- ScaleWidth = 3990
- Begin VB.CommandButton Command1
- Caption = "确认"
- Default = -1 'True
- Height = 495
- Left = 1200
- TabIndex = 5
- Top = 3600
- Width = 1215
- End
- Begin VB.Frame Frame1
- Caption = "请输入QQ农场操作验证码"
- Height = 2535
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 3735
- Begin VB.Timer Timer3
- Enabled = 0 'False
- Interval = 1000
- Left = 2280
- Tag = "验证码过期"
- Top = 360
- End
- Begin VB.Timer Timer2
- Enabled = 0 'False
- Interval = 5000
- Left = 1560
- Top = 120
- End
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 50
- Left = 600
- Tag = "加载验证码"
- Top = 480
- End
- Begin VB.TextBox Text1
- Alignment = 2 'Center
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- IMEMode = 3 'DISABLE
- Left = 480
- MaxLength = 4
- TabIndex = 0
- Top = 1440
- Width = 2715
- End
- Begin VB.PictureBox Picture1
- BorderStyle = 0 'None
- Height = 860
- Left = 860
- MouseIcon = "yzm.frx":038A
- MousePointer = 99 'Custom
- ScaleHeight = 855
- ScaleWidth = 1995
- TabIndex = 2
- TabStop = 0 'False
- Top = 360
- Width = 2000
- End
- Begin MSWinsockLib.Winsock Winsock1
- Left = 3120
- Top = 240
- _ExtentX = 741
- _ExtentY = 741
- _Version = 393216
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- Caption = "加载中..."
- BeginProperty Font
- Name = "宋体"
- Size = 14.25
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 360
- MouseIcon = "yzm.frx":04DC
- MousePointer = 99 'Custom
- TabIndex = 4
- Top = 720
- Width = 3015
- End
- Begin VB.Label Label1
- Caption = "提醒:没有输入验证码,将无法继续操作!"
- Height = 255
- Left = 190
- TabIndex = 3
- Top = 2160
- Width = 3375
- End
- End
- End
- Attribute VB_Name = "yzm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '========获取验证码==========
- Dim mintFile As Integer '文件句柄
- Dim mblnBegin As Boolean '记录是否是第一次取得数据
- Dim DownGifSize As Long '已下载的文件大小
- Dim GifSize As Long '文件大小
- '========获取验证码==========
- Dim login_temp As String
- Dim login_qq As Boolean '记录是否第一次取得数据
- Dim login2 As Boolean '检测是否失败
- Dim qqsum As Integer
- Dim tqq(50) As String
- Dim tmm(50) As String
- Dim deletei As Integer
- Dim Data_yzm As String
- Public js As Integer '计数
- Private Sub shuaxin()
- On Error Resume Next
- '初始相关数据
- Text1.Text = ""
- DownGifSize = 0
- GifSize = 0
- Label2.Caption = "加载中..."
- If mintFile > 1 Then
- Close #mintFile
- mintFile = 0
- End If
- Data_yzm = ""
- If Proxy = 1 Then '使用代理
- Winsock1.Close
- Winsock1.RemoteHost = Proxy_IP
- Winsock1.RemotePort = Proxy_DK
- Winsock1.Connect
- Else
- With Winsock1
- .Close
- .RemoteHost = "ptlogin2.qq.com" '得到下载地址的服务器地址
- .RemotePort = 80 'http端口80
- .Connect
- End With
- End If
- Timer2.Interval = 3000 '设置超时为5秒
- Timer2.Enabled = True
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- Cancel = True
- yzmqk = False
- yzm.Visible = False
- If guanbitime > 0 And time_c - guanbitime <= 10 Then
- guanbicsi = guanbicsi + 1
- If guanbicsi >= 3 Then
- guanbitime = time_c
- guanbicsi = 0
- Form1.XPButton21.Caption = "开始工作"
- Form1.XPButton21.ForeColor = &HFF&
- Call jilu("系统", MyQQ, "因为您没有输入验证码,现在已停止工作!")
- End If
- Else
- guanbitime = time_c
- guanbicsi = 0
- End If
- Call Form1.qhico(False) '切换图标
- Timer3.Enabled = False
- js = 0
- End Sub
- Private Sub Label2_Click()
- If Label2.Caption = "点击加载验证码" Then
- js = 0
- Call shuaxin
- End If
- End Sub
- Private Sub Picture1_Click() '点击刷新验证码
- js = 0
- Call shuaxin
- End Sub
- Private Sub Timer3_Timer() '自动刷新验证码
- js = js + 1
- If js >= 1800 And Picture1.Visible = True Then
- Label2.Visible = True
- Label2.Caption = "点击加载验证码"
- Picture1.Visible = False
- ElseIf js Mod 180 = 0 And Picture1.Visible = True Then
- js = 0
- Call shuaxin
- End If
- End Sub
- Private Sub Text1_keypress(KeyAscii As Integer)
- If KeyAscii = 13 Then Command1_Click
- If KeyAscii = 27 Then Text1.Text = ""
- End Sub
- Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
- Text1.Text = Trim(Text1.Text)
- Form1.bfi = 0
- If Len(Text1.Text) >= 4 Then
- Call Command1_Click
- End If
- End Sub
- Private Sub Command1_Click()
- If Len(Text1.Text) = 4 Then
- yzmcode = "&validatemsg=" & Text1.Text
- FormTop yzm.hwnd, False
- yzm.Visible = False
- yzmqk = False
- Text1.Text = ""
- Form1.Timer22.Enabled = True
- Form1.bfi = 0
- Timer3.Enabled = False
- js = 0
- Call Form1.qhico(False) '切换图标
- If InStr(FarmCookies, "verifysession=") > 0 Then
- FarmCookies = Replace(FarmCookies, Mid(FarmCookies, InStr(FarmCookies, "verifysession=") + 14, 80), yzmcookies)
- ElseIf InStr(FarmCookies, "verifysession=") = 0 And Len(FarmCookies) > 0 Then
- FarmCookies = FarmCookies & "; verifysession=" & yzmcookies
- End If
- Else
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- End If
- End Sub
- Private Sub Timer1_Timer() '加载验证码
- js = 0
- Timer3.Enabled = True
- yzmqk = True
- Timer1.Enabled = False
- Call shuaxin
- End Sub
- Private Sub Timer2_Timer() '防止超时
- Timer2.Enabled = False
- If mintFile <> 0 Or Winsock1.State <> sckConnected Then
- If mintFile <> 0 Then Close #mintFile '关闭文件
- mintFile = 0
- Winsock1.Close
- Picture1.Visible = False
- Label2.Visible = True
- Label2.Caption = "验证码获取失败!"
- Debug.Print "验证码重新获取"
- Call shuaxin: Exit Sub
- End If
- End Sub
- Private Sub Winsock1_Connect()
- Dim strCommand As String
- Dim proxytemp As String
- Randomize Timer
- If Proxy = 1 Then '使用代理
- proxytemp = "http://ptlogin2.qq.com"
- End If
- Randomize Timer
- strCommand = "GET " & proxytemp & "/getimage?aid=15000102&" & "0" & Rnd * 1 & Int(Rnd * 50000000 + 1) & " HTTP/1.1" & vbCrLf
- strCommand = strCommand + "Accept: */*" + vbCrLf
- strCommand = strCommand + "Accept-Language: zh-cn" + vbCrLf
- strCommand = strCommand + "Accept-Encoding: gzip, deflate" + vbCrLf
- If Proxy = 1 And Len(Basic) > 0 Then strCommand = strCommand & "Proxy-Authorization: Basic " & Basic & vbCrLf
- strCommand = strCommand & "Host: ptlogin2.qq.com" & vbCrLf
- strCommand = strCommand & "Accept-Language: zh-cn" & vbCrLf
- strCommand = strCommand & "Accept-Encoding: gzip, deflate" & vbCrLf
- strCommand = strCommand & "Connection: Keep-Alive" & vbCrLf
- strCommand = strCommand & "Referer: http://ui.ptlogin2.qq.com/cgi-bin/login?link_target=blank&appid=15000102" & vbCrLf
- strCommand = strCommand & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;)" & vbCrLf
- strCommand = strCommand & vbCrLf
- mblnBegin = True '设置为第一次取得文件数据状态
- Winsock1.SendData strCommand '发送请求
- End Sub
- Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
- On Error Resume Next
- Dim bytData() As Byte
- Dim bytDataHeader() As Byte
- Dim intCrLf As Integer
- Dim http_header As String
- Winsock1.GetData bytData, vbArray + vbByte, bytesTotal '以二进制形式接送数据,这是关键
- If mblnBegin = True Then Data_yzm = Data_yzm & UTF8_Decode(bytData)
- If InStr(Data_yzm, Chr(13) & Chr(10) & Chr(13) & Chr(10)) > 0 Or mblnBegin = False Then
- If mblnBegin = True Then '如果是首次接收文件
- mblnBegin = False
- Timer2.Enabled = False
- '取得得到数据中的第一个空行,因为空行前面的是HTTP头,而非文件内容
- intCrLf = InStrB(bytData, ChrB(13) & ChrB(10) & ChrB(13) & ChrB(10))
- bytDataHeader = MidB(bytData, 1, intCrLf - 1)
- http_header = Data_yzm
- GifSize = Split(Split(http_header, "Content-Length: ")(1), Chr(13) & Chr(10))(0) '得到了文件的大小
- yzmcookies = ""
- If InStr(http_header, "verifysession") > 0 Then
- yzmcookies = Split(Split(http_header, "verifysession=")(1), ";")(0) '得到验证码的cookies
- End If
- If InStr(http_header, " 200 OK") = 0 Then
- Picture1.Visible = False
- Label2.Visible = True
- Label2.Caption = "验证码获取失败!"
- Winsock1.Close
- Exit Sub
- End If
- mintFile = FreeFile()
- Timer2.Enabled = False
- Timer2.Interval = 3000 '设置超时为5秒
- Timer2.Enabled = True '启动超时机制
- Open Main.SysPath & "yzm" For Binary Access Write As #mintFile
- bytData = MidB(bytData, intCrLf + 4) '这次得到的数据有一部分是文件内容
- End If
- Put #mintFile, , bytData '写入要保存的文件中
- DownGifSize = DownGifSize + bytesTotal '改变已下载的文件大小
- If DownGifSize >= GifSize Then '判断是否已完成下载
- Close #mintFile '关闭文件
- mintFile = 0
- Winsock1.Close
- Label2.Visible = False
- Timer2.Enabled = False
- Picture1.Picture = LoadPicture("")
- Picture1.Picture = LoadPicture(Main.SysPath & "yzm")
- If Picture1.Picture = 0 Then Debug.Print "验证码重新获取": Call shuaxin: Exit Sub
- Picture1.Visible = True
- Text1.SetFocus
- End If
- ' If Winsock1.State = sckConnected And Timer2.Enabled = True Then
- ' Picture1.Visible = False
- ' Label2.Visible = True
- ' Label2.Caption = "验证码获取失败!3"
- ' Winsock1.Close
- ' End If
- End If
- End Sub