ESC(第二类混淆)
GNU项目
http://www.saltstorm.net/downloads/esc/ESC.zip
将以下代码保存为
ESC.wsf
复制代码 代码如下:
<?xmlversion="1.0"?>
<>
<package>
<job>
<?joberror="false"debug="false"?>
<resourceid="about">
-----------------------------------------------------------------------------
ESC(ECMAScriptCruncher)
*Version:1.13
*Date:2005-02-0621:19:57[+0100]
*License:GNUGPL(http://www.gnu.org/copyleft/gpl.txt)
*Copyright(C)2001-2005ThomasLoo<tloo@saltstorm.net>
---------------------------------------------------------------------------
ESCisanECMAScript(*)pre-processorenablinganunlimitednumberof
externalscriptstobecompressed/crunchedintotight,bandwidth-optimized
packages.ESCsupportscompressingofexternalsourcesonly.Tryingto
processscriptsinlinedinHTML,ASP,PHPorequivalentpagesareNOT
recommendedwiththisversionofESC.Thisfeaturemightbeaddedina
futureversion.Type"cscriptESC.wsf-help"forusageinstructions.
ESCisbuiltusingcomponentsfromtheSoyaScriptingAPI1.0.0-b10,
auni-host/cross-browserECMAScriptcompliantclass-librarydistributed
freelyunderthetermsoftheBSDLicense.TheSoyaScriptingAPI,
'lib-soya'andtheSoyaSDKcanbefoundathttp://www.saltstorm.net/
---------------------------------------------------------------------------
*ECMAScriptistheinternationalstandardforjavascript.
-----------------------------------------------------------------------------
</resource>
<resourceid="copyright">
-----------------------------------------------------------------------------
Thisprogramisfreesoftware;youcanredistributeitand/ormodify
itunderthetermsoftheGNUGeneralPublicLicenseaspublishedby
theFreeSoftwareFoundation;eitherversion2oftheLicense,or
(atyouroption)anylaterversion.
Thisprogramisdistributedinthehopethatitwillbeuseful,
butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof
MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe
GNUGeneralPublicLicenseformoredetails.
YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense
alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation,Inc.,59TemplePlace,Suite330,Boston,MA02111-1307USA
-----------------------------------------------------------------------------
</resource>
<resourceid="usage">
------------------------------------------------------------------------------
Usage:cscriptESC.wsf-l[0-4]-owoutput.jsfoo.jsbar.jsC:scriptsbaz...
-----------------------------------------------------------------------------
-a[-about]:Descriptionpage
-c[-copyright]:Copyright/licensenotice
-e[-example]:Examplesofusage
-h[-help]:Thishelp-screen
-----------------------------------------------------------------------------
-l[-level][01(2)34]:[optional]Setcrunch-level(4sets-$on)
-s[-silent]:[optional]Runsilent,nadastdout
-v[-verbose]:[optional]Runinverbosemode
-$:[optional]Activatevariable-substitutionengine
-----------------------------------------------------------------------------
-oa<filename>:Targetfilenameforappending
-ow<filename>:Targetfilenameforwriting
-owSTDOUT:WritestreamtoSTDOUT
-----------------------------------------------------------------------------
<input-file(s)>:[required]
file(s)and/ordirectoriescontainingscriptstocrunch...
(pathscontainingspacesmustbequoted)
</resource>
<resourceid="example">
-----------------------------------------------------------------------------
Examplesofusage.
Crunch'original1.js','original2.js'and'original3.js'at
level2(default)andsavetheoutputas'crunched.js'.
Anypreviousfilenamed'crunched.js'willbeoverwritten.
X:cscriptESC.wsf-owcrunched.jsoriginal1.jsoriginal2.jsoriginal3.js
---------------------------------------------------------------------------
Graballscriptfiles(.js)indirectory'C:script-directory'andcrunch
thematlevel1(commentandemptylineremovalonly)andappendtheresult
to'crunched.js'.If'crunched.js'doesn'texist,itwillbecreated.
X:cscriptESC.wsf-l1-oacrunched.jsC:script-directory
---------------------------------------------------------------------------
Subject'original1.js'and'original2.js'forvariablesubstitution,
butperformnocommentorwhitespaceremoval.
RedirectoutputtoSTDOUTinsteadofwritingtofile.
X:cscriptESC.wsf-l0-$-owSTDOUToriginal1.jsoriginal2.js
---------------------------------------------------------------------------
Crunch'original.js'usingvariablesubstitutionandremove
anyoccuranceofwhitespace(wherepermitted...)
andsaveitas'crunched.js'(equals-l3-$)
X:cscriptESC.wsf-l4-owcrunched.jsoriginal.js
---------------------------------------------------------------------------
Try'ESC.wsf-help'forinformationaboutavailablerun-timedirectives.
-----------------------------------------------------------------------------
</resource>
<resourceid="wscript">
ESCmustberunfromaDOScommandpromptunder
cscript.exe.Doyouwanttoswitchhostandhave
ESCbringupahelpscreen?
</resource>
<resourceid="jscript">
ESCneedsJScript5.5orhighertoscore...
YouneedtoupdateyourversionofJScripttorunESC.
Readthe'Requirements'sectioninthemanualforinformation
howtoobtainandinstallthelatestversionofMicrosofts
'WindowsScript'package.
</resource>
<resourceid="common.map">
Anchor
ActiveXObject
Call
Closure
Components
Dictionary
Document
DOMParser
Embed
EvalError
Event
Form
Global
HttpCookie
Image
JavaArray
JavaClass
JavaMethod
JavaObject
JavaPackage
Layer
MimeType
MimeTypeArray
Option
Url
Packages
Plugin
PluginArray
Popup
RangeError
ReferenceError
TypeError
StyleClass
StyleSelector
SyntaxError
TypeError
WScript
URIError
XMLHttpRequest
XMLSerializer
XPathEvaluator
XSLTDocument
XSLTProcessor
Attr
CDATASection
CharacterData
Comment
CSS2Properties
DOMException
DOMImplementation
DocumentType
Element
EntityReference
EvalError
NamedNodeMap
Node
NodeList
Notation
ProcessingInstruction
Text
HTMLElement
HTMLDocument
HTMLCollection
HTMLHtmlElement
HTMLHeadElement
HTMLLinkElement
HTMLTitleElement
HTMLMetaElement
HTMLBaseElement
HTMLIsIndexElement
HTMLStyleElement
HTMLBodyElement
HTMLFormElement
HTMLSelectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLInputElement
HTMLTextAreaElement
HTMLButtonElement
HTMLLabelElement
HTMLFieldSetElement
HTMLLegendElement
HTMLUListElement
HTMLOListElement
HTMLDListElement
HTMLDirectoryElement
HTMLMenuElement
HTMLLIElement
HTMLBlockquoteElement
HTMLDivElement
HTMLParagraphElement
HTMLHeadingElement
HTMLQuoteElement
HTMLPreElement
HTMLBRElement
HTMLBaseFontElement
HTMLFontElement
HTMLHRElement
HTMLModElement
HTMLAnchorElement
HTMLImageElement
HTMLObjectElement
HTMLParamElement
HTMLAppletElement
HTMLMapElement
HTMLAreaElement
HTMLScriptElement
HTMLTableElement
HTMLTableCaptionElement
HTMLTableColElement
HTMLTableSectionElement
HTMLTableRowElement
HTMLTableCellElement
HTMLFrameSetElement
HTMLFrameElement
HTMLIFrameElement
_newEnum
alert
atob
attachEvent
back
btoa
captureEvents
clearTimeout
clearInterval
close
CollectGarbage
confirm
createEventObject
createPopup
decodeURI
decodeURIComponent
detachEvent
dump
encodeURI
encodeURIComponent
escape
eval
execScript
find
forward
frameElement
getAttention
GetAttention
getClass
getComputedStyle
getResource
GetObject
home
isFinite
isNaN
moveBy
moveTo
open
openDialog
parseInt
parseFloat
prompt
releaseEvents
resizeBy
resizeTo
ScriptEngine
ScriptEngineMajorVersion
ScriptEngineMinorVersion
ScriptEngineBuildVersion
scroll
scrollBy
scrollByLines
scrollByPages
scrollIntoView
scrollTo
setCursor
setInterval
setTimeout
showHelp
showModalDialog
showModelessDialog
sizeToContent
stop
taint
toString
updateCommands
unescape
untaint
valueOf
_content
appCore
arguments
arity
callee
caller
clientInformation
clipboardData
closed
constructor
controllers
crypto
debug
defaultStatus
directories
document
element
event
external
history
forward
frames
Infinity
innerHeight
innerWidth
java
length
loading
location
locationbar
name
menubar
navigator
netscape
offscreenBuffering
opener
opera
outerHeight
outerWidth
pageXOffset
pageYOffset
parent
personalbar
pkcs11
prompter
prototype
returnValue
screen
screenLeft
screenTop
screenX
screenY
scrollX
scrollY
scrollbars
self
sidebar
status
statusbar
style
sun
title
toolbar
top
window
onafterprint
onbeforeprint
onbeforeunload
onblur
onchange
onclick
onclose
onerror
onfocus
onhelp
onload
onresize
onreset
onscroll
onselect
onunload
onmousedown
onmouseup
onmouseover
onmouseout
onkeydown
onkeyup
onkeypress
onmousemove
onsubmit
onreset
onchange
onselect
onclose
onabort
onerror
onpaint
ondragdrop
Soya
BOOTSTRAP
</resource>
<resourceid="core.map">
abstract
break
continue
const
class
catch
case
debugger
default
double
delete
do
enum
extends
else
function
finally
float
false
for
get
instanceof
implements
import
int
in
if
long
null
new
protected
private
package
public
return
switch
static
super
set
typeof
throw
true
this
try
undefined
void
var
while
with
getter
setter
__defineGetter__
__defineSetter__
end
elif
cc_on
_win32
_win16
_mac
_alpha
_x86
_mc680x0
_PowerPC
_jscript
_jscript_build
_jscript_version
Array
Boolean
Date
Enumerator
Error
Function
Math
Number
Object
RegExp
String
VBArray
</resource>
<scriptlanguage="JScript">
<![CDATA[
/***<POD[ESCtool](Soya/1.0.0-b10;crlvl:2/1;Sun,6Feb200520:19:58UTC)>***/
/**
ProvingthatESCactuallycanhandlename-manglingandasageneralself-sanity
check,ESChasbeenusedtocompressitselfalongwithotherrequiredSoya-beans
whilecreatingthepackageyouseebelow.Toexaminethesebeansinamorehuman
readableform,getthelatestdistributionoftheSoyaAPI.
**/
functionSoya_API($h)
{
this.name='Soya';
this.version='1.0.0-b10';
this.type='static';
this.debug=0;
this.host=$h;
this.libPath='/lib-soya/';
this.podPath='pods';
this.resourcePath='resources';
this.attachBean=$a;
this.declareBean=$b;
this.registerBean=$c;
this.BeanPrototype=Soya_BeanPrototype;
this.beans=newObject();
this.beans.all=newArray();
Soya_Loader.prototype=newthis.BeanPrototype();
this.Loader=newObject();
this.Loader.orphans=newArray();
this.Loader.callbacks=newObject();
this.declareBean('Soya.BeanPrototype',null,this.name,false,true);
}
functionSoya_VirtualBean(){}
functionSoya_BeanPrototype(){
this.name='Soya.BeanPrototype';
}
function$a($i){
if(!$i.virtual){
eval($i.mutexName).prototype=$i;
eval($i.name+'='+(!$i.constructable?'new':'')+
$i.mutexName+(!$i.constructable?'()':''));
}
elseeval($i.name+'=this.beans["'+$i.name+'"]');
$i.complete=true;
if(this.Loader&&this.Loader.callbacks[$i.name])
this.Loader.callbacks[$i.name](eval($i.name));
}
function$b($j,$k,$l,$m,$n){
var$o=$k?newthis.BeanPrototype():newSoya_VirtualBean();
$o.name=$j;
$o.mutexName=$k||'Soya_VirtualBean';
$o.parentName=$l;
$o.iid=0;
$o.stack=newArray();
$o.complete=Boolean($n);
$o.constructable=($k&&!$m);
$o.virtual=!$k;
return(this.beans[$j]=this.beans.all[this.beans.all.length]=$o);
}
function$c($j,$m,$p,i){
var$q;
var$r=$j.split('x2e');
var$k=$r.join('x5f');
if(!this.beans[$j]){
if($p){
var$s='';
$q=$r[0];
for(i=1;i<$r.length-1;i++){
$s+=$q;
$q+=('x2e'+$r[i]);
if(i<=$p&&!this.beans[$q])
this.attachBean(this.declareBean($q,null,$s,true,true));
}
}
$r.length-=$p?$p:1;
$q=$r.join('x2e');
this.declareBean($j,$k,$q,$m);
if($r.length>1&&!this.beans[$q])
this.Loader.orphans[this.Loader.orphans.length]=this.beans[$j];
else{
this.attachBean(this.beans[$j]);
var$t=newArray();
for(i=0;i<this.Loader.orphans.length;i++)
if(this.Loader.orphans[i].parentName==$j)
this.attachBean(this.Loader.orphans[i]);
else$t[$t.length]=this.Loader.orphans[i];
this.Loader.orphans=$t;
}
}
returnBoolean(i)
}
function$d($u){
this.getResourcePath=Function('sName',
"return(Soya.libPath+Soya.resourcePath+'/'+(sName||this.name).split('.').join('/')+'/')");
this.getClass=Function('sName','returneval(Soya.beans[sName||this.name].mutexName)');
this.toString=Function("return('[object'+(this.name||'noname')+']')");
this.getBeanPath=Function('sName',
"return(Soya.libPath+(sName||this.name).split('.').join('/')+'.js')");
this.type='static';
if(!$u){
this.finalize=$f;
this.initialize=$e;
}
}
function$e($v){
this.iid=this.getClass().prototype.iid++;
if(this.stackable)
this.stack[this.iid]=this;
if(!Soya.beans[this.name].initialized){
$v=$v||
Soya.host[Soya.beans[this.name].mutexName+'_initialize'];
if(typeof($v)=='function')
Soya.beans[this.name].initialized=!$v(this.getClass(),this);
}
}
function$f($w){
$w=$w||
Soya.host[Soya.beans[this.name].mutexName+'_finalize'];
if(typeof($w)=='function')
$w(this.getClass(),this);
}
functionSoya_Loader(){};
function$g($x,$y,$z){
if(!Soya.fso)
Soya.fso=newActiveXObject('Scripting.FilesystemObject');
if(Soya.fso.FileExists($x)){
var$i=Soya.fso.GetFile($x),
$A=Soya.fso.OpenTextFile($i.Path),
$B=$A.Read($z||$i.Size);
$A.Close();
return$B;
}
elseif(!$y)
return(WScript.Echo(this.name+''+Soya.version+
'>FileNotfound:'+$x),WScript.Quit(99));
elsereturn'';
}
Soya_BeanPrototype.prototype=new$d(0);
Soya_VirtualBean.prototype=new$d(1);
Soya_API.prototype=new$d(1);
varSoya=newSoya_API(this);
if(typeof(BOOTSTRAP)=='function')BOOTSTRAP(Soya);
functionSoya_Common()
{
this.name='Soya.Common';
this.type='static';
this.version='1.03';
this.dependencies=[];
this.destroy=$E;
this.makeFunction=$G;
this.typematch=$F;
this.getObject=$C;
this.$ih=$H;
Function.prototype.getArguments=$D;
Soya.BeanPrototype.prototype.Extends=
Function('oBean','bOvr','Soya.Common.$ih(oBean,this,bOvr)');
Soya.BeanPrototype.prototype.Implements=
Function('oBean','bOvr','Soya.Common.$ih(this,oBean,bOvr)');
this.interfaces=newObject();
this.interfaces['Scripting.FilesystemObject']=Soya.fso;
}
function$C($I,$J){
if(typeof(this.interfaces[$I])=='undefined'){
if(typeofActiveXObject=='function'){
Soya.host.msieax=null;
if(typeofError=='function')
eval('try{Soya.host.msieax=newActiveXObject("'+$I+'")}catch(e){}');
else{
var$K=String("onerrorresumenextnself.msieax=CreateObject('"+$I+"'))");
self.execScript($K,'vbscript');
}
if(!$J)
returnSoya.host.msieax;
this.interfaces[$I]=Soya.host.msieax;
}
}
returnthis.interfaces[$I]||void(0);
}
function$D($L){
var$M=[],
$N=(isNaN($L)||$L<1)?
0:Math.min($L,this.arguments.length);
for(;$N<this.arguments.length;$N++)
$M[$M.length]=this.arguments[$N];
return$M;
}
function$E($O){
if($O!=null&&typeof($O)=='object')
for(var$Pin$O){
if(typeof($O[$P])=='object'&&$O[$P])
if($O[$P].constructor&&!$O[$P].style){
this.destroy($O[$P]);
delete($O[$P]);
}
else$O[$P]=null;
}
}
function$F($Q,$R){
var$S;
switch(typeof($Q)){
case'number':$S=2;break;
case'boolean':$S=4;break;
case'string':$S=8;break;
case'function':$S=16;break;
case'object':$S=32;break;
default:$S=1;break;
}
returnBoolean($S&($R||62));
}
function$G($T){
if($T&&this.typematch($T,16))
return$T;
elsereturnFunction(($T&&this.typematch($T,8))?$T:'');
}
function$H($U,$V,$W){
for(var$Pin$U)
if($P!='name'&&(!$W||typeof($V[$P])=='undefined'))
$V[$P]=$U[$P];
}
if(typeof(Soya)=='object')Soya.registerBean('Soya.Common',true);
functionSoya_WSH()
{
this.name='Soya.WSH';
this.type='static';
this.version='0.88';
this.dependencies=['Soya.Common','Soya.WSH.Registry'];
this.osInfo={};
this.arguments={length:0};
this.$09=function($00)
{return$00.length<2?$00:$00.replace(/^-/,'-').replace(/{2}/g,'')};
this.getArgument=function($01){return(this.arguments[$01]||"")}
this.getArguments=$X;
this.getOSInfo=$Z;
this.getShell=$Y;
}
function$X(){
if(!this.arguments.length&&WScript.Arguments.length){
vari,$02,$03=[],$04=newRegExp('^-+');
for(i=0;i<WScript.Arguments.length;i++)
$03[$03.length]=WScript.Arguments.item(i);
for(i=0;i<$03.length;i++){
$02=$03[i].replace($04,'-');
if($02.length>1&&$04.test($02)){
if(typeof$03[i+1]!='undefined'&&!$04.test($03[i+1]))
this.arguments[this.$09($02.replace($04,''))]=
this.$09($03[1+(i++)]);
elsethis.arguments[this.$09($02.replace($04,''))]=1;
};
elseif($02.length)
this.arguments[this.arguments.length++]=this.$09($03[i]);
}
}
returnthis.arguments;
}
function$Y(){
if(!this.shell)
this.shell=Soya.Common.getObject('WScript.Shell');
returnthis.shell;
}
function$Z(){
if(this.osInfo.$0a)
returnthis.osInfo;
var$05=Soya.Common.getObject('Scripting.FilesystemObject'),
$06=this.getShell().ExpandEnvironmentStrings("%SYSTEMROOT%");
this.osInfo.MSIEVersion=Soya.WSH.Registry.regRead('HKLMSOFTWAREMicrosoftInternetExplorerVersion');
this.osInfo.NETVersion=Soya.WSH.Registry.regRead('HKLMSOFTWAREMicrosoft.NETFrameworkVersion')||-1;
this.osInfo.SPVersion=Soya.WSH.Registry.regRead('HKLMSOFTWAREMicrosoftWindowsNTCSDVersion')||-1;
this.osInfo.JSVersion=parseFloat(ScriptEngineMajorVersion()+'.'+ScriptEngineMinorVersion());
if($05.FolderExists($06+'system32'))
$07=$05.GetFileVersion($06+'system32kernel32.dll');
elseif($05.FolderExists($06+'system'))
$07=$05.GetFileVersion($06+'systemkernel32.dll');
if($07){
/^(d).(d+).(d+).d+$/.test($07);
this.osInfo.majorVersion=parseInt(RegExp.$1);
this.osInfo.minorVersion=parseInt(RegExp.$2,10);
this.osInfo.buildVersion=parseInt(RegExp.$3,10);
this.osInfo.version=$07;
var$08={
'4.00.950':'Win95',
'4.00.1111':'Win95OSR2',
'4.00.1381':'WinNT',
'4.10.1998':'Win98',
'4.10.2222':'Win98SE',
'4.90.3000':'WinME',
'5.0.2195':'Win2K',
'5.10.2600':'WinXP'
};
this.osInfo.name=$08[$07.replace(/.d+$/,'')]||'unknown';
}
this.osInfo.$0a=1;
returnthis.osInfo;
}
if(typeof(Soya)=='object')Soya.registerBean('Soya.WSH',true);
functionSoya_Saltstorm_ESC($0s,$0t,$0u,$y)
{
this.name='Soya.Saltstorm.ESC';
this.version='1.13';
this.type='constructor';
this.dependencies=['Soya.Common','Soya.ECMA.Array'];
this.resourcePath=$0u||'';
this.crunchLevel=$0s||2;
this.substitute=false;
this.verbose=$0t;
this.silent=($y||typeofwindow=='object');
this.initialize();
this.flush();
}
functionSoya_Saltstorm_ESC_initialize($0v,$0w){
$0x=$0w;
var$0y="(?:"{2}|'{2}|".*?."|'.*?.'|/(?!*|/)..*?/)";
var$0z="[-!%&;<=>~:/^+|,()*?[]{}]+";
var$0A="/*(?!@).(?:.|n)*?*/|//.*";
var$0B="".*?."|'.*?.'|s*/{2,}.*n";
var$0C="}[sn]*?([^;,ce|.])}])";
with($0v){
prototype.fileFilter=newRegExp('.+(?!$|_)w*.js$','i');
prototype.$1n=["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",9];
prototype.$1o={};
prototype.fso=Soya.Loader.fso||newActiveXObject('Scripting.FilesystemObject');
prototype.core={};
prototype.bless={};
prototype.mangle={};
prototype.common={};
prototype.$1p=$g;
prototype.crunch=$0q;
prototype.flush=function(){this.buffer='';this.report=new$0c()};
prototype.getSubstitute=$0g;
prototype.loadMaps=$0d;
prototype.out=$0b;
prototype.load=$0e;
prototype.save=$0f;
prototype.getReport=$0r;
prototype.$1q=newRegExp("[$_]");
prototype.$1r=newRegExp("[^$w]","g");
prototype.$1s=newRegExp("^[x00."']");
prototype.$1t=newRegExp("s+$");
prototype.$1u=newRegExp("^s*W");
prototype.$1v=newRegExp("^[-+"~'!]");
prototype.$1w=newRegExp("("+$0y+")|("+$0A+")","g");
prototype.$1x=newRegExp("("+$0B+")","g");
prototype.$1y=newRegExp("("+$0y+")|(r?ns+)|(x20{2,})","g");
prototype.$1z=newRegExp("("+$0y+")|(w+)?[t]+("+$0z+")","g");
prototype.$1A=newRegExp("("+$0y+")|("+$0z+")[t]+","g");
prototype.$1B=newRegExp("("+$0y+")|function[ns]+([$w]+)","g");
prototype.$1C=newRegExp("("+$0y+")|("+$0A+")|(W[ns]*?[$w]+)b","gm");
prototype.$1D=newRegExp("("+$0y+")|(x00)|.[ns]*?([$_][$w]{3,})","g");
prototype.$1E=newRegExp("("+$0y+")|("+$0C+")","g");
}
}
function$0b($0D,$0E){
if(!this.silent){
var$0F=String((!$0E?'ESC>':'')+($0D||''));
WScript.Echo($0F);
}
}
function$0c(){
this.scripts=[];
this.rawSize=
this.crunchedSize=
this.elapsedTime=0;
}
function$0d(){
if(this.$1F)
return;
var$0G,$0H,$0I,$0J,$0K;
for(vari=0;i<arguments.length;i++){
$0G=arguments[i].replace(/W.+$/,'');
try{
$0I=getResource(arguments[i]).split(/r?n/g)||[];
for(varj=0;j<$0I.length;j++)
if($0I[j].length&&!$0x.$1u.test($0I[j]))
Soya_Saltstorm_ESC.prototype[$0G][$0I[j].replace($0x.$1t,'')]=1;
if(this.verbose)
this.out('Parsedmap"'+$0G+'",'+$0I.length+'entries.')
}
catch($0L){
if($0L)
$0I=null;
}
if($0I)
continue;
else$0H=this.fso.BuildPath(this.resourcePath,arguments[i]);
if(/^common|core/.test(arguments[i])&&!this.fso.FileExists($0H)){
this.out('Couldn't$0M$0N:'+
this.fso.GetAbsolutePathName($0H));
returnWScript.Quit(99);
}
elseif(typeofthis[$0G]!='object'){
this.out('Unrecognizedmapname:'+$0G);
returnWScript.Quit(99);
}
elseif(this.fso.FileExists($0H)){
$0I=this.fso.OpenTextFile($0H);
$0K=0;
while(!$0I.AtEndOfStream){
$0J=$0I.ReadLine();
if($0J.length&&!$0x.$1u.test($0J))
Soya_Saltstorm_ESC.prototype[$0G][$0J.replace($0x.$1t,'')]=++$0K;
}
$0I.Close();
Soya_Saltstorm_ESC.prototype[$0G].length=$0K;
if(this.verbose)
this.out('Loadedmap"'+$0G+'",'+$0K+'entries.['+$0H+']');
}
}
this.$1F=1;
}
function$0e(){
vari,$0O,$0P,$0Q,$0R=[];
for(i=0;i<arguments.length;i++){
if(arguments[i]&&this.fso.FolderExists(arguments[i])){
$0Q=newEnumerator(this.fso.GetFolder(arguments[i]).SubFolders);
for(;!$0Q.atEnd();$0Q.moveNext())
arguments[arguments.length++]=$0Q.item().Path;
$0Q=newEnumerator(this.fso.GetFolder(arguments[i]).Files);
for(;!$0Q.atEnd();$0Q.moveNext())
if($0Q.item().Size&&this.fileFilter.test($0Q.item().Path))
$0R.push($0Q.item().Path);
}
elseif(arguments[i])
$0R.push(arguments[i]);
}
for(i=0;i<$0R.length;i++){
if(!this.fso.FileExists($0R[i])){
this.out('Couldn't$0M$0S:"'+this.fso.GetAbsolutePathName(aLoadQueue[i])+'"');
returnWScript.Quit(99);
}
elseif(this.verbose)
this.out('Loadingscript:"'+this.fso.GetAbsolutePathName($0R[i])+'"');
$0P=this.fso.GetFile($0R[i]);
this.buffer+=(this.report.scripts.length?'rn':'');
this.buffer+=this.$1p($0P.Path,true);
this.report.scripts.push(
$0P.Path+'('+($0P.Size/1024).toFixed(2)+'kb)');
}
return$0R.length;
}
function$0f($0T,$0U){
var$0V;
if(!$0T){
this.out('Needanoutputfilename!');
returnWScript.Quit(99);
}
elseif(this.fso.FolderExists($0T)){
this.out('Needanoutputfilename,"'+
this.fso.GetAbsolutePathName($0T)+'"isafolder.');
returnWScript.Quit(99);
}
this.outFile=this.fso.GetAbsolutePathName($0T);
this.outMode=$0U?'Writing':'Appending';
$0V=this.fso.OpenTextFile(this.outFile,($0U?2:8),true);
$0V.WriteLine(this.buffer);
$0V.Close();
}
function$0g($0W){
if(!this.$1o[$0W]){
vark=1;
while(k<5){
this.$1n[k]++;
if(this.$1n[k]&&!(this.$1n[k]%62)){
k++;
if(this.$1n.length==k)
this.$1n[k]=-1;
}
elsebreak;
}
this.$1o[$0W]='$';
for(k=this.$1n.length-1;k>0;k--)
this.$1o[$0W]+=this.$1n[0].charAt(this.$1n[k]%62);
if(this.verbose)
this.out('Substituting['+this.$1o[$0W]+']->['+$0W+']');
}
returnthis.$1o[$0W];
}
function$0h($0X,$0Y,$0Z){
if(typeof$0Z!='undefined')
return'';
elsereturn$0X;
}
function$0i($0X,$10){
if(typeof$10!='undefined'&&/^s+/.test($10))
return'rn';
elsereturn$0X;
}
function$0j($0X,$11,$12){
if(typeof$11!='undefined')
return$0X;
elseif($12&&$12.length>2&&
($0x.mangle[$12]||$0x.$1q.test($12.charAt(0))))
$12=$0x.getSubstitute($12);
elseSoya_Saltstorm_ESC.prototype.bless[$12]=1;
returnString('functionx00'+$12);
}
function$0k($0X,$11,$13,$14){
if(typeof$11=='undefined'&&typeof$13=='undefined'&&typeof$14=='string'){
$14=$14.replace(/s+/g,'');
if(!$0x.$1s.test($14)&&isNaN(parseInt($14.substr(1),10))){
$14=$14.replace($0x.$1r,'');
if($14.length>2&&!$0x.core[$14]&&!$0x.common[$14]&&
!$0x.bless[$14]&&($0x.mangle[$14]||!$0x.mangle.length))
return$0X.replace($14,$0x.getSubstitute($14));
}
}
return$0X;
}
function$0l($0X,$11,$15,$P){
if(typeof$P=='string')
return(!$0x.core[$P]&&!$0x.common[$P]&&!$0x.bless[$P])?
String('.'+$0x.getSubstitute($P)):$0X;
elseif(typeof$11!='undefined')
return$0X;
elsereturn'';
}
function$0m($0X,$11,$16,$17,$18){
if(typeof$11!='undefined')
return$0X;
elseif(typeof$16!='undefined')
return'rn';
elseif(typeof$17!='undefined')
return'';
elsereturn'';
}
function$0n($0X,$11,$19,$1a){
if(typeof$11=='undefined'){
if(!$0x.$1v.test($1a)||!$19||!$0x.core[$19])
return($19||'')+$1a;
elsereturn$0X;
}
elsereturn$11;
}
function$0o($0X,$11,$1a){
if(typeof$11!='undefined')
return$0X;
elsereturn$1a;
}
function$0p($0X,$11,$1b,$1c){
if(typeof$11!='undefined')
return$0X;
return('};'+$1c);
}
function$0q($1d,$0s,$1e){
var$B=(typeof$1d=='string')?$1d:this.buffer;
this.loadMaps('core.map','common.map','bless.map','mangle.map');
if(!this.buffer.length&&!$1d)
returnString();
elseif(typeof$0s=='number')
this.crunchLevel=$0s;
var$1f=(newDate()).getTime()-1;
var$1g=$B.length;
this.report.rawSize+=$B.length;
if(this.crunchLevel>=1){
$B=$B.replace(this.$1w,$0h)
.replace(this.$1x,$0i)
.replace(/s+r?n/g,'rn');
if(this.verbose)
this.out('Removingcomments,emptylinesandtrailingwhitespace,saved'+
($1g-$B.length)+'bytes.');
$1g=$B.length;
}
if(this.crunchLevel>=2){
$B=$B.replace(this.$1y,$0m);
if(this.verbose)
this.out('Removingtabsandspaces,saved'+
($1g-$B.length)+'bytes.');
$1g=$B.length;
$B=$B.replace(this.$1z,$0n);
if(this.verbose)
this.out('Removingspaceslefttooperators,saved'+
($1g-$B.length)+'bytes.');
$1g=$B.length;
$B=$B.replace(this.$1A,$0o);
if(this.verbose)
this.out('Removingspacesrighttooperators,saved'+
($1g-$B.length)+'bytes.');
$1g=$B.length;
}
if(this.substitute||$1e||this.crunchLevel>=4){
$B=$B.replace(this.$1B,$0j);
$B=$B.replace(this.$1C,$0k);
$B=$B.replace(this.$1D,$0l);
if(this.verbose)
this.out('Substitutionsummary,saved'+
($1g-$B.length)+'bytes.');
$1g=$B.length;
}
if(this.crunchLevel>=3){
$B=$B.replace(/r?n/g,'')
.replace(this.$1E,$0p);
$B+='rn';
if(this.verbose){
this.out('Removingnewlines,saved'+
($1g-$B.length)+'bytes.');
this.out('',1);
}
}
if(typeof$1d=='string'){
this.report.crunchedSize+=$B.length;
this.buffer+=$B;
}
else{
this.buffer=$B;
this.report.crunchedSize=$B.length;
}
this.report.elapsedTime+=(newDate()).getTime()-$1f;
returnthis.buffer;
}
function$0r($1h){
var$1i=($1h||'rn'),
$1j=this.label?String($1i+this.label+$1i):'';
if(!this.report.elapsedTime){
$1j+='Nothingtoreport,yet...';
return(!$1k)?this.out($1j,1):$1j;
}
var$1l=Boolean(this.substitute||this.crunchLevel>=4),
$1m=this.report.rawSize-this.report.crunchedSize;
if(this.report.scripts.length){
$1j+="-----------------------------------------------------------------------------"+$1i;
$1j+="Crunchingscript(s):rnt*"+this.report.scripts.join("rnt*")+$1i;
$1j+="-----------------------------------------------------------------------------"+$1i;
$1j+=""+(this.outMode||"Put")+"to:"+(this.outFile||"[buffer]")+"("+
(this.report.crunchedSize/1024).toFixed(2)+"kb)"+$1i;
}
$1j+="-----------------------------------------------------------------------------"+$1i;
$1j+="Processtime:t"+(this.report.elapsedTime/1000).toFixed(3)+"secs"+$1i;
$1j+="Crunch-level:t"+this.crunchLevel+$1i;
$1j+="Subst.engine:t"+($1l?'On':'Off')+$1i;
if($1l)
$1j+="Substitutions:t"+(this.$1n[1]-9)+$1i;
$1j+="Originalsize:t"+(this.report.rawSize/1024).toFixed(2)+"kb"+$1i;
$1j+="Crunchedsize:t"+(this.report.crunchedSize/1024).toFixed(2)+"kb"+$1i;
$1j+="Savingratio:t"+($1m/1024).toFixed(2)+"kb"+$1i;
$1j+="-''''-(%):t"+(($1m/this.report.rawSize)*100).toFixed(2)+"%"+$1i;
$1j+="-----------------------------------------------------------------------------"+$1i;
return$1j;
}
if(typeof(Soya)=='object')Soya.registerBean('Soya.Saltstorm.ESC',false,1);
/***</POD>***/
]]>
</script>
<scriptlanguage="JScript">
<![CDATA[
/*
CommandflowcontrolscriptforESC.wsf
Edited:2005-02-06
*/
varoShell=WScript.CreateObject('WScript.Shell');
if(!oShell)
WScript.Quit(64);
//DowehaveJscript5.5+?
elseif(oShell&&parseFloat(ScriptEngineMajorVersion()+'.'+ScriptEngineMinorVersion())<5.5)
oShell.Popup(getResource('jscript'),64,WScript.ScriptName,16),WScript.Quit(4);
//IsESCexecutedundercscript?
//ifnotletuserselectswitchingtocscriptautomagically.
elseif(oShell&&WScript.FullName.toLowerCase().indexOf('cscript')<0){
if(oShell.Popup(getResource('wscript'),64,WScript.ScriptName,52)==6)
oShell.Run('%comspec%/Q/Kcscript//NoLogo'+WScript.ScriptName+'-a',9);
WScript.Quit(3);
}
//getthecmdlineargumentsformattedinanicemanner.
varoArgs=Soya.WSH.getArguments();
//shouldweruninverbose-mode?;
varbVerbose=Boolean(!oArgs.s&&!oArgs.silent&&(oArgs.v||oArgs.verbose));
//createaninstanceoftheESCobject.
varesc=newSoya.Saltstorm.ESC(oArgs.l||oArgs.level,bVerbose);
esc.label='ESC(ECMAScriptCruncher)'+esc.version+
'rnCopyright(C)2001-2005ThomasLoo<tloo@saltstorm.net>';
esc.resourcePath=esc.fso.GetParentFolderName(WScript.ScriptFullName||'.');
varsOutput=String(oArgs.oa||oArgs.ow||'');
if(oArgs.a||oArgs.about){
WScript.Echo(getResource('about'));
WScript.Quit(1);
}
elseif(oArgs.c||oArgs.copyright){
WScript.Echo('n'+esc.label+getResource('copyright'));
WScript.Quit(1);
}
elseif(oArgs.e||oArgs.example){
WScript.Echo('n'+esc.label+getResource('example'));
WScript.Quit(1);
}
//ifthereareoptionsmissing,printoutthehelptableandquit.
elseif((oArgs.h||oArgs.help)||!sOutput.length||!oArgs[0]){
WScript.Echo('n'+esc.label+getResource('usage'));
WScript.Quit((oArgs.h||oArgs.help)?1:2);
}
//Wakeupthevariablesubstitutionengineifoptionset(-$);
esc.substitute=Boolean(oArgs.$);
//loadinputfiles;
for(vari=0;i<oArgs.length;i++)
esc.load(oArgs[i]);
//crunchbaby,crunch!;
if(sOutput.toUpperCase()=='STDOUT'){
esc.silent=true;
WScript.StdOut.Write(esc.crunch());
}
elseif(sOutput.length){
esc.crunch();
esc.save(sOutput,Boolean(oArgs.ow));
//writereporttostdoutifnotsilence'd.
if(!oArgs.s&&!oArgs.silent)
WScript.StdOut.Write(esc.getReport());
}
//Shuttingdownnicely..
WScript.Quit(0);
]]>
</script>
</job>
</package>