A powerful Python library and CLI tool for generating realistic, random user agent strings for Chrome, Firefox, and Opera browsers across multiple platforms.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uaforge-1.1.1.tar.gz.
File metadata
- Download URL: uaforge-1.1.1.tar.gz
- Upload date:
- Size: 47.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fb6adf9bd0fa9d073033d86723c2888bce1f58569e52d551f511e5a64d44455
|
|
| MD5 |
42404ff8378bcb86b528c42993ff8b25
|
|
| BLAKE2b-256 |
eeac47c10447b5262a39388899b36522296dc21770bb83f59f55ad2cb147432c
|
File details
Details for the file uaforge-1.1.1-py3-none-any.whl.
File metadata
- Download URL: uaforge-1.1.1-py3-none-any.whl
- Upload date:
- Size: 49.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d46a0c11193af5c1932a48d25e46aa82578b4a10c96f7417d6ffc885e211bce
|
|
| MD5 |
00854452ec28cdef3b59bd6c23cd942e
|
|
| BLAKE2b-256 |
e00a481ede74c371a6f7a5ab1a9897621c60b3711e5ca1810d31e8adf7b45933
|