A Python-based keylogger that records keystrokes and can create and send files to a remote server for monitoring.
- Logs all keystrokes with timestamps.
- Detects and logs key combinations (e.g.,
Ctrl + C
). - Runs in the background until
Esc
is pressed. - Sends the keylog file to a remote server.
- Can be converted into an executable (
.exe
).
Before running the script, install the required dependencies:
pip install keyboard
- Install dependencies:
pip install keyboard
- Run the keylogger:
python keylogger.py
- The script will log keystrokes in
keylog.txt
. - Press
Esc
to stop the script. - Once stopped, the script will send
keylog.txt
to the remote server.
- Navigate to the
server-side/
directory. - Run the server to receive the keylogs:
python server.py
- The server will listen for incoming connections and save the received logs as
received_keylog.txt
.
To allow communication between a Windows 11 VirtualBox VM and the Windows 11 host machine, ensure the VM has:
- Network Adapter 1 set to Host-Only
- Network Adapter 2 set to NAT Network
Additionally, run the following command on the virtual machine terminal:
netsh advfirewall firewall add rule name="Allow ICMPv4" protocol=ICMPv4 dir=in action=allow
Ensure that both systems are on the same network and that firewalls or antivirus programs are not blocking the connection.
To run the keylogger without opening a terminal, convert it into an .exe
file.
- Install PyInstaller:
pip install pyinstaller
- Convert the script to an executable:
pyinstaller --onefile --noconsole keylogger.py --exclude-module server-side
--onefile
: Creates a single.exe
file.--noconsole
: Runs the script silently in the background.--exclude-module server-side
: Ensures that the server-side module (or folder) is not packaged into the executable.
- The
.exe
file will be in thedist/
folder. - Run
keylogger.exe
—it will execute in the background.
- For educational and ethical use only. Unauthorized use may violate laws.
- To stop the keylogger, press
Esc
. - The server must be running before stopping the keylogger for successful file transfer.
- Ensure that the firewall and antivirus settings allow the connection for proper functioning.
This project is for ethical and educational purposes. Use responsibly.