Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” Cyber Security Email Leak Checker

A comprehensive cybersecurity application that helps users check if their email addresses have been compromised in data breaches. Built with React, Node.js, PostgreSQL, and Elasticsearch.

๐ŸŒŸ Features

๐Ÿ” Two-Tier Search System

  • Public Search: Shows only the count of breaches for unverified emails
  • Verified Search: Provides detailed breach information and security recommendations for verified emails

๐Ÿ“ง Email Verification System

  • OTP-based email verification
  • Secure email management for monitoring multiple addresses
  • Automatic inclusion of registered email in monitoring list

๐Ÿ›ก๏ธ Security Features

  • JWT-based authentication
  • Password hashing with bcrypt
  • Email-based OTP verification
  • Secure API endpoints with authentication middleware

๐Ÿ“ฑ User-Friendly Interface

  • Armenian language support
  • Responsive React components
  • Dropdown for quick email selection
  • Modal-based email addition workflow

๐Ÿ—๏ธ Architecture

cyber-tech-sprint/
โ”œโ”€โ”€ frontend/                 # React TypeScript application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # Reusable UI components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ atoms/        # Basic components (Button, Input)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ molecules/    # Form components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ organisms/    # Complex components (Header, EmailManager)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ pages/        # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ context/          # React Context for state management
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/            # Custom React hooks
โ”‚   โ”‚   โ””โ”€โ”€ assets/           # Static assets
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ backend/                  # Node.js Express server
โ”‚   โ”œโ”€โ”€ app.js               # Main server file
โ”‚   โ”œโ”€โ”€ db.js                # PostgreSQL connection
โ”‚   โ””โ”€โ”€ init-users-email-table.sql
โ””โ”€โ”€ README.md

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • PostgreSQL (v12 or higher)
  • Elasticsearch (v7 or higher)
  • Gmail account with App Password

Installation

  1. Install and setup ElasticSearch curl -fsSL https://elastic.co/start-local | sh

  2. Clone the repository

    git clone <repository-url>
    cd cyber-tech-sprint
  3. Setup Backend

    cd backend
    npm install
  4. Setup Frontend

    cd frontend
    npm install
  5. Database Setup

    # Connect to PostgreSQL and create database
    psql -U postgres
    CREATE DATABASE cyber_security;
    
    # Run the user_emails table creation script
    psql -U postgres -d cyber_security -f backend/init-users-email-table.sql
  6. Environment Configuration Create a .env file in the backend directory:

    JWT_SECRET=your-super-secret-key-that-is-long-and-secure
    DB_USER=postgres
    DB_HOST=localhost
    DB_NAME=postgres
    DB_PASSWORD=your-db-password
    DB_PORT=5432
    GMAIL_USER=your-email@gmail.com
    GMAIL_PASS=your-app-password
    ELASTICSEARCH_NODE=http://localhost:9200
    ELASTICSEARCH_API_KEY=your-elasticsearch-api-key #you can find that in your ElasticSearch directory .env file
  7. Start Services

    # Start Elasticsearch (if not running)
    # Start PostgreSQL (if not running)
    
    # Start Backend(in different terminals each node command)
    cd backend
    node --env-file=.env app.js
    node --env-file=.env email-monitor.js
    node --env-file=.env indexer.js #Run if you want to index new data leaks to elastic search
    
    
    # Start Frontend (in another terminal)
    cd frontend
    npm run dev

๐Ÿ“Š Database Schema

Users Table

CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    password VARCHAR(255) NOT NULL,
    two_factor_enabled BOOLEAN DEFAULT FALSE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

User Emails Table

CREATE TABLE user_emails (
    id SERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL,
    email VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
    UNIQUE(user_id, email)
);

Security Alerts Table

CREATE TABLE security_alerts (
    id SERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL,
    monitored_email VARCHAR(255) NOT NULL,
    breach_database VARCHAR(255) NOT NULL,
    alert_sent_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    severity_level INTEGER DEFAULT 3,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);

Leak Databases Guidance Table

CREATE TABLE leak_databases_guidance (
    id SERIAL PRIMARY KEY,
    database_name VARCHAR(255) UNIQUE NOT NULL,
    display_name VARCHAR(255) NOT NULL,
    service_type VARCHAR(255),
    description TEXT,
    security_guidance JSONB,
    severity_level INTEGER DEFAULT 3,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

๐Ÿ”Œ API Endpoints

Authentication

  • POST /register - User registration with JWT token
  • POST /login - User login with JWT token
  • POST /send-otp - Send OTP for registration
  • POST /verify-otp - Verify OTP for registration

Email Search

  • POST /search-email - Public search (count only)
  • POST /search-email-details - Private search (detailed results)

Email Management

  • POST /user/send-otp - Send OTP to new email for verification
  • POST /user/verify-otp - Verify OTP and add email to monitoring
  • GET /user/emails - Get user's verified emails

Utility

  • POST /check-email - Check if email is registered
  • POST /test-email - Test email sending functionality

๐ŸŽจ Component Structure

Atomic Design Pattern

  • Atoms: Button, Input - Basic reusable components
  • Molecules: EmailForm, OtpForm, PasswordForm - Form components
  • Organisms: Header, EmailManager, LoginForm - Complex components
  • Templates: AuthTemplate - Page layouts
  • Pages: AuthPage, DashboardPage - Complete pages

๐Ÿ”’ Security Measures

Backend Security

  • JWT token authentication
  • Password hashing with bcrypt
  • Input validation and sanitization
  • SQL injection prevention with parameterized queries
  • CORS configuration
  • Rate limiting (recommended to add)

Frontend Security

  • Token-based authentication
  • Secure API communication
  • Input validation
  • XSS prevention

๐ŸŒ Internationalization

The application supports Armenian language with fallbacks:

  • Armenian UI text and messages
  • Armenian email templates
  • Error messages in Armenian

๐Ÿ”ง Development

Frontend Development

cd frontend
npm run dev        # Start development server
npm run build      # Build for production
npm run lint       # Run ESLint
npm run type-check # TypeScript type checking

Backend Development

cd backend
node --env-file=.env app.js        # Start server
npm run test       # Run tests (if configured)

๐Ÿ“ˆ Performance Optimizations

  • Elasticsearch for fast breach data search
  • Database indexing on frequently queried fields
  • React component optimization with hooks
  • Lazy loading for large components
  • Connection pooling for database connections

๐Ÿ”ฎ Future Enhancements

  • Dark mode support
  • Email notifications for new breaches
  • Multi-language support (English, Russian)
  • Advanced search filters
  • Breach severity ratings
  • Export functionality for breach reports
  • Mobile UI
  • API rate limiting
  • Redis caching for frequently accessed data
  • Monitoring and logging system

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

โš ๏ธ Disclaimer

This tool is for educational and security awareness purposes only. Always use responsibly and in compliance with applicable laws and regulations.


Built with โค๏ธ for cybersecurity awareness

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages