UAForge - UserAgent Generator
A powerful Python library and CLI tool for generating realistic, random user agent strings for Chrome, Firefox, and Opera browsers across multiple platforms.
Features
- Multi-browser support: Generate user agents for Chrome, Firefox, and Opera
- Cross-platform: Supports Windows, Linux, macOS, Android, and iOS
- Real version data: Uses real browser version information from official sources
- Realistic combinations: Creates plausible user agent strings that mimic real browsers
- SQLite database: Stores version data locally for fast access
- Auto-update: Fetch latest browser versions from official sources
- CLI interface: Easy command-line usage
- Python API: Simple integration into Python projects
Installation
From PyPI (Recommended)
pip install uaforge
Quick Start
Using the CLI
Initialize the database (first-time setup):
uaforge --init
Generate a single user agent:
# Random browser user agent
uaforge
# Specific browser
uaforge --browser Chrome
uaforge --browser Firefox
uaforge --browser Opera
# Generate 10 Chrome user agents
uaforge --count 10 --browser Chrome
# Save to file
uaforge --count 50 --output useragents.txt --browser Firefox
Update browser versions:
# Update all versions
uaforge --update all
# Update specific browser
uaforge --update chrome
uaforge --update firefox
uaforge --update opera
uaforge --update android
uaforge --update mac
Using Python API
from uaforge import generate_user_agent, generate_multiple, update_versions
# Generate a single user agent
ua = generate_user_agent("Chrome")
print(ua)
# Generate multiple user agents
ua_list = generate_multiple(5)
for agent in ua_list:
print(agent)
# Update browser versions
update_versions("all")
Advanced Usage
from uaforge.core.user_agent import UserAgentGenerator
# Create a custom generator
generator = UserAgentGenerator()
# Generate specific types
chrome_agent = generator.create_useragent("Chrome")
firefox_agent = generator.create_useragent("Firefox")
opera_agent = generator.create_useragent("Opera")
# Get a batch of agents
agents = generator.get_list(100)
Command Line Reference
| Option | Short | Description |
|---|---|---|
| --count | -c | Number of user agents to generate (default: 1) |
| --browser | -b | Browser type: Chrome, Firefox, Opera, random (default: random) |
| --output | -o | Output file to save user agents |
| --update | -u | Update version information: all, chrome, firefox, opera, android, windows, linux, mac |
| --init | Initialize database with initial data | |
| --version | -v | Show version information |
Examples
# Show version
uaforge --version
# Initialize database
uaforge --init
# Update all versions
uaforge --update all
# Generate 5 Firefox user agents
uaforge --count 5 --browser Firefox
# Generate 100 random user agents and save to file
uaforge --count 100 --output agents.txt
# Generate a single Chrome user agent
uaforge --browser Chrome
Database Structure
- Browser versions: Chrome, Firefox, Opera version history
- Platform information: Windows, Linux, macOS, Android system strings
- Version types: Architecture and build types for each platform
- Release dates: Version release information
- Database location: ~/.useragent_generator/data/useragent.db
Supported Platforms and Browsers
Browsers
- Google Chrome (desktop & mobile)
- Mozilla Firefox (desktop & mobile)
- Opera (desktop & mobile)
Operating Systems
- Windows (NT 6.0 to NT 10.0)
- Linux (X11 variants)
- macOS (10.15 to 14.0)
- Android (10 to 14)
- iOS (simulated via macOS strings)
Architectures
- Windows: x64, WOW64
- Linux: i686, x86_64
- Android: armv7l, armv8l
Project Structure
uaforge/
├── core/
│ ├── __init__.py # init file
│ ├── database.py # SQLite database operations
│ ├── user_agent.py # Main user agent generator
│ ├── version_fetcher.py # Fetch versions from web
│ └── version_updater.py # Update database with new versions
├── data/
│ └── useragent.db # SQLite database file
├── cli.py # Command-line interface
├── utils.py # Utility functions
└── __init__.py # Package exports
Development
# Clone the repository
git clone https://github.com/bolgac/uaforge.git
cd uaforge
# Install in development mode
pip install -e .[dev]
# Run tests
python -m pytest
# Build distribution
python setup.py sdist bdist_wheel
Common Issues and Solutions
Database Not Found
uaforge --init
Empty User Agents
uaforge --update all
Network Issues
- Check your internet connection
- Use --init for offline mode with sample data
- Configure proxy if needed
Permission Errors
- Run with appropriate permissions
- Check database file permissions
Contributing
Feel free to fork this project, submit PRs, or suggest features via GitHub Issues!
We welcome contributions of all kinds:
- Bug reports and fixes
- New features and enhancements
- Documentation improvements
- Testing and code quality improvements
Contact
- GitHub Issues – for bugs and feedback
- Email –
bytearchsoft@gmail.com(for business inquiries or sponsorships)
License
This project is licensed under the MIT License — see the LICENSE file for details.
Acknowledgments
-
Browser version data from official sources:
-
Inspired by various user agent generation libraries
-
Contributors and testers
Metadata
Release files for UAForge 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uaforge-1.1.2.tar.gz | 47.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uaforge-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 97.8 kB
Release files / uaforge-1.1.2.tar.gz
| Download URL | uaforge-1.1.2.tar.gz |
|---|---|
| Size | 47.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06e65945b614559833789def196ba67b9d1e730bf5931c07c4f43f8a9c239122
|
|
BLAKE2b-256 checksum How to use checksums |
cbc70ec7b96498692028a7e05edad625a17496844500f0d628215431cebee191
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|
Release files / uaforge-1.1.2-py3-none-any.whl
| Download URL | uaforge-1.1.2-py3-none-any.whl |
|---|---|
| Size | 49.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dac891981a0c149643a2db5d0b73bef09ff5b8db0efe5e9b692d04b99668b9ac
|
|
BLAKE2b-256 checksum How to use checksums |
210bbb5e9f4d93344683690be3adeee330078dbe632ea3cc99923f4c91d9f726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.13
|