[K12OSN] Firefox Default Home Page

Timothy Legge timlegge at gmail.com
Mon Jan 28 15:55:48 UTC 2008


Hi

The best thing I have found for Firefox is the following script.  It
works great and can allow you to set even more options easily if you
need to:


--------BEGIN SCRIPT------------
#!/usr/bin/perl

# lock down browser homepage and proxy settings
# Andy Rabagliati <andyr at wizzy.com>
# http://wizzy.org.za/

use encoding 'latin1';
use strict;

sub usage() {
   print "Usage: $0 <hostname>\n";
   exit 1;
}

usage() if (@ARGV != 1);

my $hostname = $ARGV[0];

# Byteshifting program for mozilla's netscape.cfg files

# Old netscape 4.x uses a bytechift of 7
#   To decode: moz-byteshift.pl -s -7 <netscape.cfg >netscape.cfg.txt
#   To encode: moz-byteshift.pl -s  7 <netscape.cfg.txt >netscape.cfg

# Mozilla uses a byteshift of 13
#   To decode: moz-byteshift.pl -s -13 <netscape.cfg >netscape.cfg.txt
#   To encode: moz-byteshift.pl -s  13 <netscape.cfg.txt >netscape.cfg

# To activate the netscape.cfg file, place the encoded netscape.cfg file
# into your C:\Program Files\mozilla.org\Mozilla directory.
# Then add the following line to your
# C:\Program Files\mozilla.org\Mozilla\defaults\pref\all.js file :
# pref("general.config.filename", "mozilla.cfg");

my $buffer;
my $mozillacfg;

while ($_ = <DATA>) {
    $_ =~ s/_WIZZY_HOSTNAME_/$hostname/g;
    $buffer .= $_;
}

# lazy - but chop is convenient

$buffer = reverse ($buffer);

binmode(STDOUT, ":raw");

while(length($buffer)) {
  my $byte = ord(chop($buffer));
  $byte += 512 + 13;
  $mozillacfg .= pack("c", $byte);
}

# calling all browsers ..
my @all = glob("/usr/lib/*/greprefs/all.js");

for my $f (@all) {
    # read in file, skipping anything that mentions general.config.filename
    open(FILE, $f) || die "Cannot read $f: $!";
    undef ($buffer);
    while ($_ = <FILE>) {
        if ($_ !~ /general.config.filename/) {
            $buffer .= $_;
        }
    }
    close (FILE);
    # add our version of general.config.filename
    $buffer .= 'pref("general.config.filename","mozilla.cfg");//WIZZY' . "\n";
    # write it out again
    open (FILE, "> $f") || die "Cannot write to $f: $!";
    print FILE $buffer;
    close (FILE);
    # get path to mozilla.cfg
    $f =~ s:greprefs/all.js::;
    $f .= 'mozilla.cfg';
    # write it
    open (FILE, "> $f") || die "Cannot write to $f: $!";
    print FILE $mozillacfg;
    close (FILE);
}

__DATA__
// Wizzy mozilla defaults lockdown for _WIZZY_HOSTNAME_

//lockPref("browser.cache.disk.capacity", 0);
//defaultPref("security.warn_entering_secure", false);
//defaultPref("security.warn_submit_insecure", false);
defaultPref("browser.startup.homepage","http://www.google.ca");
//lockPref("network.http.pipelining", true);
//lockPref("network.http.proxy.pipelining", true);
//lockPref("network.http.pipelining.maxrequests", 10);
//lockPref("nglayout.initialpaint.delay", 0);
//lockPref("browser.cache.enable",false);
lockPref("browser.tabs.autoHide", false);
lockPref("network.proxy.type",1);
lockPref("network.proxy.share_proxy_settings", true);
lockPref("network.proxy.ftp","_WIZZY_HOSTNAME_");
lockPref("network.proxy.ftp_port",8080);
lockPref("network.proxy.http","_WIZZY_HOSTNAME_");
lockPref("network.proxy.http_port",8080);
lockPref("network.proxy.ssl","_WIZZY_HOSTNAME_");
lockPref("network.proxy.ssl_port",8080);
lockPref("network.proxy.gopher","_WIZZY_HOSTNAME_");
lockPref("network.proxy.gopher_port",8080);
lockPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");

--------END SCRIPT------------




More information about the K12OSN mailing list