pack.wsf wsh下的js加密工具新浪也在用(2)
</script>
<script type="text/javascript">
var VERSION = '1.0.0';
var AUTHOR = 'Rob Seiler'; /* seiler@elr.com.au */
/* Get command line arguments */
function JS_getArgs() {
var args = [];
var objArgs = WScript.Arguments;
if (objArgs.length > 0) {
for (var i = 0; i < objArgs.length; i++) {
args[i] = objArgs(i); /* sic - index in "()" - an object, not an array! */
}
}
return (args);
}
/* Read the input file */
function JS_readFile (fname) {
var s = '';
var ForReading = 1;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var ts = fso.OpenTextFile(fname, ForReading);
while (!ts.AtEndOfStream) {
s += ts.ReadLine() + '\n';
}
ts.Close();
return(s);
}
/* Show help if needed - eg 0 command line arguments */
function JS_Help () {
WScript.Echo ('Compress and encode a Javascript source file using Dean Edwards "Packer"');
WScript.Echo (' Version : ' + VERSION);
WScript.Echo (' Syntax : program sourcefile [_encoding] [_fastDecode] [_specialChars]\n');
}
/* Main program: Get arguments; read input file; output packed string */
function main() {
var params = [];
params = JS_getArgs();
params[1] = (typeof(params[1]) == 'undefined') ? 62 : params[1]; // -dean : changed defaults
params[2] = (typeof(params[2]) == 'undefined') ? 1 : params[2];
params[3] = (typeof(params[3]) == 'undefined') ? 0 : params[3];
if (params[0] > '') {
var $script = JS_readFile(params[0]);
if ($script > '') {
$script = pack($script, params[1], params[2], params[3]); /* Returns the Dean Edwards "packed" string */
内容版权声明:除非注明,否则皆为本站原创文章。