Skip to content

Fluxerr/CS2-ESP-BACKEND

Repository files navigation

CS2 ESP Key Management Backend

This is the backend server for managing and validating license keys for CS2 ESP application.

Features

  • ✅ RESTful API for key validation
  • ✅ Admin panel for key management
  • ✅ Support for multiple key types (Day, Week, Month, Lifetime)
  • ✅ Hardware ID (HWID) binding to prevent key sharing
  • ✅ Automatic expiration tracking
  • ✅ SQLite database (easy and portable)

Installation

  1. Install Node.js (if not already installed):

  2. Install dependencies:

    cd key-backend
    npm install
  3. Configure server (optional):

    • Edit config.js to change port, admin credentials, or key durations
    • IMPORTANT: Change the default admin password!

Usage

Starting the Server

npm start

The server will start on http://localhost:3000 by default.

Accessing the Admin Panel

  1. Open your browser to http://localhost:3000
  2. Log in with credentials from config.js:
    • Default username: admin
    • Default password: changeme123 (CHANGE THIS!)

Generating Keys

  1. Log in to the admin panel
  2. Select key type (DAY, WEEK, MONTH, LIFE)
  3. Enter quantity
  4. Click "Generate"
  5. Copy the generated keys

Managing Keys

The admin panel allows you to:

  • View all generated keys
  • See activation status and expiration dates
  • Search keys by key value, type, or HWID
  • Delete keys
  • View statistics (total, active, expired keys)

API Endpoints

POST /api/validate

Validates a key and binds it to a hardware ID.

Request:

{
  "key": "CS2-DAY-ABC-123",
  "hwid": "hardware-id-string"
}

Response (Success):

{
  "valid": true,
  "message": "Key is valid",
  "expiresAt": 1234567890000,
  "type": "DAY"
}

Response (Failure):

{
  "valid": false,
  "message": "Error description"
}

Admin Endpoints (Require Authentication)

All admin endpoints require Basic Authentication with username and password.

  • POST /api/admin/login - Verify credentials
  • POST /api/keys/generate - Generate new keys
  • GET /api/keys - List all keys
  • DELETE /api/keys/:key - Delete a key
  • GET /api/stats - Get statistics

Key Formats

  • Day key: CS2-DAY-XXX-XXX
  • Week key: CS2-WEEK-XXX-XXX
  • Month key: CS2-MONTH-XXX-XXX
  • Lifetime key: CS2-LIFE-XXX-XXX

Where XXX represents 3 random alphanumeric characters.

Database

The server uses SQLite with a file named keys.db in the backend directory.

Schema:

Keys Table

  • key (TEXT, PRIMARY KEY) - The license key
  • type (TEXT) - Key type (DAY, WEEK, MONTH, LIFE)
  • created_at (INTEGER) - Unix timestamp of creation
  • expires_at (INTEGER) - Unix timestamp of expiration
  • activated_at (INTEGER) - Unix timestamp of first use (NULL if not activated)
  • hwid (TEXT) - Hardware ID bound to this key (NULL if not activated)
  • is_active (INTEGER) - Whether key is active (1) or deactivated (0)

Admins Table

  • username (TEXT, PRIMARY KEY)
  • password_hash (TEXT) - Bcrypt hash of password

Deployment

For production deployment:

  1. Change admin credentials in config.js
  2. Use a process manager like PM2:
    npm install -g pm2
    pm2 start server.js --name cs2-key-server
    pm2 save
  3. Set up a reverse proxy (nginx) with HTTPS
  4. Update the C++ client code to point to your production URL
  5. Consider using environment variables for sensitive config

Security Notes

  • Keys are validated server-side, preventing client-side tampering
  • HWID binding ensures keys can't be shared between computers
  • Admin panel uses Basic Authentication (use HTTPS in production!)
  • SQLite is fine for small-to-medium scale; consider PostgreSQL for high traffic

Troubleshooting

Server won't start:

  • Make sure port 3000 is not already in use
  • Check that Node.js is installed (node --version)

Can't log in to admin panel:

  • Verify credentials in config.js
  • Check browser console for errors
  • Ensure server is running

Key validation fails from C++ app:

  • Ensure server is running and accessible
  • Check firewall settings
  • Verify the URL in C++ code matches server address
  • Check server logs for errors

License

MIT License

MIT License

Copyright (c) 2026 Cilliain7

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Key system for CS2 cheat software

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors