Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 7th, 2005, 6:00 AM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,819
Rep Power: 5 Sane will become famous soon enough
Keylogger in Python

I don't actually want to make or use one, I'm just curious if there is any way at all you could get this to work? Care to describe how?

I can only think of one method, but it would be stupid because you'd have to click on a Pygame screen and type everything in to that, but how the hell does that make sense?
Sane is offline   Reply With Quote
Old Aug 7th, 2005, 7:46 AM   #2
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Quote:
I don't actually want to make or use one, I'm just curious if there is any way at all you could get this to work?
Yes, yes there is.

Quote:
Care to describe how?
Nope, because you said you don't actually want to make one or use one

You just want to ask the OS API to provide you with notification whenever a key is hit. Easy to do with the WinAPI (and Python has full (well, almost full) win32 bindings), and should be fairly easy to do on X. Not sure with Mac 'tho.
Cerulean is offline   Reply With Quote
Old Aug 8th, 2005, 12:15 AM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,819
Rep Power: 5 Sane will become famous soon enough
So is it something along the lines of forking the process to the background, and then making the os module catch all the keys or something?

Hmm. That might give me something to research and learn from in a couple of months when I finish what I'm up to now.
Sane is offline   Reply With Quote
Old Aug 8th, 2005, 7:47 AM   #4
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Let me know how it goes, I'd like to see how this would work out in Python.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Aug 8th, 2005, 1:40 PM   #5
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
No, it's not in the os module. I mean the OS itself. Oh ok then, here are the functions you'll need :p:
win32api.GetAsyncKeyState - takes a number parameter which is maps to the character you want to check for (you'll want to check for any character from 32 to 256). It'll return -32767 if that character is currently being pressed, IIRC.
chr - Maps said number to an ASCII character (e.g chr(97) => 'a')

From what I remember, that should be it. I'll leave the rest to you . Good luck
Cerulean is offline   Reply With Quote
Old Aug 18th, 2005, 1:09 PM   #6
theguy0000
Programmer
 
Join Date: Jul 2005
Posts: 73
Rep Power: 4 theguy0000 is on a distinguished road
Quote:
Originally Posted by Cerulean
No, it's not in the os module. I mean the OS itself. Oh ok then, here are the functions you'll need :p:
win32api.GetAsyncKeyState - takes a number parameter which is maps to the character you want to check for (you'll want to check for any character from 32 to 256). It'll return -32767 if that character is currently being pressed, IIRC.
chr - Maps said number to an ASCII character (e.g chr(97) => 'a')

From what I remember, that should be it. I'll leave the rest to you . Good luck
could you please give a full example? i dont completely understand that.
theguy0000 is offline   Reply With Quote
Old Aug 18th, 2005, 2:01 PM   #7
lostcauz
Hobbyist Programmer
 
Join Date: Nov 2004
Location: 1691 miles East of L.A.
Posts: 159
Rep Power: 4 lostcauz is on a distinguished road
Cerulean has already given enough information to complete this task although I would start the keyscan at 8 to capture backspace, tab, enter and escape. If you still don't understand you should try google results for the API call mentioned.
__________________
-- lostcauz

Stepped in what?...
Behind whose barn?...
I didn't even know they had a cow!
lostcauz is offline   Reply With Quote
Old Aug 19th, 2005, 6:10 AM   #8
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
Quote:
keyscan at 8 to capture backspace, tab, enter and escape
Ooh yes, indeed. You'll have to manipulate your date accordingly in response to those.
Cerulean is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC