# UAGEN

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
PRIVOXY CONFIGURATION
EXAMPLES
CAVEATS
BUGS
SEE ALSO
AUTHOR

## 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

uagen generates a fake Firefox User-Agent and writes it into a Privoxy action file as parameter for Privoxy’s hide-user-agent action. Operating system, architecture, platform, language and, optionally, the build date are randomized.

The generated language is also used as parameter for the hide-accept-language action which is understood by Privoxy since version 3.0.5 beta.

Additionally the User-Agent can be written into prefs.js files which are used by many Mozilla browsers.

## OPTIONS

--action-file action_file Privoxy action file to write the generated actions into. Default is /etc/privoxy/user-agent.action.

--action-injection Don’t generate a new action file from scratch, but read an old one and just replace the action values. Useful to keep custom URL patterns. For this to work, the action file has to be already present. uagen neither checks the syntax nor cares if all actions are present. Garbage in, garbage out.

--browser-release-date browser_release_date Date to use. The format is YYYYMMDD. Some sanity checks are done, but you shouldn’t rely on them. Note that the Mozilla project has frozen the "Gecko token" starting with Firefox 4 so using a different one than the default is somewhat suspicious.

--browser-revision browser_revision Use a custom revision. uagen will use it without any sanity checks.

--browser-version browser_version Use a custom browser version. uagen will use it without any sanity checks.

--clean-prefs-file The prefs_file is read and the variables general.useragent.override and intl.accept_languages are removed. Only effective if prefs_file is set, and only useful if you want to use the browser’s defaults again.

--help List command line options and exit.

--language-overwrite language(s) Comma separated list of language codes to overwrite the default values. uagen chooses one of them for the generated User-Agent, by default the chosen language in lower cases is also used as hide-accept-language parameter.

--logfile logfile Logfile to save error messages and the generated User-Agents. Default is /var/log/uagen.log.

--loop Don’t exit after the generation of the action file. Sleep for a while and generate a new one instead. Useful if you don’t have cron(8).

--no-logfile Don’t log anything.

--no-action-file Don’t write the action file.

--no-hide-accept-language Stay compatible with Privoxy 3.0.3 and don’t generate the hide-accept-language action line. You should really update your Privoxy version instead.

--prefs-file prefs_file Use the generated User-Agent to set the general.useragent.override variable in the Mozilla preference file prefs_file, The intl.accept_languages variable will be set as well.

Firefox’s preference file is usually located in ˜/.mozilla/firefox/*.default/prefs.js. Note that Firefox doesn’t reread the file once it is running.

--randomize-release-date Randomly pick a date between the configured release date and the actual date. Note that Firefox versions after 4.0 no longer provide the build date in the User-Agent header, so if you randomize the date anyway, it will be obvious that the generated User-Agent is fake.

--quiet Don’t print the generated User-Agent to the console.

--sleeping-time minutes Time to sleep. Only effective if used with --loop.

--silent Don’t print the generated User-Agent to the console.

--version Print version and exit.

The second dash is optional, options can be shortened, as long as there are no ambiguities.

## PRIVOXY CONFIGURATION

In Privoxy’s configuration file the line:

actionsfile user-agent.action

should be added after:

actionfile default.action

and before:

actionfile user.action

This way the user can still use custom User-Agents in user.action. user-agent has to be the name of the generated action file.

If you are using Privoxy 3.0.6 or earlier, don’t add the ".action" extension.

## EXAMPLES

Without any options, uagen creates an action file like:

{+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. If the browser is already running, uagen’s changes will be ignored.

Hiding the User-Agent is pointless if the browser accepts all cookies or even is configured for remote maintenance through Flash, JavaScript, Java or similar security problems.

## 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)