Sep 26, 2014 02:00 PM
(This post was last modified: Sep 26, 2014 02:51 PM by SIM-1456245.)
I decided to write a very nice keylogger, because I see a lot of people want one. I'm aware that there are a lot of people that already have a keylogger, but I still decided to write one literally from scratch. So here it is, it uses a keyboard hook to detect the key presses. When it detects them it uses a custom key to string conversion(using a big switch). I decided to use that big switch, because I don't like the way other's do it, detect some with the switch and some with the keys-converter. It raises 3 events, one whenever a key's state has changed, one when a key is pressed down, and one when a key is depressed - up. In the event args you get the key as a keys object, as a string representation, the direction that the key was pressed, the time as date-time and a window object. The window object has the name, handle and a boolean that tells you if it is different from the last key event. You can start the logging and stop it with two simple methods. There is also one property named PassThrough, if you set that to false the key presses will be recorded, but not actually send to the application, i.e. pressed. Also you will notice that I use IDisposable, but it's not that needed, well meeh, it might get in handy.
Note: You are free to use this code wherever you want, but please leave some credits. And if you have any notices about the code, don't hesitate to tell me, I'm always open to learn from my mistakes. Also one more thing, if you don't know how hooks work, if you block the thread that the hook runs on, the key presses will be delayed, ex., if you try to download a file after a cerain keypress, the key will be send to the right application after the file is downloaded.
Example log(code included on the pastebin):
Enough talking, here is the code:
http://pastebin.com/qv0ZPJtk
You realize this is nothing new? Keyloggers have been using this for ages now.
(Sep 26, 2014 03:35 PM)Zettabit Wrote: You realize this is nothing new? Keyloggers have been using this for ages now.
"I'm aware that there are a lot of people that already have a keylogger, but I still decided to write one literally from scratch."
Nothing wrong with coding one from scratch. Even if there are a lot out there. If you're learning something while doing it, it's all that counts.
Thanks for writing this from scratch.
I guess it will help a lot of people like me.
The reason why I wrote this from scratch is because all open sources csnnot deal properly either with the hosted process or with the window detection. As you can see here I use pinvoke unmodified functions, and then cast the objects.
Please tell me why you decided to use a 150+ line switch statement?
Sep 27, 2014 02:10 PM
(This post was last modified: Sep 27, 2014 02:10 PM by $lick.)
Electroalek makes more HQ and unique threads than DJ Black Barret.
My keylogger is 100 lines shorter ;)
(Sep 27, 2014 02:10 PM)$lick Wrote: Electroalek makes more HQ and unique threads than DJ Black Barret.
My keylogger is 100 lines shorter ;)
😊 can be done with 10 lines 😁
(Sep 27, 2014 03:03 PM)Only3 Wrote: 😊 can be done with 10 lines 😁
Make a good keylogger in 10 lines and post the source.
I'll be waiting.
GetAsyncKeyState around 10
KeyBoard Hook another 10 > around 20
(Sep 27, 2014 03:54 PM)Only3 Wrote: GetAsyncKeyState around 10
KeyBoard Hook another 10 > around 20
I requested source, not an explanation.
Please deliver.
Sep 27, 2014 04:13 PM
(This post was last modified: Sep 27, 2014 09:25 PM by Onin42.)
From a keylogger, always hope it can tell me witch Keyboard language the user have for each applicaton (in games many times the keyboard language switch to another.), many times the results detected are wrong just because of that. Never understood why i never saw the keyboard language detection in keyloggers --'
Sep 28, 2014 06:29 AM
(This post was last modified: Sep 28, 2014 06:32 AM by SIM-1456245.)
(Sep 27, 2014 01:46 PM)NETExplorer Wrote: Please tell me why you decided to use a 150+ line switch statement?
Really because every other keylogger does key.ToString, and check for the special chars with a switch. And then for capital letters also check's, and I don't like the way it looks and works, it's just a huge mess. I also made a version that holds the values in a dictionary, but that ended up in a mess, not that it wasn't working tho. So I ended up with this huge switch, and I personally like it. If you don't just remove the switch and rewrite that single method, and bob's your uncle.
(Sep 27, 2014 04:13 PM)Onin42 Wrote: From a keylogger, always hope it can tell me witch Keyboard language the user have for each applicaton (in games many times the keyboard language switch to another.), many times the results detected are wrong just because of that. Never understood why i never saw the keyboard language detection in keyloggers --'
Thank's for the idea, I'll take a look.
(Sep 27, 2014 03:03 PM)Only3 Wrote: 😊 can be done with 10 lines 😁
As you probably know from my threads, I sometimes include a one letter method that does the same thing as the whole class, but made in one method under 20 lines. I excluded that from here, I can add it if you want, but I don't really see a point people using that.
(Sep 27, 2014 02:10 PM)$lick Wrote: Electroalek makes more HQ and unique threads than DJ Black Barret.
Sarcasm right ? Please don't compare me to him, he get's angry when someone does.
(Sep 28, 2014 06:29 AM)SIM-1456245 Wrote: ...
Sarcasm right ? Please don't compare me to him, he get's angry when someone does.
he get angry from anything that is not by him 😊
(Sep 27, 2014 04:06 PM)$lick Wrote: I requested source, not an explanation.
Please deliver.
open ur sky i will show u things u never seen 🤣
(Sep 28, 2014 07:45 AM)Only3 Wrote: open ur sky i will show u things u never seen 🤣
Are you backing down on your claim? It's only 10 lines, I'm not asking for you to code a huge project.
(Sep 28, 2014 06:29 AM)SIM-1456245 Wrote: Sarcasm right ? Please don't compare me to him, he get's angry when someone does.
That's the point.
|