标题: [网络连接] 让域名解析出来的IP直接使用在脚本里 [打印本页]
作者: jjhy520 时间: 2017-2-9 03:22 标题: 让域名解析出来的IP直接使用在脚本里
- FOR /f "tokens=2 delims=[]" %%a in ('ping -n 1 iss.pm') do (
- ECHO %%i %%a
复制代码
这是域名解析IP
然后直接替换在下面脚本21行里的IP 保留网址的http:// 跟尾/- @if (0)==(0) echo off
- taskkill /f /im Shadowsocks.exe
- type templates\untrusted.ini | cscript //nologo //e:jscript "%~f0" > gui-config.json
- start Shadowsocks.exe
- 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(221, 225);
- }
-
- var http = new ActiveXObject('MSXML2.XMLHTTP');
- http.open('GET', 'http://160.16.231.71/', 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)
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |