Home

Awesome

Random User-Agent Generator (+2350 UA's) 🤖

Developed for PHP Classes Challenge!

The rand-ua project is a user-agent generator designed to provide random user-agent strings for various web browsers. This PHP library allows developers to easily generate random user-agent strings, which can be useful for web scraping, automated testing, and other applications that require varied user-agent headers.

Authors 👥

Tech Stack 🧑‍💻

Documents 📂

PoC ⚙️

<?php

// Composer autoloader.
require __DIR__ . '/vendor/autoload.php';

// Module namespace.
use Dant\RandUa\UserAgentGenerator;

// Get user-agent based on specified OS and Browser.
$specific_ua = UserAgentGenerator::create()->getUserAgent('Windows', 'edge');
// Get random user-agent.
$random_ua = UserAgentGenerator::create()->getRandomUserAgent();

// Possible output: Mozilla/5.0 (Windows NT 10.0) ...

Probabilities of each OS / Browser 🎲

General

Operational SystemQuantityRatioPercentageCommand
Windows12181218 / 236051,6%UserAgentGenerator::create()->getUserAgent('Windows')
Macintosh561561 / 236023,7%UserAgentGenerator::create()->getUserAgent('Macintosh')
X11 (Unix)581581 / 236024,6%UserAgentGenerator::create()->getUserAgent('X11')

Chrome

Operational SystemQuantityRatioPercentageCommand
Windows284284 / 60047,3%UserAgentGenerator::create()->getUserAgent('Windows', 'chrome')
Macintosh122122 / 60020,3%UserAgentGenerator::create()->getUserAgent('Macintosh', 'chrome')
X11 (Unix)194194 / 60032,3%UserAgentGenerator::create()->getUserAgent('X11', 'chrome')

Edge

Operational SystemQuantityRatioPercentageCommand
Windows66 / 875%UserAgentGenerator::create()->getUserAgent('Windows', 'edge')
Macintosh11 / 812,5%UserAgentGenerator::create()->getUserAgent('Macintosh', 'edge')
X11 (Unix)11 / 812,5%UserAgentGenerator::create()->getUserAgent('X11', 'edge')

Firefox

Operational SystemQuantityRatioPercentageCommand
Windows329329 / 58955,8%UserAgentGenerator::create()->getUserAgent('Windows', 'firefox')
Macintosh2525 / 5894,2%UserAgentGenerator::create()->getUserAgent('Macintosh', 'firefox')
X11 (Unix)235235 / 58939,8%UserAgentGenerator::create()->getUserAgent('X11', 'firefox')

Opera

Operational SystemQuantityRatioPercentageCommand
Windows415415 / 58670,8%UserAgentGenerator::create()->getUserAgent('Windows', 'opera')
Macintosh2323 / 5863,9%UserAgentGenerator::create()->getUserAgent('Macintosh', 'opera')
X11 (Unix)148148 / 58625,2%UserAgentGenerator::create()->getUserAgent('X11', 'opera')

Safari

Operational SystemQuantityRatioPercentageCommand
Windows184184 / 57731,8%UserAgentGenerator::create()->getUserAgent('Windows', 'safari')
Macintosh390390 / 57767,5%UserAgentGenerator::create()->getUserAgent('Macintosh', 'safari')
X11 (Unix)33 / 5770,5%UserAgentGenerator::create()->getUserAgent('X11', 'safari')

Contributing 🛠️

# Create a fork from the original repository and clone it.
git clone https://github.com/dantsec/rand-ua.git
# Enter into the project folder.
cd rand-ua/
# Create a new branch with the name feat-[BRANCH_NAME].
git checkout -b feat-[BRANCH_NAME]
# Make your changes and commit them.
git add . && git commit -m "YOUR_COMMIT_MESSAGE"
# Push your branch and open a pull request.
git push origin feat-[BRANCH_NAME]