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 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317
| @echo off
Color 9B
title Protection avec mot de passe ^| Version 1.5 by Hackoo
mode con cols=67 lines=20
Set MyVBSFile=%tmp%\%~n0.vbs
Set MyHTAFile=%tmp%\%~n0.hta
if EXIST "Control Panel.{2227A280-3AEA-1069-A2DE-08002B30309D}" goto saisiePass
if NOT EXIST Baba goto create
reg query ""HKLM\SOFTWARE\Baba"">Nul
if %errorlevel%==1 goto pasdepass
:confirm
echo Voulez-vous verrouiller le dossier Baba ?( O/N )
set /p "choix=>"
if %choix%==O goto ferme
if %choix%==o goto ferme
if %choix%==n goto fin
if %choix%==N goto fin
echo Choix incorrect, veuillez répondre Oui ou Non.
goto confirm
:ferme
cls
Color 9A
ren "%~dp0Baba" "Control Panel.{2227A280-3AEA-1069-A2DE-08002B30309D}"
attrib +h +s "Control Panel.{2227A280-3AEA-1069-A2DE-08002B30309D}"
echo.
echo.
echo.
echo _####_
echo # #
echo # #
echo # #
echo # #
echo ##############
echo # #
echo # #
echo # ## #
echo # #### #
echo # #### #
echo # ## #
echo # ## #
echo ################
echo.
echo. Dossier Baba verouillée
echo.
echo.
goto fin
:SaisiePass
echo.
echo Veuillez saisir le mot de passe du Dossier Baba.
echo.
echo.
echo ####
echo ###
echo ####
echo ##
echo ##
echo ##
echo ##
echo ##
echo ##
echo ## ##
echo ## ##
echo ## ##
echo ##__##
echo ##
Call :CreateMyVBS
Cscript.exe //NOLOGO %MyVBSFile%
start /wait mshta.exe "%MyHTAFile%"
Del "%MyVBSFile%" & Del "%MyHTAFile%"
for /f %%i in (%tmp%\userIn) do set "passout=%%i"
echo.
echo V,rification du mot de passe en cours ....
for /f "tokens=3" %%i in ('reg query ""HKLM\SOFTWARE\Baba"" ^| find "MDP"') do set MDP=%%i
Del %tmp%\userIn
if %passout%==%MDP% goto ouvre
if NOT %passout%==%MDP% goto incorrect
goto fin
:pasdepass
cls
echo Aucun mot de passe n'est défini.
echo Veuillez définir un mot de passe pour le dossier Baba.
echo.
echo.
echo ####
echo ###
echo ####
echo ##
echo ##
echo ##
echo ##
echo ##
echo ##
echo ## ##
echo ## ##
echo ## ##
echo ##__##
echo ##
echo.
Call :CreateMyVBS
Cscript.exe //NOLOGO %MyVBSFile%
start /wait mshta.exe "%MyHTAFile%"
for /f %%i in (%tmp%\userIn) do set "newpass1=%%i"
echo Veuillez confirmer de nouveau votre mot de passe
Call :CreateMyVBS
start /wait mshta.exe "%MyHTAFile%"
for /f %%i in (%tmp%\userIn) do set "newpass2=%%i"
if "%newpass1%"=="%newpass2%" goto AjoutPassReg
if Not "%newpass1%"=="%newpass2%" echo Les Deux mots de passes ne sont pas identiques ?
PING 1.1.1.1 -n 1 -w 1000 >NUL
Del "%MyVBSFile%" & Del "%MyHTAFile%" & Del %tmp%\userIn
goto pasdepass
goto fin
:AjoutPassReg
reg Add ""HKLM\SOFTWARE\Baba"" /v MDP /t REG_SZ /d %newpass2% > NUL
goto ferme
goto fin
:incorrect
cls
Color BC & echo.
echo Mot de passe incorrect ? ? ?
echo.
echo.
echo ####
echo ###
echo ####
echo ##
echo ##
echo ##
echo ##
echo ##
echo ##
echo ## ##
echo ## ##
echo ## ##
echo ##__##
echo ##
Goto ping
:create
md "%~dp0Baba"
echo.
echo.
echo.
echo.
echo #######################################
echo # # #
echo # # #
echo # # Le dossier Baba est cr,e #
echo # # # #
echo # # # #
echo ## #######################################
echo.
echo.
goto CreateShortcut
goto pasdepass
:ouvre
cls
attrib -h -s "%~dp0Control Panel.{2227A280-3AEA-1069-A2DE-08002B30309D}"
ren "Control Panel.{2227A280-3AEA-1069-A2DE-08002B30309D}" Baba
Color 9A
echo.
echo.
echo.
echo.
echo #######################################
echo # # #
echo # # #
echo # # Mot de passe est Correct ! #
echo # # # Le dossier Baba est ouvert ! #
echo # # # #
echo ## #######################################
echo.
echo.
PING 1.1.1.1 -n 1 -w 1000 >NUL
Start Explorer "%~dp0Baba"
exit
:Ping
cls
echo Mot de passe incorrect ? ? ?
PING 1.1.1.1 -n 1 -w 1000 >NUL
goto SaisiePass
:fin
Timeout /NOBREAK /T 5 > Nul
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 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
'----------------------------------------------------------------------------------------
</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%
::'***********************************************************************************************
:CreateShortcut
(
echo Call Shortcut("%~f0","Private"^)
echo ^'**********************************************************************************************^)
echo Sub Shortcut(CheminApplication,Nom^)
echo Dim objShell,DesktopPath,objShortCut,MyTab
echo Set objShell = CreateObject("WScript.Shell"^)
echo MyTab = Split^(CheminApplication,"\"^)
echo If Nom = "" Then
echo Nom = MyTab(UBound^(MyTab^)^)
echo End if
echo DesktopPath = objShell.SpecialFolders("Desktop"^)
echo Set objShortCut = objShell.CreateShortcut(DesktopPath ^& "\" ^& Nom ^& ".lnk"^)
echo objShortCut.TargetPath = Dblquote^(CheminApplication^)
echo objShortCut.WorkingDirectory = "%~dp0"
echo ObjShortCut.IconLocation = "wlrmdr.exe,0"
echo objShortCut.Save
echo End Sub
echo ^'**********************************************************************************************
echo ^'Fonction pour ajouter les doubles quotes dans une variable
echo Function DblQuote(Str^)
echo DblQuote = Chr(34^) ^& Str ^& Chr^(34^)
echo End Function
echo ^'**********************************************************************************************
) > %temp%\Shortcutme.vbs
Start %temp%\Shortcutme.vbs
Timeout /NOBREAK /T 2 > Nul
Del %temp%\Shortcutme.vbs
::****************************************************************************** |
Partager