Skip to content

Repository files navigation

Keystroke Dynamics Authentication System

A complete biometric authentication system using keystroke dynamics and SVM machine learning.

Overview

This system creates unique user profiles based on typing patterns by analyzing:

  • Dwell time: How long each key is pressed
  • Flight time: Time between releasing one key and pressing the next
  • Digraph timing: Time patterns for two-key combinations

Features are extracted across 9 keyboard sections and used to train individual SVM models for each user.

Features

Biometric Authentication: Login using your unique typing pattern
65% Similarity Threshold: Secure authentication with configurable threshold
9 Keyboard Sections: Comprehensive coverage of typing patterns
SVM Machine Learning: One-class SVM for anomaly detection
Modern UI: Beautiful dark mode interface with smooth animations

Installation

  1. Clone or navigate to the project directory
cd C:\Users\watta\POK
  1. Install dependencies
pip install -r requirements.txt

Usage

  1. Start the server
python app.py
  1. Open your browser Navigate to http://localhost:5000

  2. Register a new user

    • Click the "Register" tab
    • Enter a username
    • Click "Start Registration"
    • Type the 10 random words shown
    • Click "Complete Registration"
  3. Login

    • Click the "Login" tab
    • Enter your username
    • Click "Start Login"
    • Type the 10 random words shown
    • Click "Authenticate"

Project Structure

POK/
├── app.py                    # Flask application (main entry point)
├── config.py                 # Configuration settings
├── keyboard_sections.py      # Keyboard section mapping
├── word_generator.py         # Random word generation
├── feature_extractor.py      # Feature extraction from keystroke data
├── svm_model.py             # SVM model training and authentication
├── requirements.txt          # Python dependencies
├── models/                   # Stored user models (auto-created)
├── static/
│   ├── style.css            # Premium UI styling
│   ├── keystroke_capture.js # Keystroke event capture
│   └── app.js               # Frontend application logic
└── templates/
    └── index.html           # Main HTML interface

How It Works

Registration

  1. User enters username
  2. System generates 10 random words covering all keyboard sections
  3. User types the words while keystroke dynamics are captured
  4. Features are extracted (dwell time, flight time, digraph timing)
  5. SVM model is trained and saved for the user

Login

  1. User enters username
  2. System generates 10 new random words
  3. User types the words while keystroke dynamics are captured
  4. Features are extracted and compared with stored model
  5. If similarity ≥ 40%, authentication succeeds

Keyboard Sections

Section 1: Q W E    Section 2: R T Y    Section 3: U I O P
Section 4: A S D    Section 5: F G H    Section 6: J K L
Section 7: Z X C    Section 8: V B N    Section 9: M , .

Configuration

Edit config.py to customize:

  • SIMILARITY_THRESHOLD: Authentication threshold (default: 0.40)
  • NUM_WORDS: Number of words for typing test (default: 10)
  • SVM_KERNEL: SVM kernel type (default: 'rbf')
  • SVM_NU: Outlier fraction for one-class SVM (default: 0.1)

API Endpoints

  • GET / - Main application interface
  • GET /get_words - Generate random words for typing test
  • POST /register - Register new user with keystroke profile
  • POST /login - Authenticate user with keystroke profile
  • GET /check_user/<username> - Check if user exists

Technologies

  • Backend: Python, Flask
  • Machine Learning: scikit-learn (SVM)
  • Frontend: HTML5, CSS3, JavaScript
  • Data Processing: NumPy, Pandas

Security Notes

⚠️ Important: This is a demonstration system. For production use:

  • Add password authentication as a fallback
  • Implement rate limiting
  • Use HTTPS
  • Add CSRF protection
  • Store models securely with encryption
  • Implement session management

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages