首页 >web前端 >js教程 >javascript之ESC(第二类混淆)_黑客性质

javascript之ESC(第二类混淆)_黑客性质

WBOY
WBOY原创
2016-05-16 19:14:071226浏览

ESC(第二类混淆)
GNU项目
http://www.saltstorm.net/downloads/esc/ESC.zip

将以下代码保存为
ESC.wsf

复制代码 代码如下:







-----------------------------------------------------------------------------
  ESC (ECMAScript Cruncher)
  * Version       : 1.13
  * Date          : 2005-02-06 21:19:57 [+0100]
  * License       : GNU GPL (http://www.gnu.org/copyleft/gpl.txt)
  * Copyright (C) 2001-2005 Thomas Loo 

  ---------------------------------------------------------------------------
  ESC is an ECMAScript(*) pre-processor enabling an unlimited number of
  external scripts to be compressed/crunched into tight, bandwidth-optimized
  packages. ESC supports compressing of external sources only. Trying to
  process scripts inlined in HTML, ASP, PHP or equivalent pages are NOT
  recommended with this version of ESC. This feature might be added in a
  future version. Type "cscript ESC.wsf -help" for usage instructions.

  ESC is built using components from the Soya Scripting API 1.0.0-b10,
  a uni-host/cross-browser ECMAScript compliant class-library distributed
  freely under the terms of the BSD License. The Soya Scripting API,
  'lib-soya' and the Soya SDK can be found at http://www.saltstorm.net/
  ---------------------------------------------------------------------------
  * ECMAScript is the international standard for javascript.
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

-----------------------------------------------------------------------------




------------------------------------------------------------------------------
 Usage: cscript ESC.wsf -l [0-4] -ow output.js foo.js bar.js C:\scripts\baz...
 -----------------------------------------------------------------------------
  -a  [-about]             : Description page
  -c  [-copyright]         : Copyright/license notice
  -e  [-example]           : Examples of usage
  -h  [-help]              : This help-screen
 -----------------------------------------------------------------------------
  -l  [-level]   [01(2)34] : [optional] Set crunch-level (4 sets -$ on)
  -s  [-silent]            : [optional] Run silent, nada stdout
  -v  [-verbose]           : [optional] Run in verbose mode
  -$                       : [optional] Activate variable-substitution engine
 -----------------------------------------------------------------------------
  -oa            : Target filename for appending
  -ow            : Target filename for writing
  -ow STDOUT               : Write stream to STDOUT
 -----------------------------------------------------------------------------
            : [required]
  file(s) and/or directories containing scripts to crunch...
  (paths containing spaces must be quoted)



-----------------------------------------------------------------------------
 Examples of usage.

  Crunch 'original1.js','original2.js' and 'original3.js' at
  level 2 (default) and save the output as 'crunched.js'.
  Any previous file named 'crunched.js' will be overwritten.
   X:\cscript ESC.wsf -ow crunched.js original1.js original2.js original3.js
  ---------------------------------------------------------------------------

  Grab all scriptfiles (.js) in directory 'C:\script-directory' and crunch
  them at level 1 (comment and empty line removal only) and append the result
  to 'crunched.js'. If 'crunched.js' doesn't exist, it will be created.
   X:\cscript ESC.wsf -l 1 -oa crunched.js C:\script-directory
  ---------------------------------------------------------------------------

  Subject 'original1.js' and 'original2.js' for variable substitution,
  but perform no comment or whitespace removal.
  Redirect output to STDOUT instead of writing to file.
   X:\cscript ESC.wsf -l 0 -$ -ow STDOUT original1.js original2.js
  ---------------------------------------------------------------------------

  Crunch 'original.js' using variable substitution and remove
  any occurance of whitespace (where permitted...)
  and save it as 'crunched.js' (equals -l 3 -$)
   X:\cscript ESC.wsf -l 4 -ow crunched.js original.js
  ---------------------------------------------------------------------------

 Try 'ESC.wsf -help' for information about available run-time directives.
-----------------------------------------------------------------------------



ESC must be run from a DOS command prompt under    
cscript.exe. Do you want to switch host and have
ESC bring up a helpscreen ?




ESC needs JScript 5.5 or higher to score...
You need to update your version of JScript to run ESC.
Read the 'Requirements' section in the manual for information
how to obtain and install the latest version of Microsofts
'Windows Script' package.





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
print
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




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



<script> <BR><![CDATA[ <BR>/*** <POD [ESCtool] (Soya/1.0.0-b10; crlvl:2/1; Sun, 6 Feb 2005 20:19:58 UTC)> ***/ <BR>/** <BR>Proving that ESC actually can handle name-mangling and as a general self-sanity <BR> check, ESC has been used to compress itself along with other required Soya-beans <BR> while creating the package you see below. To examine these beans in a more human <BR> readable form, get the latest distribution of the Soya API. <BR>**/ <BR>function Soya_API($h) <BR>{ <BR>this.name='Soya'; <BR>this.version='1.0.0-b10'; <BR>this.type='static'; <BR>this.debug=0; <BR>this.host=$h; <BR>this.libPath='/lib-soya/'; <BR>this.podPath='pods'; <BR>this.resourcePath='resources'; <BR>this.attachBean=$a; <BR>this.declareBean=$b; <BR>this.registerBean=$c; <BR>this.BeanPrototype=Soya_BeanPrototype; <BR>this.beans=new Object(); <BR>this.beans.all=new Array(); <BR>Soya_Loader.prototype=new this.BeanPrototype(); <BR>this.Loader=new Object(); <BR>this.Loader.orphans=new Array(); <BR>this.Loader.callbacks=new Object(); <BR>this.declareBean('Soya.BeanPrototype',null,this.name,false,true); <BR>} <BR>function Soya_VirtualBean(){} <BR>function Soya_BeanPrototype(){ <BR>this.name='Soya.BeanPrototype'; <BR>} <BR>function $a($i){ <BR>if(!$i.virtual){ <BR>eval($i.mutexName).prototype=$i; <BR>eval($i.name+'='+(!$i.constructable?'new ':' ')+ <BR>$i.mutexName+(!$i.constructable?'()':'')); <BR>} <BR>else eval($i.name+'=this.beans["'+$i.name+'"]'); <BR>$i.complete=true; <BR>if(this.Loader&&this.Loader.callbacks[$i.name]) <BR>this.Loader.callbacks[$i.name](eval($i.name)); <BR>} <BR>function $b($j,$k,$l,$m,$n){ <BR>var $o=$k?new this.BeanPrototype():new Soya_VirtualBean(); <BR>$o.name=$j; <BR>$o.mutexName=$k||'Soya_VirtualBean'; <BR>$o.parentName=$l; <BR>$o.iid=0; <BR>$o.stack=new Array(); <BR>$o.complete=Boolean($n); <BR>$o.constructable=($k&&!$m); <BR>$o.virtual=!$k; <BR>return(this.beans[$j]=this.beans.all[this.beans.all.length]=$o); <BR>} <BR>function $c($j,$m,$p,i){ <BR>var $q; <BR>var $r=$j.split('\x2e'); <BR>var $k=$r.join('\x5f'); <BR>if(!this.beans[$j]){ <BR>if($p){ <BR>var $s=''; <BR>$q=$r[0]; <BR>for(i=1;i<$r.length-1;i++){ <BR>$s+=$q; <BR>$q+=('\x2e'+$r[i]); <BR>if(i<=$p&&!this.beans[$q]) <BR>this.attachBean(this.declareBean($q,null,$s,true,true)); <BR>} <BR>} <BR>$r.length-=$p?$p:1; <BR>$q=$r.join('\x2e'); <BR>this.declareBean($j,$k,$q,$m); <BR>if($r.length>1&&!this.beans[$q]) <BR>this.Loader.orphans[this.Loader.orphans.length]=this.beans[$j]; <BR>else{ <BR>this.attachBean(this.beans[$j]); <BR>var $t=new Array(); <BR>for(i=0;i<this.Loader.orphans.length;i++) <BR>if(this.Loader.orphans[i].parentName==$j) <BR>this.attachBean(this.Loader.orphans[i]); <BR>else $t[$t.length]=this.Loader.orphans[i]; <BR>this.Loader.orphans=$t; <BR>} <BR>} <BR>return Boolean(i) <BR>} <BR>function $d($u){ <BR>this.getResourcePath=Function('sName', <BR>"return(Soya.libPath + Soya.resourcePath + '/' + (sName||this.name).split('.').join('/') + '/')"); <BR>this.getClass=Function('sName','return eval(Soya.beans[sName || this.name].mutexName)'); <BR>this.toString=Function("return('[object ' + (this.name || 'noname') + ']')"); <BR>this.getBeanPath=Function('sName', <BR>"return(Soya.libPath + (sName||this.name).split('.').join('/') + '.js')"); <BR>this.type='static'; <BR>if(!$u){ <BR>this.finalize=$f; <BR>this.initialize=$e; <BR>} <BR>} <BR>function $e($v){ <BR>this.iid=this.getClass().prototype.iid++; <BR>if(this.stackable) <BR>this.stack[this.iid]=this; <BR>if(!Soya.beans[this.name].initialized){ <BR>$v=$v|| <BR>Soya.host[Soya.beans[this.name].mutexName+'_initialize']; <BR>if(typeof($v)=='function') <BR>Soya.beans[this.name].initialized=!$v(this.getClass(),this); <BR>} <BR>} <BR>function $f($w){ <BR>$w=$w|| <BR>Soya.host[Soya.beans[this.name].mutexName+'_finalize']; <BR>if(typeof($w)=='function') <BR>$w(this.getClass(),this); <BR>} <BR>function Soya_Loader(){}; <BR>function $g($x,$y,$z){ <BR>if(!Soya.fso) <BR>Soya.fso=new ActiveXObject('Scripting.FilesystemObject'); <BR>if(Soya.fso.FileExists($x)){ <BR>var $i=Soya.fso.GetFile($x), <BR>$A=Soya.fso.OpenTextFile($i.Path), <BR>$B=$A.Read($z||$i.Size); <BR>$A.Close(); <BR>return $B; <BR>} <BR>else if(!$y) <BR>return(WScript.Echo(this.name+' '+Soya.version+ <BR>'> File Not found: '+$x),WScript.Quit(99)); <BR>else return ''; <BR>} <BR>Soya_BeanPrototype.prototype=new $d(0); <BR>Soya_VirtualBean.prototype=new $d(1); <BR>Soya_API.prototype=new $d(1); <BR>var Soya=new Soya_API(this); <BR>if(typeof(BOOTSTRAP)=='function')BOOTSTRAP(Soya); <BR>function Soya_Common() <BR>{ <BR>this.name='Soya.Common'; <BR>this.type='static'; <BR>this.version='1.03'; <BR>this.dependencies=[]; <BR>this.destroy=$E; <BR>this.makeFunction=$G; <BR>this.typematch=$F; <BR>this.getObject=$C; <BR>this.$ih=$H; <BR>Function.prototype.getArguments=$D; <BR>Soya.BeanPrototype.prototype.Extends= <BR>Function('oBean','bOvr','Soya.Common.$ih(oBean, this, bOvr)'); <BR>Soya.BeanPrototype.prototype.Implements= <BR>Function('oBean','bOvr','Soya.Common.$ih(this, oBean, bOvr)'); <BR>this.interfaces=new Object(); <BR>this.interfaces['Scripting.FilesystemObject']=Soya.fso; <BR>} <BR>function $C($I,$J){ <BR>if(typeof(this.interfaces[$I])=='undefined'){ <BR>if(typeof ActiveXObject=='function'){ <BR>Soya.host.msieax=null; <BR>if(typeof Error=='function') <BR>eval('try{Soya.host.msieax=new ActiveXObject("'+$I+'")}catch(e){}'); <BR>else{ <BR>var $K=String("on error resume next\nself.msieax=CreateObject('"+$I+"'))"); <BR>self.execScript($K,'vbscript'); <BR>} <BR>if(!$J) <BR>return Soya.host.msieax; <BR>this.interfaces[$I]=Soya.host.msieax; <BR>} <BR>} <BR>return this.interfaces[$I]||void(0); <BR>} <BR>function $D($L){ <BR>var $M=[], <BR>$N=(isNaN($L)||$L<1)? <BR>0:Math.min($L,this.arguments.length); <BR>for(;$N<this.arguments.length;$N++) <BR>$M[$M.length]=this.arguments[$N]; <BR>return $M; <BR>} <BR>function $E($O){ <BR>if($O!=null&&typeof($O)=='object') <BR>for(var $P in $O){ <BR>if(typeof($O[$P])=='object'&&$O[$P]) <BR>if($O[$P].constructor&&!$O[$P].style){ <BR>this.destroy($O[$P]); <BR>delete($O[$P]); <BR>} <BR>else $O[$P]=null; <BR>} <BR>} <BR>function $F($Q,$R){ <BR>var $S; <BR>switch(typeof($Q)){ <BR>case 'number':$S=2;break; <BR>case 'boolean':$S=4;break; <BR>case 'string':$S=8;break; <BR>case 'function':$S=16;break; <BR>case 'object':$S=32;break; <BR>default:$S=1;break; <BR>} <BR>return Boolean($S&($R||62)); <BR>} <BR>function $G($T){ <BR>if($T&&this.typematch($T,16)) <BR>return $T; <BR>else return Function(($T&&this.typematch($T,8))?$T:''); <BR>} <BR>function $H($U,$V,$W){ <BR>for(var $P in $U) <BR>if($P!='name'&&(!$W||typeof($V[$P])=='undefined')) <BR>$V[$P]=$U[$P]; <BR>} <BR>if(typeof(Soya)=='object')Soya.registerBean('Soya.Common',true); <BR>function Soya_WSH() <BR>{ <BR>this.name='Soya.WSH'; <BR>this.type='static'; <BR>this.version='0.88'; <BR>this.dependencies=['Soya.Common','Soya.WSH.Registry']; <BR>this.osInfo={}; <BR>this.arguments={length:0}; <BR>this.$09=function($00) <BR>{return $00.length<2?$00:$00.replace(/^\\-/,'-').replace(/\\{2}/g,'\\')}; <BR>this.getArgument=function($01){return(this.arguments[$01]||"")} <BR>this.getArguments=$X; <BR>this.getOSInfo=$Z; <BR>this.getShell=$Y; <BR>} <BR>function $X(){ <BR>if(!this.arguments.length&&WScript.Arguments.length){ <BR>var i,$02,$03=[],$04=new RegExp('^-+'); <BR>for(i=0;i<WScript.Arguments.length;i++) <BR>$03[$03.length]=WScript.Arguments.item(i); <BR>for(i=0;i<$03.length;i++){ <BR>$02=$03[i].replace($04,'-'); <BR>if($02.length>1&&$04.test($02)){ <BR>if(typeof $03[i+1]!='undefined'&&!$04.test($03[i+1])) <BR>this.arguments[this.$09($02.replace($04,''))]= <BR>this.$09($03[1+(i++)]); <BR>else this.arguments[this.$09($02.replace($04,''))]=1; <BR>}; <BR>else if($02.length) <BR>this.arguments[this.arguments.length++]=this.$09($03[i]); <BR>} <BR>} <BR>return this.arguments; <BR>} <BR>function $Y(){ <BR>if(!this.shell) <BR>this.shell=Soya.Common.getObject('WScript.Shell'); <BR>return this.shell; <BR>} <BR>function $Z(){ <BR>if(this.osInfo.$0a) <BR>return this.osInfo; <BR>var $05=Soya.Common.getObject('Scripting.FilesystemObject'), <BR>$06=this.getShell().ExpandEnvironmentStrings("%SYSTEMROOT%"); <BR>this.osInfo.MSIEVersion=Soya.WSH.Registry.regRead('HKLM\\SOFTWARE\\Microsoft\\Internet Explorer\\Version'); <BR>this.osInfo.NETVersion=Soya.WSH.Registry.regRead('HKLM\SOFTWARE\Microsoft\.NETFramework\\Version')||-1; <BR>this.osInfo.SPVersion=Soya.WSH.Registry.regRead('HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CSDVersion')||-1; <BR>this.osInfo.JSVersion=parseFloat(ScriptEngineMajorVersion()+'.'+ScriptEngineMinorVersion()); <BR>if($05.FolderExists($06+'\\system32')) <BR>$07=$05.GetFileVersion($06+'\\system32\\kernel32.dll'); <BR>else if($05.FolderExists($06+'\\system')) <BR>$07=$05.GetFileVersion($06+'\\system\\kernel32.dll'); <BR>if($07){ <BR>/^(\d)\.(\d+)\.(\d+)\.\d+$/.test($07); <BR>this.osInfo.majorVersion=parseInt(RegExp.$1); <BR>this.osInfo.minorVersion=parseInt(RegExp.$2,10); <BR>this.osInfo.buildVersion=parseInt(RegExp.$3,10); <BR>this.osInfo.version=$07; <BR>var $08={ <BR>'4.00.950':'Win95', <BR>'4.00.1111':'Win95 OSR2', <BR>'4.00.1381':'WinNT', <BR>'4.10.1998':'Win98', <BR>'4.10.2222':'Win98SE', <BR>'4.90.3000':'WinME', <BR>'5.0.2195':'Win2K', <BR>'5.10.2600':'WinXP' <BR>}; <BR>this.osInfo.name=$08[$07.replace(/\.\d+$/,'')]||'unknown'; <BR>} <BR>this.osInfo.$0a=1; <BR>return this.osInfo; <BR>} <BR>if(typeof(Soya)=='object')Soya.registerBean('Soya.WSH',true); <BR>function Soya_Saltstorm_ESC($0s,$0t,$0u,$y) <BR>{ <BR>this.name='Soya.Saltstorm.ESC'; <BR>this.version='1.13'; <BR>this.type='constructor'; <BR>this.dependencies=['Soya.Common','Soya.ECMA.Array']; <BR>this.resourcePath=$0u||''; <BR>this.crunchLevel=$0s||2; <BR>this.substitute=false; <BR>this.verbose=$0t; <BR>this.silent=($y||typeof window=='object'); <BR>this.initialize(); <BR>this.flush(); <BR>} <BR>function Soya_Saltstorm_ESC_initialize($0v,$0w){ <BR>$0x=$0w; <BR>var $0y="(?:\"{2}|'{2}|\".*?.\"|'.*?.'|\\/(?!\\*|\\/)..*?\\/)"; <BR>var $0z="[-!%&;<=>~:\\/\\^\\+\\|\\,\\(\\)\\*\\?\\[\\]\\{\\}]+"; <BR>var $0A="\\/\\*(?!@).(?:.|\\n)*?\\*\\/|\\/\\/.*"; <BR>var $0B="\".*?.\"|'.*?.'|\\s*\\/{2,}.*\\n"; <BR>var $0C="\\}[\\s\\n]*?([^;,ce\\|\\.\\]\\)\\}])"; <BR>with($0v){ <BR>prototype.fileFilter=new RegExp('.+\\\\(?!$|_)\\w*\\.js$','i'); <BR>prototype.$1n=["0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",9]; <BR>prototype.$1o={}; <BR>prototype.fso=Soya.Loader.fso||new ActiveXObject('Scripting.FilesystemObject'); <BR>prototype.core={}; <BR>prototype.bless={}; <BR>prototype.mangle={}; <BR>prototype.common={}; <BR>prototype.$1p=$g; <BR>prototype.crunch=$0q; <BR>prototype.flush=function(){this.buffer='';this.report=new $0c()}; <BR>prototype.getSubstitute=$0g; <BR>prototype.loadMaps=$0d; <BR>prototype.out=$0b; <BR>prototype.load=$0e; <BR>prototype.save=$0f; <BR>prototype.getReport=$0r; <BR>prototype.$1q=new RegExp("[$_]"); <BR>prototype.$1r=new RegExp("[^$\\w]","g"); <BR>prototype.$1s=new RegExp("^[\\x00\\.\"']"); <BR>prototype.$1t=new RegExp("\\s+$"); <BR>prototype.$1u=new RegExp("^\\s*\\W"); <BR>prototype.$1v=new RegExp("^[-\\\\+\"~'!]"); <BR>prototype.$1w=new RegExp("("+$0y+")|("+$0A+")","g"); <BR>prototype.$1x=new RegExp("("+$0B+")","g"); <BR>prototype.$1y=new RegExp("("+$0y+")|(\\r?\\n\\s+)|(\\x20{2,})","g"); <BR>prototype.$1z=new RegExp("("+$0y+")|(\\w+)?[ \\t]+("+$0z+")","g"); <BR>prototype.$1A=new RegExp("("+$0y+")|("+$0z+")[ \\t]+","g"); <BR>prototype.$1B=new RegExp("("+$0y+")|function[\\n\\s]+([$\\w]+)","g"); <BR>prototype.$1C=new RegExp("("+$0y+")|("+$0A+")|(\\W[\\n\\s]*?[$\\w]+)\\b","gm"); <BR>prototype.$1D=new RegExp("("+$0y+")|(\\x00)|\\.[\\n\\s]*?([$_][$\\w]{3,})","g"); <BR>prototype.$1E=new RegExp("("+$0y+")|("+$0C+")","g"); <BR>} <BR>} <BR>function $0b($0D,$0E){ <BR>if(!this.silent){ <BR>var $0F=String((!$0E?'ESC> ':'')+($0D||'')); <BR>WScript.Echo($0F); <BR>} <BR>} <BR>function $0c(){ <BR>this.scripts=[]; <BR>this.rawSize= <BR>this.crunchedSize= <BR>this.elapsedTime=0; <BR>} <BR>function $0d(){ <BR>if(this.$1F) <BR>return; <BR>var $0G,$0H,$0I,$0J,$0K; <BR>for(var i=0;i<arguments.length;i++){ <BR>$0G=arguments[i].replace(/\W.+$/,''); <BR>try{ <BR>$0I=getResource(arguments[i]).split(/\r?\n/g)||[]; <BR>for(var j=0;j<$0I.length;j++) <BR>if($0I[j].length&&!$0x.$1u.test($0I[j])) <BR>Soya_Saltstorm_ESC.prototype[$0G][$0I[j].replace($0x.$1t,'')]=1; <BR>if(this.verbose) <BR>this.out('Parsed map "'+$0G+'", '+$0I.length+' entries.') <BR>} <BR>catch($0L){ <BR>if($0L) <BR>$0I=null; <BR>} <BR>if($0I) <BR>continue; <BR>else $0H=this.fso.BuildPath(this.resourcePath,arguments[i]); <BR>if(/^common|core/.test(arguments[i])&&!this.fso.FileExists($0H)){ <BR>this.out('Couldn\'t $0M $0N:'+ <BR>this.fso.GetAbsolutePathName($0H)); <BR>return WScript.Quit(99); <BR>} <BR>else if(typeof this[$0G]!='object'){ <BR>this.out('Unrecognized mapname : '+$0G); <BR>return WScript.Quit(99); <BR>} <BR>else if(this.fso.FileExists($0H)){ <BR>$0I=this.fso.OpenTextFile($0H); <BR>$0K=0; <BR>while(!$0I.AtEndOfStream){ <BR>$0J=$0I.ReadLine(); <BR>if($0J.length&&!$0x.$1u.test($0J)) <BR>Soya_Saltstorm_ESC.prototype[$0G][$0J.replace($0x.$1t,'')]=++$0K; <BR>} <BR>$0I.Close(); <BR>Soya_Saltstorm_ESC.prototype[$0G].length=$0K; <BR>if(this.verbose) <BR>this.out('Loaded map "'+$0G+'", '+$0K+' entries. ['+$0H+']'); <BR>} <BR>} <BR>this.$1F=1; <BR>} <BR>function $0e(){ <BR>var i,$0O,$0P,$0Q,$0R=[]; <BR>for(i=0;i<arguments.length;i++){ <BR>if(arguments[i]&&this.fso.FolderExists(arguments[i])){ <BR>$0Q=new Enumerator(this.fso.GetFolder(arguments[i]).SubFolders); <BR>for(;!$0Q.atEnd();$0Q.moveNext()) <BR>arguments[arguments.length++]=$0Q.item().Path; <BR>$0Q=new Enumerator(this.fso.GetFolder(arguments[i]).Files); <BR>for(;!$0Q.atEnd();$0Q.moveNext()) <BR>if($0Q.item().Size&&this.fileFilter.test($0Q.item().Path)) <BR>$0R.push($0Q.item().Path); <BR>} <BR>else if(arguments[i]) <BR>$0R.push(arguments[i]); <BR>} <BR>for(i=0;i<$0R.length;i++){ <BR>if(!this.fso.FileExists($0R[i])){ <BR>this.out('Couldn\'t $0M $0S:"' + this.fso.GetAbsolutePathName(aLoadQueue[i]) + '"'); <BR>return WScript.Quit(99); <BR>} <BR>else if(this.verbose) <BR>this.out('Loading script :"'+this.fso.GetAbsolutePathName($0R[i])+'"'); <BR>$0P=this.fso.GetFile($0R[i]); <BR>this.buffer+=(this.report.scripts.length?'\r\n':''); <BR>this.buffer+=this.$1p($0P.Path,true); <BR>this.report.scripts.push( <BR>$0P.Path+' ('+($0P.Size/1024).toFixed(2)+' kb)'); <BR>} <BR>return $0R.length; <BR>} <BR>function $0f($0T,$0U){ <BR>var $0V; <BR>if(!$0T){ <BR>this.out('Need an output filename!'); <BR>return WScript.Quit(99); <BR>} <BR>else if(this.fso.FolderExists($0T)){ <BR>this.out('Need an output filename, "'+ <BR>this.fso.GetAbsolutePathName($0T)+'" is a folder.'); <BR>return WScript.Quit(99); <BR>} <BR>this.outFile=this.fso.GetAbsolutePathName($0T); <BR>this.outMode=$0U?'Writing':'Appending'; <BR>$0V=this.fso.OpenTextFile(this.outFile,($0U?2:8),true); <BR>$0V.WriteLine(this.buffer); <BR>$0V.Close(); <BR>} <BR>function $0g($0W){ <BR>if(!this.$1o[$0W]){ <BR>var k=1; <BR>while(k<5){ <BR>this.$1n[k]++; <BR>if(this.$1n[k]&&!(this.$1n[k]%62)){ <BR>k++; <BR>if(this.$1n.length==k) <BR>this.$1n[k]=-1; <BR>} <BR>else break; <BR>} <BR>this.$1o[$0W]='$'; <BR>for(k=this.$1n.length-1;k>0;k--) <BR>this.$1o[$0W]+=this.$1n[0].charAt(this.$1n[k]%62); <BR>if(this.verbose) <BR>this.out('Substituting ['+this.$1o[$0W]+'] -> ['+$0W+']'); <BR>} <BR>return this.$1o[$0W]; <BR>} <BR>function $0h($0X,$0Y,$0Z){ <BR>if(typeof $0Z!='undefined') <BR>return ''; <BR>else return $0X; <BR>} <BR>function $0i($0X,$10){ <BR>if(typeof $10!='undefined'&&/^\s+/.test($10)) <BR>return '\r\n'; <BR>else return $0X; <BR>} <BR>function $0j($0X,$11,$12){ <BR>if(typeof $11!='undefined') <BR>return $0X; <BR>else if($12&&$12.length>2&& <BR>($0x.mangle[$12]||$0x.$1q.test($12.charAt(0)))) <BR>$12=$0x.getSubstitute($12); <BR>else Soya_Saltstorm_ESC.prototype.bless[$12]=1; <BR>return String('function \x00'+$12); <BR>} <BR>function $0k($0X,$11,$13,$14){ <BR>if(typeof $11=='undefined'&&typeof $13=='undefined'&&typeof $14=='string'){ <BR>$14=$14.replace(/\s+/g,''); <BR>if(!$0x.$1s.test($14)&&isNaN(parseInt($14.substr(1),10))){ <BR>$14=$14.replace($0x.$1r,''); <BR>if($14.length>2&&!$0x.core[$14]&&!$0x.common[$14]&& <BR>!$0x.bless[$14]&&($0x.mangle[$14]||!$0x.mangle.length)) <BR>return $0X.replace($14,$0x.getSubstitute($14)); <BR>} <BR>} <BR>return $0X; <BR>} <BR>function $0l($0X,$11,$15,$P){ <BR>if(typeof $P=='string') <BR>return(!$0x.core[$P]&&!$0x.common[$P]&&!$0x.bless[$P])? <BR>String('.'+$0x.getSubstitute($P)):$0X; <BR>else if(typeof $11!='undefined') <BR>return $0X; <BR>else return ''; <BR>} <BR>function $0m($0X,$11,$16,$17,$18){ <BR>if(typeof $11!='undefined') <BR>return $0X; <BR>else if(typeof $16!='undefined') <BR>return '\r\n'; <BR>else if(typeof $17!='undefined') <BR>return ' '; <BR>else return ''; <BR>} <BR>function $0n($0X,$11,$19,$1a){ <BR>if(typeof $11=='undefined'){ <BR>if(!$0x.$1v.test($1a)||!$19||!$0x.core[$19]) <BR>return($19||'')+$1a; <BR>else return $0X; <BR>} <BR>else return $11; <BR>} <BR>function $0o($0X,$11,$1a){ <BR>if(typeof $11!='undefined') <BR>return $0X; <BR>else return $1a; <BR>} <BR>function $0p($0X,$11,$1b,$1c){ <BR>if(typeof $11!='undefined') <BR>return $0X; <BR>return('};'+$1c); <BR>} <BR>function $0q($1d,$0s,$1e){ <BR>var $B=(typeof $1d=='string')?$1d:this.buffer; <BR>this.loadMaps('core.map','common.map','bless.map','mangle.map'); <BR>if(!this.buffer.length&&!$1d) <BR>return String(); <BR>else if(typeof $0s=='number') <BR>this.crunchLevel=$0s; <BR>var $1f=(new Date()).getTime()-1; <BR>var $1g=$B.length; <BR>this.report.rawSize+=$B.length; <BR>if(this.crunchLevel>=1){ <BR>$B=$B.replace(this.$1w,$0h) <BR>.replace(this.$1x,$0i) <BR>.replace(/\s+\r?\n/g,'\r\n'); <BR>if(this.verbose) <BR>this.out('Removing comments, empty lines and trailing whitespace, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>$1g=$B.length; <BR>} <BR>if(this.crunchLevel>=2){ <BR>$B=$B.replace(this.$1y,$0m); <BR>if(this.verbose) <BR>this.out('Removing tabs and spaces, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>$1g=$B.length; <BR>$B=$B.replace(this.$1z,$0n); <BR>if(this.verbose) <BR>this.out('Removing spaces left to operators, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>$1g=$B.length; <BR>$B=$B.replace(this.$1A,$0o); <BR>if(this.verbose) <BR>this.out('Removing spaces right to operators, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>$1g=$B.length; <BR>} <BR>if(this.substitute||$1e||this.crunchLevel>=4){ <BR>$B=$B.replace(this.$1B,$0j); <BR>$B=$B.replace(this.$1C,$0k); <BR>$B=$B.replace(this.$1D,$0l); <BR>if(this.verbose) <BR>this.out('Substitution summary, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>$1g=$B.length; <BR>} <BR>if(this.crunchLevel>=3){ <BR>$B=$B.replace(/\r?\n/g,'') <BR>.replace(this.$1E,$0p); <BR>$B+='\r\n'; <BR>if(this.verbose){ <BR>this.out('Removing newlines, saved '+ <BR>($1g-$B.length)+' bytes.'); <BR>this.out('',1); <BR>} <BR>} <BR>if(typeof $1d=='string'){ <BR>this.report.crunchedSize+=$B.length; <BR>this.buffer+=$B; <BR>} <BR>else{ <BR>this.buffer=$B; <BR>this.report.crunchedSize=$B.length; <BR>} <BR>this.report.elapsedTime+=(new Date()).getTime()-$1f; <BR>return this.buffer; <BR>} <BR>function $0r($1h){ <BR>var $1i=($1h||'\r\n'), <BR>$1j=this.label?String($1i+this.label+$1i):''; <BR>if(!this.report.elapsedTime){ <BR>$1j+='Nothing to report, yet...'; <BR>return(!$1k)?this.out($1j,1):$1j; <BR>} <BR>var $1l=Boolean(this.substitute||this.crunchLevel>=4), <BR>$1m=this.report.rawSize-this.report.crunchedSize; <BR>if(this.report.scripts.length){ <BR>$1j+="-----------------------------------------------------------------------------"+$1i; <BR>$1j+=" Crunching script(s):\r\n\t * "+this.report.scripts.join("\r\n\t * ")+$1i; <BR>$1j+="-----------------------------------------------------------------------------"+$1i; <BR>$1j+=" "+(this.outMode||"Put")+" to : "+(this.outFile||"[buffer]")+" ("+ <BR>(this.report.crunchedSize/1024).toFixed(2)+" kb)"+$1i; <BR>} <BR>$1j+="-----------------------------------------------------------------------------"+$1i; <BR>$1j+=" Processtime :\t"+(this.report.elapsedTime/1000).toFixed(3)+" secs"+$1i; <BR>$1j+=" Crunch-level :\t"+this.crunchLevel+$1i; <BR>$1j+=" Subst. engine :\t"+($1l?'On':'Off')+$1i; <BR>if($1l) <BR>$1j+=" Substitutions :\t"+(this.$1n[1]-9)+$1i; <BR>$1j+=" Original size :\t"+(this.report.rawSize/1024).toFixed(2)+" kb"+$1i; <BR>$1j+=" Crunched size :\t"+(this.report.crunchedSize/1024).toFixed(2)+" kb"+$1i; <BR>$1j+=" Saving ratio :\t"+($1m/1024).toFixed(2)+" kb"+$1i; <BR>$1j+=" -'' ''- (%) :\t"+(($1m/this.report.rawSize)*100).toFixed(2)+" %"+$1i; <BR>$1j+="-----------------------------------------------------------------------------"+$1i; <BR>return $1j; <BR>} <BR>if(typeof(Soya)=='object')Soya.registerBean('Soya.Saltstorm.ESC',false,1); <br><br>/*** ***/ <br><br>]]> <BR></script>
<script> <BR><![CDATA[ <BR> /* <BR> Command flow control script for ESC.wsf <BR> Edited : 2005-02-06 <BR> */ <br><br> var oShell = WScript.CreateObject('WScript.Shell'); <br><br> if(!oShell) <BR> WScript.Quit(64); <br><br> // Do we have Jscript 5.5+ ? <BR> else if(oShell && parseFloat(ScriptEngineMajorVersion() + '.' + ScriptEngineMinorVersion()) < 5.5) <BR> oShell.Popup(getResource('jscript'), 64, WScript.ScriptName, 16), WScript.Quit(4); <br><br> // Is ESC executed under cscript ? <BR> // if not let user select switching to cscript automagically. <BR> else if(oShell && WScript.FullName.toLowerCase().indexOf('cscript') < 0){ <BR> if(oShell.Popup(getResource('wscript'), 64, WScript.ScriptName, 52) == 6) <BR> oShell.Run('%comspec% /Q /K cscript //NoLogo ' + WScript.ScriptName + ' -a', 9); <BR> WScript.Quit(3); <BR> } <br><br> // get the cmdline arguments formatted in a nice manner. <BR> var oArgs = Soya.WSH.getArguments(); <br><br> // should we run in verbose-mode ?; <BR> var bVerbose = Boolean(!oArgs.s && !oArgs.silent && (oArgs.v || oArgs.verbose)); <br><br> // create an instance of the ESC object. <BR> var esc = new Soya.Saltstorm.ESC(oArgs.l || oArgs.level, bVerbose); <BR> esc.label = 'ESC (ECMAScript Cruncher) ' + esc.version + <BR> '\r\nCopyright (C) 2001-2005 Thomas Loo <tloo@saltstorm.net>'; <br><br> esc.resourcePath = esc.fso.GetParentFolderName(WScript.ScriptFullName || '.'); <BR> var sOutput = String(oArgs.oa || oArgs.ow || ''); <br><br> if(oArgs.a || oArgs.about){ <BR> WScript.Echo(getResource('about')); <BR> WScript.Quit(1); <BR> } <BR> else if(oArgs.c || oArgs.copyright){ <BR> WScript.Echo('\n' + esc.label + getResource('copyright')); <BR> WScript.Quit(1); <BR> } <BR> else if(oArgs.e || oArgs.example){ <BR> WScript.Echo('\n' + esc.label + getResource('example')); <BR> WScript.Quit(1); <BR> } <br><br> // if there are options missing, print out the help table and quit. <BR> else if((oArgs.h || oArgs.help) || !sOutput.length || !oArgs[0]){ <BR> WScript.Echo('\n' + esc.label + getResource('usage')); <BR> WScript.Quit((oArgs.h || oArgs.help) ? 1 : 2); <BR> } <br><br> // Wake up the variable substitution engine if option set (-$); <BR> esc.substitute = Boolean(oArgs.$); <br><br> // load input files; <BR> for(var i = 0; i < oArgs.length; i++) <BR> esc.load(oArgs[i]); <br><br> // crunch baby, crunch!; <BR> if(sOutput.toUpperCase() == 'STDOUT'){ <BR> esc.silent = true; <BR> WScript.StdOut.Write(esc.crunch()); <BR> } <BR> else if(sOutput.length){ <BR> esc.crunch(); <BR> esc.save(sOutput, Boolean(oArgs.ow)); <BR> // write report to stdout if not silence'd. <BR> if(!oArgs.s && !oArgs.silent) <BR> WScript.StdOut.Write(esc.getReport()); <BR> } <br><br> // Shutting down nicely.. <BR> WScript.Quit(0); <br><br>]]> <BR></script>


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn