人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動態(tài)

HTA編輯HOST文件的腳本

發(fā)布日期:2021-12-22 15:34 | 文章來源:源碼之家
<HTML>
<HEAD>
<TITLE>HOSTS文件編輯器</TITLE>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
<metahttp-equiv="Content-Language"content="zh-CN">
<HTA:APPLICATIONID="hostedit"
APPLICATIONNAME="hostedit"
BORDER="thick"
BORDERSTYLE="normal"
CAPTION="yes"
ICON="C:\WINDOWS\system32\rasphone.exe"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="normal"/>
<scriptlanguage="JScript">
window.onerror=function()
{
window.alert("程序發(fā)生了未知錯誤,當前窗口將被關閉!");
window.close();
returntrue;
}
varwindowW=450;//窗體寬
varwindowH=200;//窗體高
varcanresize=false;//是否可以改變大小
varwindowW2=windowW;//編輯時窗體寬
varwindowH2=200;//編輯時窗體高
window.resizeTo(windowW,windowH);
//window.moveTo((screen.width-windowW)/2,(screen.height-windowH)/2);
window.onresize=function(){if(!canresize)window.resizeTo(windowW,windowH);}
functioninit()
{
varui_table=document.getElementById('UI_TABLE');
varbestHeight=70+ui_table.scrollHeight;
if(bestHeight>screen.height)bestHeight=screen.height;
window.resizeTo(windowW,bestHeight);
//window.moveTo((screen.width-windowW)/2,(screen.height-bestHeight)/2);
}
varhostfile='\\drivers\\etc\\hosts';
functiongetlist(){
varhtml='';
varids='';
vari=1;
FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,1,false);
while(!host.AtEndOfStream){
tmp=host.ReadLine();
if(/^#?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,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))
{
as=tmp.replace(/\s+/,'|:|').split('|:|');
ids+='['+i+'],';
if(/^\#/.test(as[0])){
zt='外網';
ip=as[0].replace(/^\#/,'');
co='#eee!important';
cz='<ahref="#"style="color:red;"onclick="zh('+i+',0);">切本地</a>|<ahref="#"style="color:red;"onclick="ed(this,'+i+');">編輯</a>|<ahref="#"style="color:red;"onclick="zh('+i+',2);">刪除</a>'; }else{
zt='本地';
ip=as[0];
co='#fff!important';
cz='<ahref="#"onclick="zh('+i+',1);">切外網</a>|<ahref="#"style="color:red;"onclick="ed(this,'+i+');">編輯</a>|<ahref="#"style="color:red;"onclick="zh('+i+',2);">刪除</a>';
} html+='<tr><tdstyle="background:'+co+';">'+zt+'</td><tdstyle="background:'+co+';text-align:left;text-indent:6px;">'+as[1]+'</td><tdstyle="text-align:left;text-indent:6px;background:'+co+';">'+ip+'</td><tdstyle="background:'+co+';">'+cz+'</td></tr>';
}
i++;
}
varo=document.getElementById('ids');
o.value=ids;
host.Close();
returnhtml;
} functioned(eo,iId){
document.getElementById('editId').value=iId;
document.getElementById('pIP').value=eo.parentElement.parentElement.children[2].innerText;
document.getElementById('pURL').value=eo.parentElement.parentElement.children[1].innerText;
document.getElementById('addButt').style.display='none';
document.getElementById('editButt').style.display='inline';
document.getElementById('HostList').style.display='none';
document.getElementById('addHost').style.display='block';
window.resizeTo(windowW2,windowH2);
} functionedits(sIp,sUrl){
varoi=document.getElementById(sIp);
varou=document.getElementById(sUrl);
if(oi.value==''||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(oi.value)==false){
alert('IP地址不能為空或你輸入的IP格式錯誤.');
oi.focus();
return;
}
if(ou.value==''||/^[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(ou.value)==false){
alert('域名不能為空或你輸入的域名格式錯誤.');
ou.focus();
return;
}
variId=document.getElementById('editId').value;
varbody='';
vari=1;
FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,1,false);
while(!host.AtEndOfStream){
tmp=host.ReadLine();
if(i==iId)
{
body+=oi.value+"\t"+ou.value+"\n";
}
else{
body+=tmp+"\n";
}
i++;
}
host.close();
svf=FSO.OpenTextFile(spath,2,false);
svf.Write(body);
svf.close();
window.location.reload();
} functionzh(irs,stype)
{
varbody='';
vari=1;
FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,1,false);
while(!host.AtEndOfStream){
tmp=host.ReadLine();
if(i==irs)
{
if(stype==0){
body+=tmp.replace(/^\#/,'');
body+="\n";
}elseif(stype==1){
if(/^\#/.test(tmp)){
body+=tmp+"\n";
}else{
body+='#'+tmp+"\n";
}
}else{ }
}
else{
body+=tmp+"\n";
}
i++;
}
host.close();
svf=FSO.OpenTextFile(spath,2,false);
svf.Write(body);
svf.close();
window.location.reload();
} functionzhall(stype)
{
varbody='';
vari=1;
varids1=document.getElementById("ids").value;
if(ids1=='')return;
FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,1,false);
while(!host.AtEndOfStream){
tmp=host.ReadLine();
if(stype==0&&ids1.indexOf('['+i+'],')!==-1){
body+=tmp.replace(/^\#/,'');
body+="\n";
}elseif(stype==1&&ids1.indexOf('['+i+'],')!==-1){
if(/^\#/.test(tmp)){
body+=tmp+"\n";
}else{
body+='#'+tmp+"\n";
}
}else{
body+=tmp+"\n";
}
i++;
}
host.close();
svf=FSO.OpenTextFile(spath,2,false);
svf.Write(body);
svf.close();
window.location.reload();
} functionAddHosts(sIp,sUrl){
varoi=document.getElementById(sIp);
varou=document.getElementById(sUrl);
if(oi.value==''||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(oi.value)==false){
alert('IP地址不能為空或你輸入的IP格式錯誤.');
oi.focus();
return;
}
if(ou.value==''||/^[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+\.((net)|(com)|(cn)|(org)|(cc)|(tv))$/.test(ou.value)==false){
alert('域名不能為空或你輸入的域名格式錯誤.');
ou.focus();
return;
} FSO=newActiveXObject("Scripting.FileSystemObject");
varspath=FSO.GetSpecialFolder(1)+hostfile;
host=FSO.OpenTextFile(spath,8,false);
host.Write("\n"+oi.value+"\t"+ou.value+"\n");
host.close();
alert('增加域名成功!');
window.location.reload();
}
</script>
<style>
body{
background-color:#99CCFF;
}
body*{
font-size:12px;
margin:0px;
padding:0px;
}
.BUTT{
BORDER:#2C59AA1pxsolid;
FONT-SIZE:12px;
COLOR:black;
FILTER:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#C3DAF5);
height:22px;
padding:3px5px0px;
text-decoration:none;
}
.edit{
BORDER:#2C59AA1pxsolid;
padding:1px;
}
#UI_TABLE{
width:99%;cell-spacing:0px;margin:1px;border-collapse:collapse;border:1pxsolid#7d7d7d;
}
#UI_TABLEtr.TopTitle{
text-align:center;
}
#UI_TABLEtr.TopTitletd{
background-color:#C8E2F7;
}
#UI_TABLEtrtd{
border:1pxsolid#7d7d7d;text-align:center;padding:1px;
} </style>
</HEAD>
<BODYonLoad="init()"oncontextmenu="returnfalse;"style="text-align:center;margin:0px;overflow-y:auto;overflow-x:hidden;border:none;background:menu;">
<divid="HostList">
<inputtype="hidden"name="ids"/>
<tableid="UI_TABLE">
<trclass="TopTitle">
<td>狀態(tài)</td>
<tdstyle="width:140px;">域名</td>
<td>IP地址</td>
<tdstyle="width:140px;">操作</td>
</tr>
<scriptlanguage="javascript"type="text/JavaScript">
document.writeln(getlist());
</script>
</table>
<divstyle="margin:6px;text-align:center;">
<inputtype="button"value="全部切本地"name="b4"onclick="zhall(0);"class="BUTT"/>&nbsp;&nbsp;&nbsp;&nbsp;
<inputtype="button"value="全部切外網"name="b5"onclick="zhall(1);"class="BUTT"/>&nbsp;&nbsp;&nbsp;&nbsp;
<inputtype="button"value="增加域名"name="b6"onclick="document.getElementById('HostList').style.display='none';document.getElementById('addHost').style.display='block';window.resizeTo(windowW2,windowH2);"class="BUTT"/>
</div>
</div>
<divid="addHost"style="display:none;">
<inputtype="hidden"name="editId"name="editId"/>
<divstyle="text-align:left;margin:30pxauto0px;width:300px;">IP地址:<inputtype="text"name="pIP"id="pIP"class="edit"/>&nbsp;&nbsp;<inputtype="button"value="127.0.0.1"name="b2"onclick="document.getElementById('pIP').value='127.0.0.1';"class="BUTT"/></div>
<divstyle="text-align:left;margin:20pxauto;width:300px;">域&nbsp;&nbsp;名:<inputtype="text"name="pURL"id="pURL"class="edit"/></div>
<divstyle="margin:10px;text-align:center;">
<inputtype="button"value="提交"name="b1"id="addButt"onclick="AddHosts('pIp','pURL');"class="BUTT"/>&nbsp;&nbsp;&nbsp;&nbsp;
<inputtype="button"value="編輯"name="b2"id="editButt"style="display:none;"onclick="edits('pIp','pURL');"class="BUTT"/>&nbsp;&nbsp;&nbsp;&nbsp;
<inputtype="button"value="返回"name="b3"onclick="window.location.reload();"class="BUTT"/>
</div>
</div>
<script>
//屏蔽部分鍵盤操作,比如F5
functiondocument.onkeydown()
{wek=window.event.keyCode;
if((window.event.altKey)&&((wek==37)||(wek==39)))
{window.alert("Error:Invalidoperation!");event.returnValue=false;}
if((wek==116)||(event.ctrlKey&&wek==82))
{window.event.keyCode=0;event.returnValue=false;}
if((event.ctrlKey)&&(wek==78))
event.returnValue=false;
if((event.shiftKey)&&(wek==121))
event.returnValue=false;
if(window.event.srcElement.tagName=="A"&&window.event.shiftKey)
window.event.returnValue=false;
if((window.event.altKey)&&(wek==115))
{window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");returnfalse;}
if(wek==122){window.event.keyCode=0;window.alert("Error:Invalidoperation!");returnfalse;}
}
</script>
</BODY>
</HTML>
hostedit.rar

版權聲明:本站文章來源標注為YINGSOO的內容版權均為本站所有,歡迎引用、轉載,請保持原文完整并注明來源及原文鏈接。禁止復制或仿造本網站,禁止在非www.sddonglingsh.com所屬的服務器上建立鏡像,否則將依法追究法律責任。本站部分內容來源于網友推薦、互聯網收集整理而來,僅供學習參考,不代表本站立場,如有內容涉嫌侵權,請聯系alex-e#qq.com處理。

相關文章

實時開通

自選配置、實時開通

免備案

全球線路精選!

全天候客戶服務

7x24全年不間斷在線

專屬顧問服務

1對1客戶咨詢顧問

在線
客服

在線客服:7*24小時在線

客服
熱線

400-630-3752
7*24小時客服服務熱線

關注
微信

關注官方微信
頂部