This is a web-based password cracking application built with PHP, JavaScript, and MySQL/SQLite. It categorizes cracked passwords into "Easy," "Medium," and "Hard" based on predefined patterns and displays the results in a user-friendly interface. The application includes features like a loader, rate limiting, export functionality, and filtering options.
- Password Cracking: Cracks passwords from a database based on numeric, uppercase, lowercase, and mixed-case patterns.
- Categories:
- Easy: 5-digit numeric passwords (e.g., 12345).
- Medium: 3 uppercase letters + 1 digit (e.g., ABC1) or 6-character lowercase dictionary words (e.g., london).
- Hard: 6-character mixed-case passwords with numbers (e.g., AbC12z).
- User Interface: Includes a loader during processing, category selection, user ID filtering, and result export as CSV.
- Security: Implements rate limiting (5 requests per minute) and security headers (e.g., X-Frame-Options, Content-Security-Policy).
- Performance: AJAX request timeout (30 seconds) and optimized cracking logic.
- Error Handling: Detailed error messages for database issues, timeouts, and general errors.
- PHP (8.1 or higher)
- MySQL (for storing user data)
- SQLite (for caching cracked passwords)
- Composer (for dependency management)
- Web Server (e.g., Apache or Nginx)
- Node.js (optional, for frontend testing)
- Docker (latest version, for containerized deployment)
- Docker Compose (latest version)
git clone https://github.com/your-username/password-cracker.git
cd password-crackerInstall the required PHP dependency (vlucas/phpdotenv) using Composer:
composer require vlucas/phpdotenvCreate a .env file in the root directory with the following content:
DB_HOST=localhost
DB_NAME=cracker
DB_USER=root
DB_PASS=
SQLITE_DB=hash_cache.db
SALT=ThisIs-A-Salt123- Update
DB_HOST,DB_NAME,DB_USER, andDB_PASSwith your MySQL credentials. - Ensure
SQLITE_DBpoints to a writable location for the SQLite database file.
- Create a MySQL database named
cracker. - Create a table
not_so_smart_userswith the following SQL:
CREATE TABLE not_so_smart_users (
user_id VARCHAR(10) PRIMARY KEY,
password VARCHAR(255) NOT NULL
);- Insert sample data (e.g., hashed passwords using the salter function from the code):
INSERT INTO not_so_smart_users (user_id, password) VALUES
('2615', 'e7d8f2a5b8e4c9d1f3a2b5c8e7d9f0a1'), -- Hash of "87411"
('2562', 'd1c2e3f4a5b6c7d8e9f0a1b2c3d4e5f6'); -- Hash of "11223"- The
passwordcolumn should contain MD5 hashes of passwords concatenated with theSALTvalue.
Create a dictionary.txt file in the root directory with lowercase words (max 6 characters), one per line:
monkey
london
paris
Ensure the file is readable by the web server.
- Place the
password-crackerdirectory in your web server’s document root (e.g.,/var/www/htmlfor Apache). - Ensure PHP is configured to handle
.phpfiles.
Run the following command to build and start the Docker containers:
docker-compose up --build -dThis will:
- Build the PHP application image.
- Start a MySQL container with the
crackerdatabase. - Map port
8080on your host to port80in the container.
Access the MySQL container to create the not_so_smart_users table:
docker exec -it password-cracker_db_1 mysql -uroot -p crackerRun the SQL commands as mentioned in step 4.
- Open your browser and navigate to
http://localhost:8080/index.html. - Click "Start Cracking" to initiate the process.
- Start Cracking: Click the "Start Cracking" button to begin the password cracking process.
- Select Category: Use the dropdown to filter results by "Easy," "Medium," or "Hard."
- Filter by User ID: Enter a
user_idin the filter input to show only matching results. - Clear Results: Click "Clear Results" to reset the table and category selection.
- Export Results: Click "Export Results" to download the cracked passwords as a
cracked_passwords.csvfile.
- Rate Limiting: Adjustable in
cracker.php(default: 5 requests per minute). - Timeout: Adjustable in
index.htmlAJAX call (default: 30 seconds). - Category Limits: Defined in
src/PasswordCategory.php(Easy: 4, Medium: 6, Hard: 1).
- Rate Limiting: Prevents abuse with a 5-request-per-minute limit.
- Headers: Includes
X-Content-Type-Options,X-Frame-Options, andContent-Security-Policyfor protection. - Credentials: Store sensitive data (e.g., database credentials) in the
.envfile; consider using a secrets manager in production. - HTTPS: Use HTTPS in production to encrypt data in transit.
- Error: "Too many requests": Wait 1 minute or adjust
$rateLimitand$timeWindowincracker.php. - Error: "Database error": Verify MySQL credentials and table existence.
- Error: "Dictionary file not found": Ensure
dictionary.txtexists and is readable. - No Results: Check the
not_so_smart_userstable for data and ensure passwords match the cracking patterns.
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name). - Commit changes (
git commit -m "Add feature-name"). - Push to the branch (
git push origin feature-name). - Open a pull request.
- Bootstrap for the UI components.
- jQuery for AJAX handling.
- PHP and MySQL/SQLite for backend processing.
- Customization: Replace
your-usernamewith your GitHub username and add aLICENSEfile if desired. - GitHub Integration: If hosted on GitHub, add a
.gitignorefile to exclude.env,vendor/, andhash_cache.db. - Documentation: The README assumes the code is functional as provided. If you encounter issues, update the "Troubleshooting" section accordingly.