1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
| @echo off
Title Gnrer un HTABOX pour cacher un mot de passe en ligne de commande Copyright Hackoo 2014
mode con cols=90 lines=3 & color 9B
Set MyVBSFile=%tmp%\%~n0.vbs
Set MyHTAFile=%tmp%\%~n0.hta
:: Créer le VBS Pour extraire et générer le code du HTA
Call :CreateMyVBS
:: Lancer Le VBS
Cscript.exe //NOLOGO %MyVBSFile%
:: Lancer Le HTA crée par le VBS
start /wait mshta.exe "%MyHTAFile%"
Del "%MyVBSFile%" & Del "%MyHTAFile%"
:: Lire le contenu du fichier %tmp%\userIn pour extraire le mot de passe tapé depuis
:: le HTABOX et le définir comme une variable
for /f %%i in (%tmp%\userIn) do set "Mypassword=%%i"
echo Votre mot de passe saisi est : %MyPassword%
Del %tmp%\userIn
pause
Exit /b
:#Start
<html>
<head>
<title>Mot de Passe © Hackoo</title>
<hta:application id="htaid"
applicationName="Password"
border="thin"
icon="wlrmdr.exe"
borderStyle="normal"
caption="yes"
contextMenu="no"
maximizeButton="no"
minimizeButton="yes"
navigable="yes"
showInTaskbar="yes"
singleInstance="yes"
sysmenu="yes"
SCROLL="NO"
SHOWINTASKBAR="Yes"
SELECTION="no"
MINIMIZEBUTTON="no"
>
</head>
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
<BODY TOPMARGIN="1" LEFTMARGIN="1"><CENTER><DIV><SPAN ID="ONSCR"></SPAN></DIV></CENTER></BODY>
<script language="vbscript">
'---------------------------------------------------------------------------------------
Sub Window_OnLoad
CenterWindow 300,150
Call PasswordForm()
Call Parler("Veuillez entrer votre mot de passe")
Call TextFocus()
end sub
'---------------------------------------------------------------------------------------
Sub CenterWindow(x,y)
Dim iLeft,itop
window.resizeTo x,y
iLeft = window.screen.availWidth/2 - x/2
itop = window.screen.availHeight/2 - y/2
window.moveTo ileft,itop
End Sub
'----------------------------------------------------------------------------------------
Sub SavePassword()
set fs=CreateObject("Scripting.FileSystemObject")
strFile=fs.GetAbsolutePathName(fs.BuildPath(fs.GetSpecialFolder(2),"UserIn"))
set ts=fs.OpenTextFile(strFile,2,True)
If PasswordArea.value <> "" Then
ts.WriteLine PasswordArea.value
ts.Close
self.Close 'Pour fermer ce HTA après avoir enregistré le mot de passe comme une variable dans le fichier Userin
else
Msgbox "Le mot de passe est vide ! "& Vbcrlf & "SVP entrez de nouveau votre mot de passe",VbExclamation,"Mot de Passe © Hackoo"
Location.reload(true) 'Pour recharger à nouveau ce HTA
end if
End Sub
'----------------------------------------------------------------------------------------
Sub PasswordForm()
Self.document.title = "Mot de Passe © Hackoo"
Self.document.bgColor = "lightblue"
ONSCR.InnerHTML="<center><FONT COLOR=""#FFFFFF"" SIZE=""+1"" FACE=""VERDANA,ARIAL,HELVETICA,SANS-SERIF"">Taper votre mot de passe</FONT<br>"_
&"<input type=""password"" name=""PasswordArea"" size=""20"" onKeyUp=""TextFocus""><P"_
&"<input type=""Submit"" STYLE=""HEIGHT:25;WIDTH:110"" value=""OK"" onClick=""SavePassword"">"
END Sub
'----------------------------------------------------------------------------------------
Sub TextFocus
PasswordArea.Focus
End Sub
'----------------------------------------------------------------------------------------
Sub Sleep(MSecs)' Fonction pour faire une pause car wscript.sleep ne marche pas dans un HTA
Set fso = CreateObject("Scripting.FileSystemObject")
Dim tempFolder : Set tempFolder = fso.GetSpecialFolder(2)
Dim tempName : tempName = "Sleeper.vbs"
If Fso.FileExists(tempFolder&"\"&tempName)=False Then
Set objOutputFile = fso.CreateTextFile(tempFolder&"\"&tempName, True)
objOutputFile.Write "wscript.sleep WScript.Arguments(0)"
objOutputFile.Close
End If
CreateObject("WScript.Shell").Run tempFolder&"\"&tempName &" "& MSecs,1,True
End Sub
Sub Parler(Message)
Set Sound = CreateObject("WMPlayer.OCX.7")
Sound.URL = "http://translate.google.com/translate_tts?tl=fr&q=" & Message
Sound.Controls.play
Do while Sound.currentmedia.duration = 0
Sleep 100
loop
Sleep (int(Sound.currentmedia.duration)+1)*1000
End Sub
</script>
</body>
</html>
:#End
::***********************************************************************************************
:CreateMyVBS
::'**********************************************************************************************
(
echo. Set fso = CreateObject^("Scripting.FileSystemObject"^)
echo. Set f=fso.opentextfile^("%~f0",1^)
echo. a=f.readall
echo. Set r=new regexp
echo. r.pattern = "(?:^|(?:\r\n))(?::#Start\r\n)([\s\S]*?)(?:\r\n)(?::#End)"
echo. Set Matches = r.Execute^(a^)
echo. If Matches.Count ^> 0 Then Data = Matches^(0^).SubMatches^(0^)
echo. WriteFileText "%MyHTAFile%",Data
echo. f.close
::'**********************************************************************************************
echo.
echo. Function WriteFileText^(sFile,Data^)
echo. Dim objFSO,oTS,sText
echo. Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
echo. Set oTS = objFSO.CreateTextFile^(sFile,2^)
echo. oTS.WriteLine Data
echo. oTS.close
echo. set oTS = nothing
echo. Set objFSO = nothing
echo. End Function
) > %MyVBSFile%
::'*********************************************************************************************** |
Partager