文档hta编辑host文件脚本

host文件  时间:2021-02-27  阅读:()

★精品文档★hta编辑host文件脚本

代码如下:

<html

<head

<titlehosts文件编辑器</title

<meta http-equiv=content-type content=text/html ;charset=gb2312

<meta http-equiv=content-language content=zh-cn

<hta:appl ication id=hosteditappl icationname=hosteditborder=thickborderstyle=normalcaption=yesicon=c:\windows\system32\rasphone.exe maximizebutton=yesminimizebutton=yesshowintaskbar=yessingleinstance=yessysmenu=yesversion=1 .0windowstate=normal /

<script language=jscript

1/17

★精品文档★window.onerror=function ()

{

  window.alert(程序发生了未知错误当前窗口将被关闭 );

  window.close();

   return true;

}var windoww=450;  //窗体宽var windowh=200;  //窗体高var canresize=false;//是否可以改变大小var windoww2=windoww;//编辑时窗体宽var windowh2=200;//编辑时窗体高window.resizeto(windoww,windowh);

//window.moveto((screen.width-windoww)/2,(screen.height-windowh)/2);window.onresize=function(){if(!canresize)window.resizeto(windoww,windowh);}function init()

{

    var ui_table =2/17

★精品文档★document.getelementbyid(‘ui_table’);

    var bestheight =70+ui_table.scrol lheight;

    if(bestheight screen.height)bestheight=screen.height;

  window.resizeto(windoww,bestheight);

   //window.moveto((screen.width-windoww)/2,(screen.height-bestheight)/2);

}var hostfi le=‘\\drivers\\etc\\hosts’ ;function getl ist(){

  var html=‘ ‘ ;

  var ids=‘ ‘ ;

  var i=1 ;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =fso.getspecia lfolder(1)+hostfi ,3}\s+([a-za-z0-9\-]+\.[a-za-z0-9\-]+(\.(com|net|org|edu| info|biz|cc|tv|gov|mobi |name|cn|en|us|hk|tw))+)$/.test(tmp))

     {

3/17

★精品文档★

       as=tmp.replace(/\s+/, ’ | : | ’).spl it(‘ | : | ’);

  &nb       co =‘#eee! important’ ;

            cz =‘<a href=# style=color:red; oncl ick=zh(‘+i+’ ,0);切本地</a|<a href=#style=color:red;oncl ick=ed(this, ’+i+’);编辑</a|<a href=#style=color:red;oncl ick=zh(‘+i+’ ,2);删除</a’ ;

     }else{

       zt= ‘本地’ ;

       ip=as[0];

            co =‘#fff! important’ ;

            cz =‘<a href=#oncl ick=zh(‘+i+’ ,1);切外网</a |<a href=#style=color:red; oncl ick=ed(this, ‘+i+’);编辑</a | <ahref=# style=color:red; oncl ick=zh(‘+i+’ ,2);删除</a’ ;  

     }

       html +=

4/17

★精品文档★

‘<tr<td style=background: ’+co+’ ; ’+zt+’</td<tdstyle=background: ’+co+’ ;text-al ign: left;text-indent:6px; ’+as

[1]+’</td<tdstyle=text-al ign: left;text-indent:6px;background: ’+co+’ ; ’+ip+’</td<td style=background: ’+co+’ ; ’+cz+’</td</tr’ ;

     }

     i++;

   }

  var o=document.getelementbyid(‘ ids’);

  o.value=ids;

   host.close();

   return html ;

}function ed(eo, i id){  

   document.getelementbyid(‘editid’).value=i id;

   document.getelementbyid(‘pip’).value=eo.parentelement.parentelement.chi ldren[2]. innertext;

   document.getelementbyid(‘purl’).value=eo.parentelement.parentelement.chi ldren[1]. innertext;

5/17

★精品文档★

   document.getelementbyid(‘addbutt’).style.display=‘none’ ;

   document.getelementbyid(‘editbutt’).style.display=‘ inl ine’ ;

   document.getelementbyid(‘hostl ist’).style.display=‘none’ ;

   document.getelementbyid(‘addhost’).style.display=‘block’ ;d{1 ,3}\.\d{1 ,3}\.\d{1 ,3}$/.test(oi .value)==false) {

    alert(‘ ip地址不能为空或你输入的ip格式错误. ’);

    oi .focus();

     return;

   }

    if(ou.valuesp;      return;

   }

    var i id =document.getelementbyid(‘editid’).value;

  var body=‘ ‘ ;

  var i=1 ;

    fso = new

6/17

★精品文档★activexobject(scripting.fi lesystemobject);

    var spath =fso.getspecialfolder(1)+hostfi le;  

   host=fso.opentextfi le(spath, 1 , false);

  whi le(!host.atendofstream){

     tmp=host.readl ine();

     if(i==i id)

     {

           body+=oi .value+\t+ou.value+\n;

     }

    else{

           body+=tmp+\n;

     }

     i++;

   }

   host.close();

&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);

  svf.write(body);

  svf.close();

  window. location.reload();

7/17

★精品文档★

}function zh(irs,stype)

{

  var body=‘ ‘ ;

  var i=1 ;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =fso.getspecialfolder(1)+hostfi le;  

   host=fso.opentextfi le(spath, 1 , false);

  whi le(!host.atendofstream){

     tmp=host.readl ine();

   body+=tmp+\n;

         }else{

          body+=‘#’+tmp+\n;

         }

       }else{

       }

     }

8/17

★精品文档★

    else{

           body+=tmp+\n;

     }

     i++;

   }

   host.close();

&n bsp;&n bsp;svf=fso.opentextfi le(spath,2, false);

  svf.write(body);

  svf.close();

  window. location.reload();

}function zhal l(stype)

{

  var body=‘ ‘ ;

  var i=1 ;

    varids1=document.getelementbyid(ids).value;

   if(ids1==‘ ‘) return;

    fso = newactivexobject(scripting.fi lesystemobject);

    var spath =

9/17

百纵科技,美国独立服务器 E52670*1 32G 50M 200G防御 899元/月

百纵科技:美国高防服务器,洛杉矶C3机房 独家接入zenlayer清洗 带金盾硬防,CPU全系列E52670、E52680v3 DDR4内存 三星固态盘阵列!带宽接入了cn2/bgp线路,速度快,无需备案,非常适合国内外用户群体的外贸、搭建网站等用途。C3机房,双程CN2线路,默认200G高防,3+1(高防IP),不限流量,季付送带宽美国洛杉矶C3机房套餐处理器内存硬盘IP数带宽线路防御价格/月套...

vpsdime:VPS内存/2核/VPS,4G内存/2核/50gSSD/2T流量/达拉斯机房达拉斯机房,新产品系列-Windows VPS

vpsdime上了新产品系列-Windows VPS,配置依旧很高但是价格依旧是走低端线路。或许vpsdime的母公司Nodisto IT想把核心产品集中到vpsdime上吧,当然这只是站长个人的猜测,毕竟winity.io也是专业卖Windows vps的,而且也是他们自己的品牌。vpsdime是一家新上来不久的奇葩VPS提供商,实际是和backupspy以及crowncloud等都是同一家公司...

Ceranetworks顶级合作伙伴 香港E3 16G 299元 香港E5 32G 650元 美国E3 16G 650元

提速啦(www.tisula.com)是赣州王成璟网络科技有限公司旗下云服务器品牌,目前拥有在籍员工40人左右,社保在籍员工30人+,是正规的国内拥有IDC ICP ISP CDN 云牌照资质商家,2018-2021年连续4年获得CTG机房顶级金牌代理商荣誉 2021年赣州市于都县创业大赛三等奖,2020年于都电子商务示范企业,2021年于都县电子商务融合推广大使。资源优势介绍:Ceranetwo...

host文件为你推荐
易pc华硕的易PC怎么样,能流畅运行的游戏大概是什么水平的?人人时光机现在世界上有时光机吗今日热点怎么删除“今日热点”到底要怎样才能取消弹窗,每次开机都会今日热点怎么删除youku今日热点怎么卸载滚动代码来回滚动代码天天酷跑刷金币天天酷跑如何刷分刷金币?ios7固件下载ios 7及以上固件请在设备上点“信任”在哪点?ios7固件下载iOS的固件有正版盗版之分吗?我看到了蜂威网有iOS7的固件想下载试用一下,那里是测试版是正版吗如何快速收录如何让百度快速收录srv记录SRV记录的定义
网站空间租用 域名查询软件 提供香港vps 主机优惠码 koss permitrootlogin 免费cdn加速 国外网站代理服务器 湖南服务器托管 华为网络硬盘 好看qq空间 新家坡 免费防火墙 昆明蜗牛家 双线asp空间 国内域名 东莞服务器托管 畅行云 万网空间 免费个人网页 更多