...

Make a WHOIS search via XMLHTTP

LeXRus
02-01-2004, 06:27 AM
This HTA called a WebService by posting an XML. Here is a description of the service:
http://66.165.154.102/whois.asmx?op=GetWhoIS

Save the following code as "WHOIS.hta". Then launch it(For Windows 9x+ & IE 5.5+).
And it's easy to convert it to asp. So it may works well on your web server, too.

<html>
<head>
<title>WHOIS WebService</title>
<!-- Edited by LeXRus http://LeXRus.blueidea.com/ -->
<meta http-equiv="Content-Type" content="application/hta; charset=utf-8">
<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="WHOIS" BORDER="thick" BORDERSTYLE="normal" CAPTION="yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="yes" SHOWINTASKBAR="yes" SINGLEINSTANCE="no" SYSMENU="yes" VERSION="0.73B" WINDOWSTATE="normal"/>
<style>
body{background:buttonface;border-width:0px;overflow:auto;}
#domain{border:2px inset; font-size:11px;font-family:verdana;width:200px;text-align:center;}
#submit{border:2px outset;font-size:11px;font-family:verdana;font-weight:bolder;}
textarea{width:100%;height:350px;border:2px inset;font-size:11px;font-family:verdana;overflow:auto;}
div{font-size:11px;font-family:verdana;}
h1{font-size:24px;font-family:tahoma;vertical-align:middle;}
</style>
</head>

<body onload="window.resizeTo(600,500)" onresize="window.resizeTo(600,500)">
<div align="center">
<h1>WHOIS Search</h1>
<u>D</u>omain: <input type="text" id="domain" accesskey="d" value="blueidea.com"/>
&nbsp;<button id="submit" type="button" onclick="submitSearch()" accesskey="s"><u>S</u>ubmit</button>
</div>
<br/>
<div align="center"><textarea id="result"></textarea></div>
<script>
var
url='http://66.165.154.102/whois.asmx',
soapRequestStr='<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><GetWhoIS xmlns="http://www.webserviceX.NET"><HostName>blueidea.com</HostName></GetWhoIS></SOAP-ENV:Body></SOAP-ENV:Envelope>'

var
xmlhttp=new ActiveXObject('msxml2.xmlhttp')
xmlhttp.onreadystatechange=getReady
xmlhttp.open('POST',url,true)
xmlhttp.setRequestHeader('Referer',url)
xmlhttp.setRequestHeader('Content-Type','text/xml;charset=utf-8')
xmlhttp.setRequestHeader('SOAPAction','http://www.webserviceX.NET/GetWhoIS')
xmlhttp.setRequestHeader('Content-Length',soapRequestStr.length)

var
xmldoc=new ActiveXObject('msxml.domdocument')
xmldoc.loadXML(soapRequestStr)

function submitSearch(){
xmldoc.selectSingleNode('//HostName').text=domain.value
xmlhttp.abort()
xmlhttp.onreadystatechange=getReady
xmlhttp.open('POST',url,true)
xmlhttp.setRequestHeader('Referer',url)
xmlhttp.setRequestHeader('Content-Type','text/xml;charset=utf-8')
xmlhttp.setRequestHeader('SOAPAction','http://www.webserviceX.NET/GetWhoIS')
xmlhttp.setRequestHeader('Content-Length',soapRequestStr.length)
xmlhttp.send(xmldoc)
submit.disabled=true
submit.innerText='Searching...'
}

function getReady(){
if(xmlhttp.readyState==4){
result.value=xmlhttp.responseXML.selectSingleNode('//GetWhoISResult').text.replace(/[\s\S]+Network Solutions reserves the right to modify these terms at any time\./,'')
submit.disabled=false
submit.innerText='Submit'
}
}
</script>
</body>
</html>

WA
02-01-2004, 01:04 PM
I haven't tested this out- can you describe in more detail what the script actually does or how it is useful?

Thanks,

liorean
02-01-2004, 01:10 PM
Does HTA allow you to reach out of the originating domain with XMLHTTP? Because JavaScript shouldn't be able to do that. (SHOULD NOT according to the ECMA specification, that is.)


In the case of a normal homepage, in ie5.5w you could, but ie6w has stricter rules when it comes to this. So, does HTA allow this thing that JavaScript shouldn't be able to do?

rsci
02-03-2004, 03:24 PM
An HTA does allow javascript to go beyond the 'local' domain, that's the beauty and curse of it. You will see virii that use hta because it also allows you to write to the registry. HTA or Hypertext Application basically has the same power as a .exe.

rsci
02-03-2004, 10:43 PM
Nice application. Opens up other possibilities of page requests.

LeXRus
02-06-2004, 03:23 AM
not only in hta, but also in local script.
so when you call an xmlhttp object in a local html page to "go beyond the 'local' domain", it works well.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum