华域联盟 hta XMLHttps

XMLHttps

难得的是页面里面一个 table 也没有....而且居然在 FF 底下看还不会变形,哦哈哈哈

直接运行的话 URL 只能填本域的,如果遇到安全性限制,代码 copy 到本地保存为 hta 运行

<P><html><head><title>XMLHttps</title><meta http-equiv="content-type" content="text/html; charset=gb2312" /><style>* { font-size:13px; line-height:13px; font-family:"Comic Sans MS" Arial 宋体; color:#333; padding:0px; margin:0px; }</P> <P>body { background-color:buttonface; overflow:auto; border-style:none; padding:0px 15px; text-align:center; }</P> <P>fieldset { margin:7px 0px; }</P> <P>legend { font-weight:bold; font-size:14px; }</P> <P>input { height:16px; line-height:14px; }</P> <P>.text { height:16px; border:1px solid #333; font-size:12px; line-height:14px; padding:0px 5px; }</P> <P>.settingLabel { width:120px; padding:0px 10px; height:16px; line-height:16px; display:block; float:left; }</P> <P>.settingLabel2 { width:118px; padding:0px 10px; height:16px; line-height:16px; float:left; }</P> <P>.label01 { width:90px; }</P> <P>.floatLeft { float:left; }</P> <P>.button01 { border:1px solid #666; color:#555; height:20px; line-height:16px; text-align:center; padding:0px 10px; text-decoration:none; margin-left:10px; }</P> <P>#divMain { width:740px; margin:0px auto; position:relative; text-align:left; }</P> <P>#txtURL { width:590px; }</P> <P>#divHeaders { width:735px; height:90px; float:left; }</P> <P>#outerSelectHeaders, #outerSelectItems { border:1px solid #333; overflow:hidden; position:absolute; margin:4px; }</P> <P>#selectHeaders, #selectItems { width:220px; height:80px; margin:-3px -3px -5px -3px; }</P> <P>#divHeadersSetting, #divItemsSetting { margin-left:360px; }</P> <P>#txtHeaderName, #txtHeaderValue, #txtItemName, #txtItemValue { width:230px; }</P> <P>#txtItemValue { height:35px; overflow:auto; padding:3px; border:1px solid #333; }</P> <P>#divSending { height:120px; }</P> <P>#divSendingData2 { display:none; }</P> <P>#txtSendingData, #txtResponseHeader, #txtResponseBody { width:590px; height:80px; overflow:auto; border-width:1px; padding:3px; }</P> <P>#divReadyState, #divStatus { margin:0px 50px 0px 2px; background-color:green; color:white; padding:0px 20px; float:left; display:block; }</P> <P></style><script>/*************** * Global Variable Defintion * Author: Hutia**/</P> <P>var cmdAddModifyHeader, cmdAddModifyItem, cmdCreateThread, cmdDelHeader, cmdDelItem, cmdSend, cmdViewResponse, divReadyState, divSendingData1;var divSendingData2, divStatus, divThreads, radioInputType1, radioInputType2, radioMethodGet;var radioMethodPost, selectHeaders, selectItems, txtHeaderName, txtHeaderValue;var txtItemName, txtItemValue, txtResponseHeader, txtResponseBody, txtSendingData, txtURL;</P> <P>var xmlhttps=new Array();var curThread;</P> <P>var glbEncode=new Array();</P> <P>//**检测浏览器种类*****var BROWSERNAME="";switch(navigator.appName.toLowerCase()){ case "netscape": BROWSERNAME="ns"; break; case "microsoft internet explorer": default: BROWSERNAME="ie"; break;}</P> <P>// init function for window.onloadfunction init(){ // init the window size fixSize(); //window.onresize=fixSize; // init all the global object variable for compatibility cmdAddModifyHeader=document.getElementById("cmdAddModifyHeader"); cmdAddModifyItem=document.getElementById("cmdAddModifyItem"); cmdCreateThread=document.getElementById("cmdCreateThread"); cmdDelHeader=document.getElementById("cmdDelHeader"); cmdDelItem=document.getElementById("cmdDelItem"); cmdSend=document.getElementById("cmdSend"); cmdViewResponse=document.getElementById("cmdViewResponse"); divReadyState=document.getElementById("divReadyState"); divSendingData1=document.getElementById("divSendingData1"); divSendingData2=document.getElementById("divSendingData2"); divStatus=document.getElementById("divStatus"); divThreads=document.getElementById("divThreads"); radioInputType1=document.getElementById("radioInputType1"); radioInputType2=document.getElementById("radioInputType2"); radioMethodGet=document.getElementById("radioMethodGet"); radioMethodPost=document.getElementById("radioMethodPost"); selectHeaders=document.getElementById("selectHeaders"); selectItems=document.getElementById("selectItems"); txtHeaderName=document.getElementById("txtHeaderName"); txtHeaderValue=document.getElementById("txtHeaderValue"); txtItemName=document.getElementById("txtItemName"); txtItemValue=document.getElementById("txtItemValue"); txtResponseHeader=document.getElementById("txtResponseHeader"); txtResponseBody=document.getElementById("txtResponseBody"); txtSendingData=document.getElementById("txtSendingData"); txtURL=document.getElementById("txtURL"); // init all the events for elements cmdAddModifyHeader.onclick=function(){setHeader();thread_setAttribute("headers",headers_select2array());return(false);} cmdAddModifyItem.onclick=function(){setItem();txtSendingData.value=items_select2string();thread_setAttribute("requestData",txtSendingData.value);return(false);} cmdDelHeader.onclick=function(){delHeader();thread_setAttribute("headers",headers_select2array());return(false);} cmdDelItem.onclick=function(){delItem();txtSendingData.value=items_select2string();thread_setAttribute("requestData",txtSendingData.value);return(false);} cmdAddModifyHeader.onmouseover=cmdAddModifyItem.onmouseover=cmdCreateThread.onmouseover=cmdDelHeader.onmouseover=cmdDelItem.onmouseover=cmdSend.onmouseover=cmdViewResponse.onmouseover=function(){this.style.backgroundColor="#E0E0E0";} cmdAddModifyHeader.onmouseout=cmdAddModifyItem.onmouseout=cmdCreateThread.onmouseout=cmdDelHeader.onmouseout=cmdDelItem.onmouseout=cmdSend.onmouseout=cmdViewResponse.onmouseout=function(){this.style.backgroundColor="";} cmdCreateThread.onclick=createThread; cmdSend.onclick=function(){ curThread=parseInt(curThread); if(isNaN(curThread))return; if(!xmlhttps[curThread])return; if(!xmlhttps[curThread].client)return; xmlhttps[curThread].resultTreated=false; xmlhttps[curThread].client.open(xmlhttps[curThread].method,xmlhttps[curThread].url+(xmlhttps[curThread].url.indexOf("?")==-1?"?":"&")+uid()+"="+uid(),true); for(var i=0;i<xmlhttps[curThread].headers.length;i++){ xmlhttps[curThread].client.setRequestHeader(unescape(xmlhttps[curThread].headers[i].split("=")[0]),unescape(xmlhttps[curThread].headers[i].split("=")[1])); } xmlhttps[curThread].client.setRequestHeader("Content-Length",String(String(xmlhttps[curThread].requestData).length)); xmlhttps[curThread].client.send(xmlhttps[curThread].requestData); } cmdViewResponse.onclick=function(){ try{ var newWin=window.open("about:blank","_blank"); newWin.document.open(); newWin.document.clear(); newWin.document.write("<base href=\""+txtURL.value+"\"\/><SCRIPT>function killErrors() {return true;}window.onerror = killErrors;<\/SCRIPT>"+txtResponseBody.value); newWin.document.close(); }catch(e){} } radioInputType1.onfocus=radioInputType1.onclick=function(){ if(this.checked&&divSendingData1.style.display=="none"){ switchInputType(true); thread_setAttribute("dataType",this.value); } } radioInputType2.onfocus=radioInputType2.onclick=function(){ if(this.checked&&divSendingData2.style.display=="none"){ switchInputType(false); thread_setAttribute("dataType",this.value); } } radioMethodGet.onfocus=function(){if(this.checked)thread_setAttribute("method",this.value);} radioMethodPost.onfocus=function(){if(this.checked)thread_setAttribute("method",this.value);} selectHeaders.onchange=selectHeaders.onclick=showHeader; selectItems.onchange=selectItems.onfocus=showItem; txtSendingData.onchange=function(){thread_setAttribute("requestData",this.value);} txtURL.onchange=function(){ if(!this.value.match(/^http:\/\//i))this.value="http://"+this.value; thread_setAttribute("url",this.value); } // init timer setInterval(refreshStatus,200); // init action createThread(); loadThread(0); addHeader("Content-Type","application/x-www-form-urlencoded"); addItem("UserName","Hutia");}</P> <P>// function for window resizingfunction fixSize(){ try{ top.resizeTo(screen.availWidth-2,screen.availHeight-2); top.moveTo(1,1); }catch(e){setTimeout(fixSize);}}</P> <P>/*************** * Some Functional functions * Author: Hutia**/</P> <P>function addHeader(headerName,headerValue){ if(headerName=="")return; for(var i=0;i<selectHeaders.options.length;i++){ if(selectHeaders.options[i].headerName==headerName){selectHeaders.options[i].value=headerValue;return;} } newOption=new Option(headerName,headerValue); newOption.headerName=headerName; selectHeaders.options[selectHeaders.options.length]=newOption;}</P> <P>function addItem(itemName,itemValue){ if(itemName=="")return; for(var i=0;i<selectItems.options.length;i++){ if(selectItems.options[i].itemName==itemName){selectItems.options[i].value=itemValue;return;} } newOption=new Option(itemName,itemValue); newOption.itemName=itemName; selectItems.options[selectItems.options.length]=newOption;}</P> <P>function createThread(){ var index, oRadio, oLabel; index=xmlhttps.length; xmlhttps[index]=new Object();</P> <P> xmlhttps[index].client=getXMLRequester(); xmlhttps[index].headers=new Array(); xmlhttps[index].url="http://"; xmlhttps[index].method="get"; xmlhttps[index].id=uid(); xmlhttps[index].dataType="Name-Value"; xmlhttps[index].requestData=""; xmlhttps[index].responseHeaders=""; xmlhttps[index].responseText=""; xmlhttps[index].resultTreated=false; if(!xmlhttps[index].client){alert("创建进程失败,请检查安全设置。");return(false);} if(BROWSERNAME=="ie"){ oRadio=document.createElement("<input type=\"radio\" name=\"radioThreads\">"); }else{ oRadio=document.createElement("input"); oRadio.type="radio"; oRadio.name="radioThreads"; oRadio.checked=true; } oRadio.id=xmlhttps[index].id; oRadio.value=index; oRadio.onclick=oRadio.onfocus=function(){ if(this.checked&&curThread!=this.value){loadThread(this.value);}; } oLabel=document.createElement("label"); oLabel.htmlFor=oRadio.id; oLabel.innerHTML="进程"+(index+1); divThreads.appendChild(oRadio); divThreads.appendChild(oLabel); }</P> <P>function delHeader(){ var index=selectHeaders.selectedIndex; if(index<0)return; selectHeaders.options[selectHeaders.selectedIndex]=null; if(index>=selectHeaders.options.length)index--; if(index<selectHeaders.options.length&&index>-1)selectHeaders.options[index].selected=true; showHeader();}</P> <P>function delItem(){ var index=selectItems.selectedIndex; if(index<0)return; selectItems.options[selectItems.selectedIndex]=null; if(index>=selectItems.options.length)index--; if(index<selectItems.options.length&&index>-1)selectItems.options[index].selected=true; showItem();}</P> <P>function headers_array2select(ary){ while(selectHeaders.options.length>0)selectHeaders.options[0]=null; for(var i=0;i<ary.length;i++)addHeader(unescape(ary[i].split("=")[0]),unescape(ary[i].split("=")[1]));}</P> <P>function headers_select2array(){ var ary=new Array(); for(var i=0;i<selectHeaders.options.length;i++){ ary.push(escape(selectHeaders.options[i].headerName)+"="+escape(selectHeaders.options[i].value)); } return(ary);}</P> <P>function items_select2string(){ var str=""; for(var i=0;i<selectItems.options.length;i++){ str+="&"+UrlEncode(selectItems.options[i].itemName)+"="+UrlEncode(selectItems.options[i].value); } return(str.substring(1));}</P> <P>function items_string2select(str){ var ary=str.split("&"); while(selectItems.options.length>0)selectItems.options[0]=null; for(var i=0;i<ary.length;i++)addItem(String(UrlDecode(ary[i].split("=")[0])),UrlDecode(String(ary[i].split("=")[1])));}</P> <P>function loadThread(threadID){ var radios; if(threadID!=null&&threadID!=undefined&&!isNaN(threadID))curThread=threadID; curThread=parseInt(curThread); if(isNaN(curThread))return; if(!xmlhttps[curThread])return; if(!xmlhttps[curThread].client)return; radios=document.getElementsByName("radioThreads"); for(var i=0;i<radios.length;i++)if(radios[i].id==xmlhttps[curThread].id){radios[i].checked=true;break;} if(xmlhttps[curThread].method=="get"){radioMethodGet.checked=true;}else{radioMethodPost.checked=true;} headers_array2select(xmlhttps[curThread].headers); if(selectHeaders.options.length>0)selectHeaders.options[0].selected=true; showHeader(); txtSendingData.value=xmlhttps[curThread].requestData; items_string2select(xmlhttps[curThread].requestData); if(xmlhttps[curThread].dataType=="Name-Value"){ radioInputType1.checked=true;switchInputType(true); }else{ radioInputType2.checked=true;switchInputType(false); } txtURL.value=xmlhttps[curThread].url; if(xmlhttps[curThread].method=="get"){ radioMethodGet.checked=true; }else{ radioMethodPost.checked=true; } txtResponseHeader.value=xmlhttps[curThread].responseHeaders; txtResponseBody.value=xmlhttps[curThread].responseText;}</P> <P>function refreshStatus(){ try{ curThread=parseInt(curThread); if(isNaN(curThread))return; if(!xmlhttps[curThread])return; if(!xmlhttps[curThread].client)return; var readyState=["就绪","解析地址","发送请求","下载中","完成"]; var str=readyState[xmlhttps[curThread].client.readyState]; if(divReadyState.innerHTML!=str)divReadyState.innerHTML=str; try{divStatus.innerHTML=xmlhttps[curThread].client.status;}catch(e){divStatus.innerHTML="-1";} if(xmlhttps[curThread].resultTreated==false&&xmlhttps[curThread].client.readyState>2){ txtResponseHeader.value=xmlhttps[curThread].responseHeaders=xmlhttps[curThread].client.getAllResponseHeaders(); txtResponseBody.value=xmlhttps[curThread].responseText=reCode(xmlhttps[curThread].client.responseBody); if(xmlhttps[curThread].client.readyState==4)xmlhttps[curThread].resultTreated=true; } }catch(e){}}</P> <P>function setHeader(){ var headerName=txtHeaderName.value, headerValue=txtHeaderValue.value, newOption; addHeader(headerName,headerValue);}</P> <P>function setItem(){ var itemName=txtItemName.value, itemValue=txtItemValue.value, newOption; addItem(itemName,itemValue);}</P> <P>function showHeader(){ if(selectHeaders.selectedIndex<0)return; txtHeaderName.value=selectHeaders.options[selectHeaders.selectedIndex].headerName; txtHeaderValue.value=selectHeaders.options[selectHeaders.selectedIndex].value;}</P> <P>function showItem(){ if(selectItems.selectedIndex<0)return; txtItemName.value=selectItems.options[selectItems.selectedIndex].itemName; txtItemValue.value=selectItems.options[selectItems.selectedIndex].value;}</P> <P>function switchInputType(flag){ if(flag){ divSendingData1.style.display="block"; divSendingData2.style.display="none"; items_string2select(txtSendingData.value); showItem(); }else{ divSendingData1.style.display="none"; divSendingData2.style.display="block"; txtSendingData.value=items_select2string(); }}</P> <P>function thread_setAttribute(strAttName, varAttValue){ curThread=parseInt(curThread); if(isNaN(curThread))return; if(!xmlhttps[curThread])return; if(!xmlhttps[curThread].client)return; switch(strAttName){ case "url": xmlhttps[curThread].url=varAttValue; break; case "method": xmlhttps[curThread].method=varAttValue; break; case "headers": xmlhttps[curThread].headers=varAttValue; break; case "dataType": xmlhttps[curThread].dataType=varAttValue; break; case "requestData": xmlhttps[curThread].requestData=varAttValue; break; }}</P> <P>/*************** * Some common functions * Author: Hutia**/</P> <P>function htmlEncode(strS){ return(strS.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;").replace(/\n/g,"<br\/>"));}</P> <P>function htmlDecode(strS){ return(strS.replace(/<br\/?>/ig,"\r\n").replace(/&nbsp;/ig," ").replace(/&gt;/ig,">").replace(/&lt;/ig,"<").replace(/&amp;/ig,"&"));}</P> <P>function uid(){ return("u"+String((new Date()).getTime()).substring(5)+parseInt(Math.random()*100000));}</P> <P>function getXMLRequester(){ var xmlhttp_request = false; try{ if( window.ActiveXObject ){ for( var i = 5; i > -1; i-- ){ try{ if( i == 2 ){ xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" ); }else{ xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" ); } break; }catch(e){ xmlhttp_request = false; } } }else if( window.XMLHttpRequest ){ xmlhttp_request = new XMLHttpRequest(); } }catch(e){ xmlhttp_request = false; } return xmlhttp_request;}</P> <P>function getElementByClassName(obj,className){ for(var i=0;i<obj.childNodes.length;i++){ if(obj.childNodes[i].className==className)return(obj.childNodes[i]); } return(null);}</P> <P>function reCode(b){ var t=rsB(b); t=escape(t).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2"); t=t.split("@"); var i=0,j=t.length,k; while(++i<j){ k=t[i].substring(0,4); if(!glbEncode[k])glbEncode[k]=escape(vbChar(eval("0x"+k))).substring(1,6); t[i]=glbEncode[k]+t[i].substring(4); } return unescape(t.join("%"));}</P> <P>function initVBS(){ strVBS="<script language=vbscript>\r\n"; strVBS+="Function rsB(vIn)\r\nrsB=MidB(vIn,1)\r\nEnd Function\r\n"; strVBS+="Function vbChar(ss)\r\nvbChar = Chr(ss)\r\nEnd Function\r\n"; strVBS+="Function ascCode(chrV)\r\n ascCode = hex(asc(chrV)) \r\n End Function \r\n"; strVBS+="Function toHex(ss)\r\n toHex = eval(\"&H\"+ss) \r\n End Function \r\n"; strVBS+="<\/script>"; document.write(strVBS);}</P> <P>/* This following code are designed and writen by Windy_sk <[email protected]> You can use it freely, but u must held all the copyright items! Especially thanks to 色眯眯的小疯狗 Modified By Hutia.*/</P> <P>String.prototype.GetCount = function(str,mode){return eval("this.match(/("+str+")/g"+(mode?"i":"")+").length");}</P> <P>function UrlEncode(str){ /*-- Modify from qiushuiwuhen --*/ var i,temp,p,q; var result=""; for(i=0;i<str.length;i++){ temp = str.charCodeAt(i); if(temp>=0x4e00){ result+=ascCode(str.charAt(i)).replace(/(.{2})/g, "%$1"); }else{ result+=escape(str.charAt(i)); } } return result;}</P> <P>function UrlDecode(str){ var i,temp; var result=""; for(i=0;i<str.length;i++){ if(str.charAt(i)=="%"){ if(str.charAt(++i)=="u"){ temp=str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i++) + str.charAt(i); result += unescape("%" + temp); }else{ temp = str.charAt(i++) + str.charAt(i); if(eval("0x"+temp)<=160){ result += unescape("%" + temp); }else{ temp += str.charAt(++i) + str.charAt(++i) + str.charAt(++i); result += Decode_unit("%" + temp); } } }else{ result += str.charAt(i); } } return result;}</P> <P>function Decode_unit(str){ var p,q = ""; if(str.GetCount("%")!=2)return str; p=eval("0x" + str.split("%")[1]); q=eval("0x" + str.split("%")[2]); if(p<160 || q<160)return unescape(str); str=str.replace(/%/g,""); return(vbChar(toHex(str)));}</P> <P> </P> <P>//**确认需要的VBScript函数是否存在,不存在就写一个****try{if(typeof(rsB)=="undefined"){initVBS();};}catch(e){initVBS();}</P> <P>window.onload=init;</script></head><body><div id="divMain"><fieldset> <legend>Threads</legend> <div id="divThreads"></div></fieldset><fieldset> <legend>Settings</legend> <div id="divSetting"> <span class="settingLabel">URL:</span> <input id="txtURL" class="text" value="http://"/> <span class="settingLabel">Method:</span> <input id="radioMethodGet" name="radioMethod" value="get" type="radio" checked /> <label for="radioMethodGet" class="label01">Get</label> <input id="radioMethodPost" name="radioMethod" value="post" type="radio"/> <label for="radioMethodPost" class="label01">Post</label> <div id="divHeaders"> <span class="settingLabel floatLeft">Headers:</span> <span id="outerSelectHeaders"><select id="selectHeaders" size="2"></select></span> <div id="divHeadersSetting"> <span class="settingLabel2">Header Name:</span> <input id="txtHeaderName" class="text"/> <span class="settingLabel2">Header Value:</span> <input id="txtHeaderValue" class="text"/> <input class="button01" id="cmdAddModifyHeader" type="button" value="Add / Modify" /> <input class="button01" id="cmdDelHeader" type="button" value="Delete" /> </div> </div> </div></fieldset><fieldset> <legend>Sending String</legend> <div id="divSending"> <span class="settingLabel">Input type:</span> <input id="radioInputType1" name="radioInputType" type="radio" value="Name-Value" checked="true"/> <label for="radioInputType1" class="label01">Name-Value</label> <input id="radioInputType2" name="radioInputType" type="radio" value="By-String"/> <label for="radioInputType2" class="label01">By-String</label> <div id="divSendingData1"> <span class="settingLabel floatLeft">Items:</span> <span id="outerSelectItems"><select id="selectItems" size="2"></select></span> <div id="divItemsSetting"> <span class="settingLabel2">Item Name:</span> <input id="txtItemName" class="text"/> <span class="settingLabel2">Item Value:</span> <textarea id="txtItemValue"></textarea> <input class="button01" id="cmdAddModifyItem" type="button" value="Add / Modify" /> <input class="button01" id="cmdDelItem" type="button" value="Delete" /> </div> </div> <div id="divSendingData2"> <span class="settingLabel">Data String:</span> <textarea id="txtSendingData"></textarea> </div> </div></fieldset><fieldset> <legend>Current State</legend> <div id="divState"> <span class="settingLabel">Ready State:</span> <div id="divReadyState">就绪</div> <span class="settingLabel">Status:</span> <div id="divStatus">-1</div> </div></fieldset><fieldset> <legend>Operation</legend> <div id="divOperation"> <span class="settingLabel">Operations:</span> <input class="button01" id="cmdSend" type="button" value="Send Request" /> <input class="button01" id="cmdCreateThread" type="button" value="Create Thread" /> <input class="button01" id="cmdViewResponse" type="button" value="View Reponse as HTML" /> </div></fieldset><fieldset> <legend>Response Data</legend> <span class="settingLabel">Headers:</span> <textarea id="txtResponseHeader" readonly ></textarea> <span class="settingLabel">Body:</span> <textarea id="txtResponseBody" readonly ></textarea></fieldset></div></body></html></P>

[Ctrl+A 全选 注:
引入外部Js需再刷新一下页面才能执行]

本文由 华域联盟 原创撰写:华域联盟 » XMLHttps

转载请保留出处和原文链接:https://www.cnhackhy.com/13962.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部