d******a 发帖数: 32122 | 1 【 以下文字转载自 Military 讨论区 】
发信人: didadida (滴滴嗒嗒), 信区: Military
标 题: 自动封人机开发成功,贴图机的噩梦
发信站: BBS 未名空间站 (Fri Jun 11 15:13:08 2021, 美东)
悉尼客黑名单上的76个ID都被封禁
如果你不是贴图机,请re此文以解封 | d******a 发帖数: 32122 | 2 Visual Studio 里新建一个VB的Windows Form Application
在form里加一个Web Browser 控件,和一个button
这两个控件都使用了缺省名字
在D盘保存封禁ID的名单,每个ID一行
假设文件取名IDs.txt
运行程序,登录完成后,点击那个唯一的button
代码
(需要把WebBrowser1.Navigate("http://www.mitbbs.com/mitbbs_add_deny_user.php?board=Detective&op_flag=0") 这一行里的Detective改成Military)
Imports VB = Microsoft.VisualBasic
Public Class Form1
Dim list_id As ArrayList = New ArrayList()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.
Load
WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser1.Navigate("www.mitbbs.com")
Dim FILE_NAME As String = "d:IDs.txt"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
list_id.Add(Trim(objReader.ReadLine()))
Loop
Else
MessageBox.Show("File Does Not Exist")
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim id As String
Dim iHTMLCol As HtmlElementCollection
Dim iHTMLEle As HtmlElement
For Each id In list_id
WebBrowser1.Navigate("http://www.mitbbs.com/mitbbs_add_deny_user.php?board=Detective&op_flag=0")
Do While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
iHTMLCol = WebBrowser1.Document.GetElementsByTagName("input")
For Each iHTMLEle In iHTMLCol
Debug.WriteLine(iHTMLEle.Name)
Select Case iHTMLEle.Name
Case "userid"
iHTMLEle.SetAttribute("value", id)
Case "dt"
iHTMLEle.SetAttribute("value", "14")
Case "exp"
iHTMLEle.SetAttribute("value", "贴图机并/或威胁版主")
End Select
Next
For Each curElement As HtmlElement In iHTMLCol
If curElement.GetAttribute("type").Equals("submit") Then
curElement.InvokeMember("click")
End If
Next
Dim start As Single
start = VB.Timer()
Do While VB.Timer() < start + 0.5
System.Windows.Forms.Application.DoEvents()
Loop
Do While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
Next
MsgBox("All Done")
End Sub
End Class |
|