X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=tools%2Fuagen.pl;h=94002fa5333045202b31547d9301f5f984aa0aa3;hp=48ea696d0b2d5ba5bdb2ae5096d051fd77474ceb;hb=2616e38ac513d1e4fc439fbca1197135f69e186b;hpb=6865dcf464b517a99ab8da6e8ece5cde409db474 diff --git a/tools/uagen.pl b/tools/uagen.pl index 48ea696d..94002fa5 100755 --- a/tools/uagen.pl +++ b/tools/uagen.pl @@ -3,8 +3,6 @@ ############################################################################################## # uagen (http://www.fabiankeil.de/sourcecode/uagen/) # -# $Id: uagen.pl,v 1.16 2011/06/29 20:29:58 fabiankeil Exp $ -# # Generates a pseudo-random Firefox user agent and writes it into a Privoxy action file # and optionally into a Mozilla prefs file. For documentation see 'perldoc uagen(.pl)'. # @@ -40,7 +38,7 @@ use Getopt::Long; use constant { - UAGEN_VERSION => 'uagen 1.1', + UAGEN_VERSION => 'uagen 1.2.1', UAGEN_LOGFILE => '/var/log/uagen.log', ACTION_FILE => '/etc/privoxy/user-agent.action', @@ -60,8 +58,8 @@ use constant { # are too lazy to check, but want to change them anyway, take the values you # see in the "Help/About Mozilla Firefox" menu. - BROWSER_VERSION => "5.0", - BROWSER_REVISION => '5.0', + BROWSER_VERSION => "17.0", + BROWSER_REVISION => '17.0', BROWSER_RELEASE_DATE => '20100101', }; @@ -133,7 +131,7 @@ sub generate_platform_and_os() { FreeBSD => { karma => 1, platform => 'X11', - architectures => [ 'i386', 'amd64', 'sparc64', 'alpha' ], + architectures => [ 'i386', 'amd64', 'sparc64' ], order_is_inversed => 0, }, OpenBSD => { @@ -204,7 +202,6 @@ sub generate_firefox_user_agent() { our $randomize_release_date; my $mozillaversion = '5.0'; - my $security = "U"; my $creation_time = $randomize_release_date ? generate_creation_time($browser_release_date) : $browser_release_date; @@ -212,8 +209,8 @@ sub generate_firefox_user_agent() { my ( $platform, $os_or_cpu ) = generate_platform_and_os; my $firefox_user_agent = - sprintf "Mozilla/%s (%s; %s; %s; %s; rv:%s) Gecko/%s Firefox/%s", - $mozillaversion, $platform, $security, $os_or_cpu, $locale, $browser_revision, + sprintf "Mozilla/%s (%s; %s; rv:%s) Gecko/%s Firefox/%s", + $mozillaversion, $platform, $os_or_cpu, $browser_revision, $creation_time, $browser_version; return $accept_language, $firefox_user_agent; @@ -235,7 +232,7 @@ sub log_to_file($) { return if $no_logging; - open(my $log_fd, ">>" . $logfile) || die "Writing " . $logfile . " failed"; + open(my $log_fd, ">>", $logfile) || die "Writing " . $logfile . " failed"; printf $log_fd UAGEN_VERSION . " ($logtime) $message\n"; close($log_fd); } @@ -277,7 +274,7 @@ sub write_action_file() { $action_file_content .= sprintf " +hide-user-agent{%s} \\\n}\n/\n", $user_agent; } - open(my $actionfile_fd, ">" . $action_file) + open(my $actionfile_fd, ">", $action_file) or log_error "Writing action file $action_file failed!"; print $actionfile_fd $action_file_content; close($actionfile_fd); @@ -295,7 +292,7 @@ sub write_prefs_file() { my $prefs_file_content = ''; my $prefsfile_fd; - if (open($prefsfile_fd, $mozilla_prefs_file)) { + if (open($prefsfile_fd, "<", $mozilla_prefs_file)) { while (<$prefsfile_fd>) { s@user_pref\(\"general.useragent.override\",.*\);\n?@@; @@ -312,7 +309,7 @@ sub write_prefs_file() { sprintf("user_pref(\"intl.accept_languages\", \"%s\");\n", $accept_language) unless $clean_prefs; - open($prefsfile_fd, ">" . $mozilla_prefs_file) + open($prefsfile_fd, ">", $mozilla_prefs_file) or log_error "Writing prefs file $mozilla_prefs_file failed!"; print $prefsfile_fd $prefs_file_content; close($prefsfile_fd);