Permalink
Browse files

decided between JS packers

  • Loading branch information...
gregdingle committed Dec 16, 2008
1 parent 4fd75bb commit 9b816becc7851bb4969d0dd2b1337fd3b1688c70
View
@@ -0,0 +1,2 @@
+cp genetify/genetify.js genetify.js.BACKUP
+./jsmin.py < genetify/genetify.js.BACKUP > genetify/genetify.js
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,207 +0,0 @@
-#ParseMaster (July 25 2005)
-# Based on "ParseMaster.js" by Dean Edwards <http://dean.edwards.name/>
-# Ported to Perl by Rob Seiler, ELR Software Pty Ltd <http://www.elr.com.au>
-# Copyright 2005. License <http://creativecommons.org/licenses/LGPL/2.1/>
-
-package ParseMaster;
-use strict;
-use Data::Dumper;
-
-# Package wide variable declarations
-use vars qw/$VERSION
- @_X_escaped @_X_patterns
- /;
-
-$VERSION = '017';
-
-# constants
-my $X_EXPRESSION = 0;
-my $X_REPLACEMENT = 1;
-my $X_LENGTH = 2;
-
-# re's used to determine nesting levels
-my $X_GROUPS = qr/\(/o; # NB: Requires g modifier!
-my $X_SUB_REPLACE = qr/\$\d/o;
-my $X_INDEXED = qr/^\$\d+$/o;
-my $XX_ESCAPE = qr/\\./o; # NB: Requires g modifier!
-my $XX_DELETED = qr/\001[^\001]*\001/o; # NB: Requires g modifier!
-my $DIGIT = qr/[^\D]/o; # Yep - this is a digit - contains no non-digits
-
-# Constructor
-sub new {
- my $class = shift;
- my $self = {};
- @_X_escaped = (); # Re-initialize global for each instance
- @_X_patterns = (); # Re-initialize global for each instance
- # Instance variables - access by similarly named set/get functions
- $self->{_ignoreCase_} = 0;
- $self->{_escapeChar_} = '';
- bless ($self, $class);
- return $self;
-}
-
-sub ignoreCase {
- my ($self, $value) = @_;
- if (defined($value)) {
- $self->{_ignoreCase_} = $value;
- }
- return $self->{_ignoreCase_};
-}
-
-sub escapeChar{
- my ($self, $value) = @_;
- if (defined($value)) {
- $self->{_escapeChar_} = $value;
- }
- return $self->{_escapeChar_};
-}
-
-#######################
-# Public Parsemaster functions
-
-my $X_DELETE = sub(@$) {
- my $X_offset = pop;
- my @X_match = @_;
- return (chr(001) . $X_match[$X_offset] . chr(001));
-}; # NB semicolon required for closure!
-
-# create and add a new pattern to the patterns collection
-sub add {
- my ($self, $expression, $X_replacement) = @_;
- if (!$X_replacement) {$X_replacement = $X_DELETE};
-
- # count the number of sub-expressions
- my $temp = &_X_internalEscape($expression);
- my $length = 1; # Always at least one because each pattern is itself a sub-expression
- $length += $temp =~ s/$X_GROUPS//g; # One way to count the left capturing parentheses in the regexp string
-
- # does the pattern deal with sub-expressions?
- if ((ref($X_replacement) ne "CODE") && ($X_replacement =~ m/$X_SUB_REPLACE/)) {
- if ($X_replacement =~ m/$X_INDEXED/) { # a simple lookup? (eg "$2")
- # store the index (used for fast retrieval of matched strings)
- $X_replacement = substr($X_replacement,1) - 1;
- }
- else { # a complicated lookup (eg "Hello $2 $1")
- my $i = $length;
- while ($i) { # Had difficulty getting Perl to do Dean's splitting and joining of strings containing $'s
- my $str = '$a[$o+' . ($i-1) . ']'; # eg $a[$o+1]
- $X_replacement =~ s/\$$i/$str/; # eg $2 $3 -> $a[$o+1] $a[$o+2]
- $i--;
- }
- # build a function to do the lookup - returns interpolated string of array lookups
- $X_replacement = eval('sub {my $o=pop; my @a=@_; return "' . $X_replacement . '"};');
- }
- }
- else {}
- # pass the modified arguments
- &_X_add($expression || q/^$/, $X_replacement, $length);
-}
-
-# execute the global replacement
-sub exec {
-#print Dumper(@_X_patterns);
- my ($self, $X_string) = @_;
- my $escChar = $self->escapeChar();
- my $ignoreCase = $self->ignoreCase();
- my ($regexp,$captures) = &_getPatterns(); # Concatenated and parenthesized regexp eg '(regex1)|(regex2)|(regex3)' etc
- $X_string = &_X_escape($X_string, $escChar);
- if ($ignoreCase) {$X_string =~ s/$regexp/{&_X_replacement(&_matchVars($captures,\$X_string))}/gie} # Pass $X_String as a
- else {$X_string =~ s/$regexp/{&_X_replacement(&_matchVars($captures,\$X_string))}/ge} # reference for speed
-
- $X_string = &_X_unescape($X_string, $escChar);
- $X_string =~ s/$XX_DELETED//g;
- return $X_string;
-}
-
-sub _X_add {
- push (@_X_patterns, [@_]); # Save each argument set as is into an array of arrays
-}
-
-# this is the global replace function (it's quite complicated)
-sub _X_replacement {
- my (@arguments) = @_;
-#print Dumper (@arguments);
- if ($arguments[0] le '') {return ''}
- # Dereference last index (source String) here - faster than in _matchVars (maybe not needed at all?)
- $arguments[$#arguments] = ${$arguments[$#arguments]};
- my $i = 1;
- # loop through the patterns
- for (my $j=0; $j<scalar(@_X_patterns); $j++) { # Loop through global all @_X_patterns
- my @X_pattern = @{$_X_patterns[$j]};
- # do we have a result? NB: "if ($arguments[$i])" as in Dean's Javascript is false for the value 0!!!
- if ((defined $arguments[$i]) && ($arguments[$i] gt '')) {
- my $X_replacement = $X_pattern[$X_REPLACEMENT];
- # switch on type of $replacement
- if (ref($X_replacement) eq "CODE") { # function
- return &$X_replacement(@arguments,$i);
- }
- elsif ($X_replacement =~ m/$DIGIT/) { # number (contains no non-digits)
- return $arguments[$X_replacement + $i];
- }
- else { # default
- return $X_replacement; # default
- }
- } # skip over references to sub-expressions
- else {$i += $X_pattern[$X_LENGTH]}
- }
-}
-
-#######################
-# Private functions
-#######################
-
-# encode escaped characters
-sub _X_escape {
- my ($X_string, $X_escapeChar) = @_;
- if ($X_escapeChar) {
- my $re = '\\'.$X_escapeChar.'(.)';
- $X_string =~ s/$re/{push(@_X_escaped,$1); $X_escapeChar}/ge;
- }
- return $X_string;
-}
-
-# decode escaped characters
-sub _X_unescape {
- my ($X_string, $X_escapeChar) = @_;
- if ($X_escapeChar) { # We'll only do this if there is an $X_escapeChar!
- my $re = '\\'.$X_escapeChar;
- $X_string =~ s/$re/{$X_escapeChar . (shift(@_X_escaped))}/ge; # Don't use Dean Edwards as below 'or' here - because zero will return ''!
- # $X_string =~ s/$re/{$X_escapeChar . (shift(@_X_escaped) || '')}/ge;
- }
- return $X_string;
-}
-
-sub _X_internalEscape {
- my ($string) = shift;
- $string =~ s/$XX_ESCAPE//g;
- return $string;
-}
-
-# Builds an array of match variables to (approximately) emulate that available in Javascript String.replace()
-sub _matchVars {
- my ($m,$sref) = @_;
- my @args = (1..$m); # establish the number potential memory variables
- my @mv = map {eval("\$$_")} @args; # matchvarv[1..m] = the memory variables $1 .. $m
- unshift (@mv, $&); # matchvar[0] = the substring that matched
- push (@mv, length($`)); # matchvar[m+1] = offset within the source string where the match occurred (= length of prematch string)
- push (@mv, $sref); # matchvar[m+2] = reference to full source string (dereference in caller if/when needed)
-#print Dumper (@mv);
- return @mv;
-}
-
-sub _getPatterns {
- my @Patterns = ();
- my $lcp = 0;
- for (my $i=0; $i<scalar(@_X_patterns); $i++) { # Loop through global all @_patterns
- push (@Patterns, $_X_patterns[$i][$X_EXPRESSION]); # accumulate the expressions
- $lcp += $_X_patterns[$i][$X_LENGTH]; # sum the left capturing parenthesis counts
- }
- my $str = "(" . join(')|(',@Patterns). ")"; # enclose each pattern in () separated by "|"
- return ($str, $lcp);
-}
-
-##################
-# END #
-##################
-1; # ParseMaster #
-##################
View
@@ -1,38 +0,0 @@
-<html><head><title>Packed script example page</title>
-
-<!-- Here is where the library script is inserted -->
-<script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('24 H(){r 9=d.L.23();7.a=K(d.j);7.D=22(d.j);7.b=((9.8(\'21\')!=-1)&&(9.8(\'20\')==-1)&&(9.8(\'1Z\')==-1)&&(9.8(\'o\')==-1)&&(9.8(\'F\')==-1));7.Z=(7.b&&(7.a==2));7.Y=(7.b&&(7.a==3));7.E=(7.b&&(7.a==4));7.1Y=(7.b&&(7.a>=4));7.1X=(7.b&&((9.8(";b")!=-1)||(9.8("; b")!=-1)));7.V=(7.b&&(7.a==5));7.1W=(7.b&&(7.a>=5));7.i=(9.8("G")!=-1);7.p=(7.i&&(7.a<4));7.n=(7.i&&(7.a==4)&&(9.8("G 5.0")==-1));7.1V=(7.i&&(7.a>=4));7.W=(7.i&&(7.a==4)&&(9.8("G 5.0")!=-1));7.1U=(7.i&&!7.p&&!7.n);7.q=(9.8("q")!=-1);7.1T=(7.q&&7.p);7.1S=(7.q&&7.n);7.o=(9.8("o")!=-1);7.F=(9.8("F")!=-1);e(7.Z||7.p)7.f=1.0;c e(7.Y||7.o)7.f=1.1;c e((7.E&&(7.D<=4.X))||7.n)7.f=1.2;c e((7.E&&(7.D>4.X))||7.W)7.f=1.3;c e(7.V)7.f=1.4;c e(7.b&&(7.a>5))7.f=1.4;c e(7.i&&(7.a>5))7.f=1.3;c 7.f=0.0;7.U=((9.8("U")!=-1)||(9.8("T")!=-1));7.B=((9.8("B")!=-1)||(9.8("h 1R")!=-1));7.C=((9.8("C")!=-1)||(9.8("T")!=-1)||(9.8("h 3.1")!=-1)||(9.8("h 16-S")!=-1));7.1Q=((9.8("h 3.1")!=-1)||(9.8("C")!=-1)||(9.8("h 16-S")!=-1));7.z=((9.8("z")!=-1)||(9.8("h 1P")!=-1));7.A=((9.8("A")!=-1)||(9.8("h 1O")!=-1));7.R=(7.B||7.A||7.z||((7.a>=4)&&(d.1N=="1M"))||(9.8("R")!=-1)||(9.8("1L")!=-1));7.1K=((9.8("1J/2")!=-1)||(d.j.8("1I/2")!=-1)||(9.8("1H-1G")!=-1));7.m=(9.8("m")!=-1);7.1F=(7.m&&((9.8("1E")!=-1)||(9.8("1D")!=-1)));7.1C=(7.m&&((9.8("1B")!=-1)||(9.8("1A")!=-1)));7.x=(9.8("y")!=-1);7.1z=(9.8("y 4")!=-1);7.1y=(9.8("y 5")!=-1);7.1x=(7.x&&(9.8("1w")!=-1));7.k=(9.8("k")!=-1);7.1v=(9.8("k 5")!=-1);7.Q=((9.8("k 6")!=-1)||(9.8("Q")!=-1));7.l=(9.8("1u-1t")!=-1);7.1s=(7.l&&(9.8("1r.")!=-1));7.1q=(7.l&&(9.8("10.")!=-1));7.g=(9.8("g")!=-1);7.1p=(9.8("g 1")!=-1);7.1o=(9.8("g 2")!=-1);7.1n=(9.8("g 3")!=-1);7.1m=(9.8("g 4")!=-1);7.M=(9.8("1l")!=-1);7.w=(9.8("w")!=-1)||(9.8("1k")!=-1);7.P=(9.8("1j")!=-1);7.O=(9.8("1i")!=-1);7.N=(9.8("1h")!=-1);7.v=((9.8("v")!=-1)||(9.8("1g")!=-1)||(9.8("1f")!=-1)||(9.8("1e")!=-1)||(9.8("1d")!=-1)||(9.8("1c")!=-1));7.u=(9.8("u")!=-1);7.s=(9.8("s")!=-1);7.t=(9.8("t")!=-1);7.1b=((9.8("1a")!=-1)||7.x||7.k||7.l||7.w||7.P||7.O||7.N||7.v||7.u||7.g||7.M||7.t||7.s);7.19=((9.8("18")!=-1)||(9.8("17")!=-1))}r I;r J=15;e((d.j.8("14")!=-1)&&(d.L.8("13")!=-1)&&(K(d.j)==3))J=12;c I=11 H();',62,129,'|||||||this|indexOf|agt|major|nav|else|navigator|if|js|aix|windows|ie|appVersion|irix|hpux|mac|ie4|opera|ie3|aol|var|freebsd|bsd|sinix|dec|sco|sun|sunos|win98|winnt|win95|win16|minor|nav4|webtv|msie|Is|is|isIE3Mac|parseInt|userAgent|linux|reliant|mpras|unixware|irix6|win32|bit|16bit|win|nav5|ie5|05|nav3|nav2||new|true|MSIE|Mac|false||openvms|vax|vms|x11|unix|alphastation|ultrix|alphaserver|dec_alpha|osf1|reliantunix|ncr|unix_system_v|unix_sv|inux|aix4|aix3|aix2|aix1|hpux10|09|hpux9|ux|hp|irix5|i86|suni86|sun5|sun4|powerpc|ppc|macppc|68000|68k|mac68k|webexplorer|ibm|OS|os|os2|32bit|Win32|platform|nt|98|win31|95|aol4|aol3|ie5up|ie4up|nav5up|navonly|nav4up|compatible|spoofer|mozilla|parseFloat|toLowerCase|function'.split('|'),0,{}))
-</script>
-<!-->
-
-</head><body>
-<center>
-<h1>Packed Javascript</h1>
-
-<p>
-Javascript contained within this page has been packed using using <br>
-Packer [SamplePacker.exe] v1.01b[p024-pm017]<br>
-a JavaScript Compressor/Obfuscator developed by Dean Edwards <<a href="http://dean.edwards.name/">http://dean.edwards.name/</a>><br>
-and ported to Perl by Rob Seiler, ELR Software Pty Ltd <<a href="http://www.elr.com.au/">http://www.elr.com.au</a>><br>
-Copyright 2005. License <a href="http://creativecommons.org/licenses/LGPL/2.1/">http://creativecommons.org/licenses/LGPL/2.1/</a>>
-</p>
-</center>
-
-<h2>Profile of your Browser</h2>
-<p>Here are the results of running the packed JavaScript code in the browser you are using.
-If you are seeing bowser vendor, version, and operating system data, the packed scripts are functioning properly.</p>
-
-<!-- Here is where the local block scripts are inserted -->
-<h3>Bascic Data</h3> <script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3.2("0.6 "+0.6+"<1>");3.2("0.5"+0.5+"<1>");3.2("0.4"+0.4+"<1>");',7,7,'navigator|br|write|document|appVersion|userAgent|appName'.split('|'),0,{}))
-</script>
-<h3>Version Number</h3> <script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('5.4("<0>6:"+3.6+"</0><1>");5.4("<0>2:"+3.2+"</0><1>");',7,7,'TT|br|minor|is|write|document|major'.split('|'),0,{}))
-</script>
-<h3>Browser Version</h3> <script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--)d[c.toString(a)]=k[c]||c.toString(a);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3.2("n:"+1.n+"<0>");3.2("m:"+1.m+"<0>");3.2("l:"+1.l+"<0>");3.2("k:"+1.k+"<0>");3.2("j:"+1.j+"<0>");3.2("i:"+1.i+"<0>");3.2("h:"+1.h+"<0>");3.2("g:"+1.g+"<0>");3.2("<4>"+"f:"+1.f+"<0>");3.2("e:"+1.e+"<0>");3.2("d:"+1.d+"<0>");3.2("c:"+1.c+"<0>");3.2("b:"+1.b+"<0>");3.2("a:"+1.a+"<0>");3.2("<4>"+"9:"+1.9+"<0>");3.2("8:"+1.8+"<0>");3.2("7:"+1.7+"<0>");3.2("<4>"+"6:"+1.6+"<0>");3.2("<4>"+"5:"+1.5+"<0>");',24,24,'br|is|write|document|P|webtv|opera|aol4|aol3|aol|ie5up|ie5|ie4up|ie4|ie3|ie|navonly|nav5up|nav5|nav4up|nav4|nav3|nav2|nav'.split('|'),0,{}))
-</script>
-<h3>JavaScript Version</h3><script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4.3("0:"+2.0+"<1>");',5,5,'js|br|is|write|document'.split('|'),0,{}))
-</script>
-<h3>OS</h3> <script language="JavaScript">eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3.2("F:"+1.F+"<0>");3.2("E:"+1.E+"<0>");3.2("D:"+1.D+"<0>");3.2("C:"+1.C+"<0>");3.2("B:"+1.B+"<0>");3.2("A:"+1.A+"<0>");3.2("z:"+1.z+"<0>");3.2("<4>"+"y:"+1.y+"<0>");3.2("<4>"+"x:"+1.x+"<0>");3.2("w:"+1.w+"<0>");3.2("v:"+1.v+"<0>");3.2("<4>"+"u:"+1.u+"<0>");3.2("t:"+1.t+"<0>");3.2("s:"+1.s+"<0>");3.2("r:"+1.r+"<0>");3.2("q:"+1.q+"<0>");3.2("p:"+1.p+"<0>");3.2("o:"+1.o+"<0>");3.2("n:"+1.n+"<0>");3.2("m:"+1.m+"<0>");3.2("l:"+1.l+"<0>");3.2("k:"+1.k+"<0>");3.2("j:"+1.j+"<0>");3.2("i:"+1.i+"<0>");3.2("h:"+1.h+"<0>");3.2("g:"+1.g+"<0>");3.2("f:"+1.f+"<0>");3.2("e:"+1.e+"<0>");3.2("d:"+1.d+"<0>");3.2("c:"+1.c+"<0>");3.2("b:"+1.b+"<0>");3.2("a:"+1.a+"<0>");3.2("9:"+1.9+"<0>");3.2("8:"+1.8+"<0>");3.2("7:"+1.7+"<0>");3.2("6:"+1.6+"<0>");3.2("<4>"+"5:"+1.5+"<0>");',42,42,'br|is|write|document|P|vms|freebsd|bsd|sinix|dec|reliant|mpras|unixware|sco|linux|aix4|aix3|aix2|aix1|aix|hpux10|hpux9|hpux|irix6|irix5|irix|suni86|sun5|sun4|sun|unix|macppc|mac68k|mac|os2|winnt|win98|win95|win32|win31|win16|win'.split('|'),0,{}))
-</script>
-<!-->
-
-</body></html>
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 9b816be

Please sign in to comment.