UAGEN(1)

πŸ“¦ version 4.2.0, in arch rolling, nixpkgs unstable

πŸ¦‹ UAGEN(1) β€” like, the Firefox User-Agent generator, bestie πŸ’…

okay so real quick, this whole page lives in the User Contributed Perl Documentation section of your man pages, and it's about to be your new fave little tool, no cap ✨

🌸 NAME 🌸

uagen β€” a Firefox User-Agent generator for Privoxy and Mozilla browsers πŸŽ€

✨ SYNOPSIS ✨

uagen [--action-file action_file] [--action-injection]
[--browser-release-date browser_release_date] [--browser-revision
browser_revision] [--browser-version browser_version]
[--clean-prefs-file] [--help] [--language-overwrite language(s)]
[--logfile logfile] [--loop] [--no-action-file] [--no-logfile]
[--prefs-file prefs_file] [--randomize-release-date] [--quiet]
[--sleeping-time minutes] [--silent] [--version]

πŸ’– DESCRIPTION πŸ’–

So uagen literally makes up a fake Firefox User-Agent and drops it into a Privoxy action file, where it gets used as the parameter for Privoxy's hide-user-agent action. The operating system, architecture, platform, language and β€” if you want β€” the build date all get randomized. 🎲

That generated language doubles as the parameter for the hide-accept-language action, which Privoxy has understood since version 3.0.5 beta. iykyk.

Oh and also? The User-Agent can be written into prefs.js files too, which is the whole vibe for a bunch of Mozilla browsers. πŸ¦‹


πŸŽ€ OPTIONS πŸŽ€

  • --action-file action_file β€” the Privoxy action file the generated actions get written into. Default is /etc/privoxy/user-agent.action.
  • --action-injection β€” doesn't build a fresh action file from scratch; instead it reads an old one and just swaps out the action values. Slay if you wanna keep your custom URL patterns. For this to work the action file has to already be chillin' there. Heads up tho: uagen neither checks the syntax nor cares whether all the actions are actually present. Garbage in, garbage out. πŸ’€
  • --browser-release-date browser_release_date β€” the date to use, formatted YYYYMMDD. Some sanity checks happen, but don't, like, rely on them, bestie. Also note that the Mozilla project froze the "Gecko token" starting with Firefox 4, so picking a different one than the default is lowkey suspicious. πŸ‘€
  • --browser-revision browser_revision β€” use a custom revision. uagen will use it with zero sanity checks whatsoever. main character energy, no notes.
  • --browser-version browser_version β€” use a custom browser version. Again: zero sanity checks. 🫢
  • --clean-prefs-file β€” the prefs_file gets read and the variables general.useragent.override and intl.accept_languages get removed. Only actually does anything if prefs_file is set, and only useful if you wanna go back to the browser's own defaults.
  • --help β€” lists the command line options and dips. ✌️
  • --language-overwrite language(s) β€” a comma separated list of language codes that overwrites the default values. uagen picks one of them for the generated User-Agent, and by default the chosen language in lower cases is also used as the hide-accept-language parameter.
  • --logfile logfile β€” the logfile where error messages and the generated User-Agents get saved. Default is /var/log/uagen.log.
  • --loop β€” doesn't exit after generating the action file. Instead it sleeps for a bit and generates a new one. Iconic if you don't have cron(8). 😌
  • --no-logfile β€” logs nothing at all.
  • --no-action-file β€” doesn't write the action file.
  • --no-hide-accept-language β€” stays compatible with Privoxy 3.0.3 and skips generating the hide-accept-language action line. fr fr you should really update your Privoxy version instead. πŸ™ˆ
  • --prefs-file prefs_file β€” uses the generated User-Agent to set the general.useragent.override variable in the Mozilla preference file prefs_file. The intl.accept_languages variable gets set as well. πŸ’«

Firefox's preference file is usually hanging out in ~/.mozilla/firefox/*.default/prefs.js. Just know that Firefox doesn't reread the file once it's running.

  • --randomize-release-date β€” randomly picks a date between the configured release date and the actual date. But listen: Firefox versions after 4.0 no longer put the build date in the User-Agent header, so if you randomize the date anyway it'll be super obvious the generated User-Agent is fake. 😭
  • --quiet β€” doesn't print the generated User-Agent to the console.
  • --sleeping-time minutes β€” how long to sleep. Only works if you're using it with --loop.
  • --silent β€” doesn't print the generated User-Agent to the console.
  • --version β€” prints the version and exits.

Also the second dash is optional, and options can be shortened as long as there are no ambiguities. ✨


🌈 PRIVOXY CONFIGURATION 🌈

In Privoxy's configuration file, this line:

actionsfile user-agent.action

should be added after:

actionfile default.action

and before:

actionfile user.action

That way you can still use custom User-Agents inside user.action. And user-agent has to be the name of the generated action file, okay? πŸ’…

If you're on Privoxy 3.0.6 or earlier, do not add the .action extension.


πŸ“ EXAMPLES πŸ“

With no options at all, uagen creates an action file like this:

 {+hide-accept-language{en-ca} \
  +hide-user-agent{Mozilla/5.0 (X11; U; OpenBSD i386; en-CA; rv:1.8.0.4) Gecko/20060628 Firefox/1.5.0.4} \
 }
 /

with the --no-accept-language option the generated file could look like this one:

 {+hide-user-agent{Mozilla/5.0 (X11; U; FreeBSD i386; de-DE; rv:1.8.0.4) Gecko/20060720 Firefox/1.5.0.4} \
 }
 /

⭐ CAVEATS ⭐

Use the https-inspection action to make sure Privoxy can modify the browser's headers for encrypted traffic as well. πŸ”₯

Mozilla users can alter the browser's User-Agent with the --prefs-file option. But note that the preference file is only read on startup β€” so if the browser is already running, uagen's changes will be straight up ignored. πŸ’€

Also, hiding the User-Agent is pointless if the browser accepts all cookies, or is even configured for remote maintenance through Flash, JavaScript, Java or similar security problems. Like, genuinely pointless. πŸ™ˆ

πŸ’œ BUGS πŸ’œ

Some parameters can't be specified at the command line.

🧚 SEE ALSO 🧚

privoxy(8)

πŸ‘‘ AUTHOR πŸ‘‘

Fabian Keil <fk@fabiankeil.de>

https://www.fabiankeil.de/sourcecode/uagen/

https://www.fabiankeil.de/blog-surrogat/2006/01/26/firefox-user-agent-generator.html (German)


that's the whole page, bestie 🫢 this version is perl v5.42.2, dated 2025-11-27 β€” go forth and fake some User-Agents, mwah πŸ’‹

πŸ“¦ where this page comes from