moz-byteshift.pl
#!/usr/bin/perl
# moz-byteshift.pl
#Perl script to encode with a byte offset, used to create mozilla config
files:
# Byteshifting program for firefox's firefox.cfg files
# Mozilla uses a byteshift of 13
# To decode: moz-byteshift.pl -s -13 <firefox.cfg >firefox.cfg.txt
# To encode: moz-byteshift.pl -s 13 <firefox.cfg.txt >firefox.cfg
# To activate the firefox.cfg file, place the encoded firefox.cfg file
# into your C:\Program Files\Mozilla Firefox\ directory.
# Then add the following line to your
# C:\Program Files\Mozilla Firefox\greprefs\all.js file :
# pref("general.config.filename", "firefox.cfg");
use encoding 'latin1';
use strict;
use Getopt::Std;
use vars qw/$opt_s/;
getopts("s:");
if(!defined $opt_s) {
die "Missing shift\n";
}
my $buffer;
while(1) {
binmode(STDIN, ":raw");
my $n=sysread STDIN, $buffer, 1;
if($n == 0) {
last;
}
my $byte = unpack("c", $buffer);
$byte += 512 + $opt_s;
$buffer = pack("c", $byte);
binmode(STDOUT, ":raw");
syswrite STDOUT, $buffer, 1;
}
0 Comments:
Post a Comment
<< Home