[hta] simulation ms-dos

Description

Cet Exemple vous montre comment à partir d'un HTA, on peut exécuter quelques commandes MS-DOS.
NB:Je vous recommande de télécharger directement le HTA car il contient des caractères Unicode qui peuvent être illisibles lors du copier et coller du code source.

Source / Exemple :


<html>
<HTA:APPLICATION 
ICON="cmd.exe"
APPLICATIONNAME = "Microsoft Windows [version 7.1 7631] Copyright Simulation Dos © Hackoo 2013" 
BORDER="dialog"
BORDERSTYLE="complex"
SINGLEINSTANCE="yes"  
WINDOWSTATE="maximize"
>
<style>
body{
background-color: Black;
}
</style>
<link rel="stylesheet" media="screen" type="text/css" title="design_encoder" href="&#0104;&#0116;&#0116;&#0112;&#0058;//&#0104;&#0097;&#0099;&#0107;&#0111;&#0111;&#0046;&#0097;&#0108;&#0119;&#0097;&#0121;&#0115;&#0100;&#0097;&#0116;&#0097;&#0046;&#0110;&#0101;&#0116;/&#0100;&#0101;&#0115;&#0105;&#0103;&#0110;&#0095;&#0101;&#0110;&#0099;&#0111;&#0100;&#0101;&#0114;&#0046;&#0099;&#0115;&#0115;"/>
<title>Microsoft Windows [version 7.1 7631] Copyright Simulation Dos © Hackoo 2013</title>
<script type="text/Vbscript">
Function RunDos(Command,TempFile)
myDiv.innerHTML = ""
Set ws = CreateObject("WScript.Shell")
If Command="" Then
MsgBox "Attention il faut taper dans le champ de saisie une commande pour l'exécuter",48,"ATTENTION !"
Exit Function
End if
Res = ws.run("cmd /c "&Command&" > "&TempFile,0,True)
On Error Resume Next
RunDos = Err.Number
    If Err.Number <> 0  Then
        MsgBox Err.Description,16," Erreur"
        Exit Function
    End If
myDiv.innerHTML = LoadFile(TempFile)
End Function

Function LoadFile(TempFile)
Set fso = CreateObject("Scripting.FileSystemObject")
Set F = fso.OpenTextFile(TempFile,1)
ReadMe = F.ReadAll
Tab = split(ReadMe,vbcrlf)
    For i = lbound(Tab) to ubound(Tab)
        paragraphe=paragraphe & Tab(i) & "<br>" & vbcrlf
    Next
paragraphe = Replace(paragraphe,"&#8218;","é")
paragraphe = Replace(paragraphe,"ÿ"," ")
paragraphe = Replace(paragraphe,"&#710;","ê")
paragraphe = Replace(paragraphe,"&#8225;","ç")
paragraphe = Replace(paragraphe,"&#8220;","ô")
paragraphe = Replace(paragraphe,"&#8230;","à")
paragraphe = Replace(paragraphe,"Š","è")
paragraphe = Replace(paragraphe,"&#402;","â")
paragraphe = Replace(paragraphe,"&#1746;"," ")
LoadFile = paragraphe
End Function

Function TempFile()
Set Ws = CreateObject("WScript.Shell")
TempFile = Ws.ExpandEnvironmentStrings("%TEMP%")&"\out.txt"
End Function
</script>
<body text="white">
<center><FONT SIZE="3"><B><I>Quelques exemples de Commandes</I></B></FONT><BR>
<select style="background-color:Black" size="7" name="DropDown">
<option disabled>Microsoft Windows [version 7.1 7631] Copyright Simulation Dos © Hackoo 2013</option>
<option disabled>C:\>_</option>
<option value="Netstat">Netstat</option>
<option value="CD %Programfiles%\Mozilla Firefox\ | Start Firefox.exe">CD %Programfiles%\Mozilla Firefox\ | Start Firefox.exe</option>
<option value="Tracert www.google.fr">Tracert www.google.fr</option>
<option value="Start iexplore">Start iexplore</option>
<option value="Start Notepad">Start Notepad</option>
<option value="Start Winword">Start Winword</option>
<option value="Explorer.exe /n,/e,/root,C:\Program Files">Explorer.exe /n,/e,/root,C:\Program Files</option>
<option value="Ipconfig">IpConfig</option>
<option value="Dir">Dir</option>
<option value="Ping www.yahoo.fr">Ping www.yahoo.fr</option>
<option value="Ping www.google.fr">Ping www.google.fr</option>
</select><br>
<input type="button" onClick="RunDos DropDown.value,TempFile" value="Exécuter l'exemple">
<br>
<B><I>Tapez une Commande : </I></B><input type="text" id="montext" Value="help" size="30"><br><input type="Submit" value="Exécuter la Commande" onclick="RunDos montext.value,TempFile"></center>
<Div id="myDiv"></Div>
</body>
</html>

Conclusion :


Vos Commentaires et vos suggestions sont les Bienvenues !

Codes Sources

A voir également