This project generates unique random strings of varying lengths and saves them in a PostgreSQL database. Each generated string is unique, and the database is set up with constraints to prevent duplicates. The project demonstrates database connection handling, random string generation, and uniqueness checks.
- Project Overview
- Features
- Requirements
- Installation
- Usage
- Configuration
- Database Schema
- Code Structure
- Troubleshooting
- License
The Jailbrake Password Generator creates random strings with a mix of uppercase and lowercase letters, digits, and special characters, storing them in a PostgreSQL database. This tool can be helpful for generating secure passwords or unique identifiers.
- Generates random strings of specified lengths (from 8 to 16 characters).
- Saves each string to a PostgreSQL database with unique constraints.
- Supports generating and storing multiple unique strings in batches.
- Ensures no duplicate strings are saved to the database.
- Python 3.6+
- PostgreSQL
- Python libraries:
psycopg2
(for PostgreSQL database connection)random
andstring
(for random string generation)itertools
(for handling combinations if needed)
-
Clone the repository:
git clone https://github.com/gabrieltonyy/JAILBREAK.git cd JailbrakePasswordGenerator
-
Install required Python packages:
pip install psycopg2
-
Set up PostgreSQL:
- Ensure PostgreSQL is running on your machine.
- Create a new PostgreSQL user if necessary, and give it privileges.
-
Configure Database Credentials: Open the script and update the PostgreSQL connection credentials:
db_name = "Jailbrake" user = "your_username" password = "your_password" host = "localhost" port = "5432"
-
Run the Script:
python jailbreak.py
-
Generated Data:
- The script will create a new PostgreSQL database (
Jailbrake
), apassword
table, and populate it with unique random strings. - You can configure the range of lengths and number of strings to generate by editing the
lengths
list andnum_strings_per_length
variable in themain
function.
- The script will create a new PostgreSQL database (
- Adjust the
lengths
list andnum_strings_per_length
in themain
function to control which string lengths are generated and how many of each.
The password
table schema is as follows:
- id:
SERIAL PRIMARY KEY
- Unique identifier for each record. - name:
VARCHAR(16) UNIQUE NOT NULL
- The generated unique string (up to 16 characters).
- create_database_and_table(): Sets up the PostgreSQL database and
password
table with a uniqueness constraint on thename
column. - generate_random_string(): Generates a random string of the specified length.
- insert_unique_random_string(): Inserts each unique random string into the database, checking for duplicates.
- main(): Manages the database setup and calls functions to generate and insert unique random strings.
-
Connection Errors:
- Ensure PostgreSQL is running and that your credentials in the script match your PostgreSQL setup.
-
Duplicate Strings:
- The code automatically checks for duplicates, but if duplicates are somehow inserted, verify the
UNIQUE
constraint on thename
column.
- The code automatically checks for duplicates, but if duplicates are somehow inserted, verify the
-
Batch Size Adjustment:
- If you encounter memory issues, adjust the batch size variable in the
insert_unique_random_string()
function.
- If you encounter memory issues, adjust the batch size variable in the
This project is licensed under the MIT License. See the LICENSE file for more details.
Feel free to customize the README further based on specific requirements or preferences.