本帖最后由 WHY 于 2016-4-11 22:45 编辑
- @if (0)==(0) echo off
- type gui-config.txt | cscript //nologo //e:jscript "%~f0"
- pause & exit
- @end
-
- var getContent = function(body){
- var ado = new ActiveXObject('ADODB.Stream');
- ado.Type = 1;
- ado.Open();
- ado.Write(body);
- ado.Position = 0;
- ado.Type = 2;
- ado.Charset = 'utf-8';
- var arr = ado.ReadText(-1).replace(/\r?\n/g, '\n').split('\n');
- return arr.slice(229, 233);
- }
-
- var http = new ActiveXObject('MSXML2.XMLHTTP');
- http.open('GET', 'http://www.ishadowsocks.net/', false);
- http.send();
-
- var a = getContent(http.responseBody);
- var b = ['"server"', '"server_port"', '"password"', '"method"'];
- var s = WSH.StdIn.ReadAll();
-
- for(var i=0; i<b.length; i++){
- a[i] = a[i].split(':')[1].split(/<\/h4>/i)[0];
- s = s.replace(
- new RegExp('^(' + b[i] + ')([^\r\n]*)', 'im'),
- function(s0, s1, s2){
- return s1 + ' : ' + (s2.indexOf('"')>=0 ? '"' + a[i] + '",' : a[i] + ',');
- }
- )
- }
- WSH.Echo(s)
复制代码
|