Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & title Folder Locker & pushd "%~dp0" & color 0a
- ::****************************************************************
- openfiles >nul 2>&1 & if %errorlevel% EQU 1 (
- setlocal disableDelayedExpansion & color 4f
- echo Running Admin Shell, Please wait.... & ping localhost -n 1 >nul
- set "bPath=%~f0" & setlocal enableDelayedExpansion
- echo Dim UAC : Set UAC = CreateObject^("Shell.Application"^) >Elevate.vbs
- echo For Each strArg in Wscript.Arguments >>Elevate.vbs
- echo args = args ^& strArg ^& " " >>Elevate.vbs
- echo Next >>Elevate.vbs
- echo UAC.ShellExecute "!bPath!",args,"","runas",1 >>Elevate.vbs
- echo Set objShell = Nothing >>Elevate.vbs
- cscript //nologo Elevate.vbs & del Elevate.vbs & exit /b
- )
- ::****************************************************************
- if not exist "%userprofile%\desktop\%~n0.lnk" (
- (
- echo Call Shortcut("%~f0","Folder Locker"^)
- echo Sub Shortcut(Application,Name^)
- echo Dim objShell,DesktopPath,objShortCut,MyTab
- echo Set objShell = CreateObject("WScript.Shell"^)
- echo MyTab = Split(Application,"\"^)
- echo If Name = "" Then
- echo Name = MyTab(UBound(MyTab^)^)
- echo End if
- echo DesktopPath = objShell.SpecialFolders("Desktop"^)
- echo Set objShortCut = objShell.CreateShortcut(DesktopPath ^& "\" ^& Name ^& ".lnk"^)
- echo objShortCut.TargetPath = Chr(34^) ^& Application ^& Chr(34^)
- echo ObjShortCut.IconLocation = "shell32.dll,47"
- echo objShortCut.Save
- echo End Sub
- ) >>crshort.vbs
- cscript //nologo crshort.vbs & del crshort.vbs
- )
- ::**************************************************************
- mode 160,40
- if not exist "%userprofile%\id.spfile" goto first_lock
- goto :Unlocker_Password
- :first_lock
- cls & echo. & echo.
- echo #########################################
- echo Welcome to Folder Locker
- echo #########################################
- echo.
- echo No Private Folder was found, a folder is needed to be created
- echo.
- Call :InputPassword "Create a strong password for the locker"
- ::**************************************************************
- cls & echo. & echo.
- echo Please choose a folder where to create the locker, a dialog box will come:
- Call :ChooseFolder "%Userprofile%\Desktop" "Choose the folder where the hidden folder locker will be created, preffereably choose an unpredictable secure location, though it will be completely hidden"
- cls
- ::**************************************************************
- echo #########################################################################
- echo Creating the private folder, please wait.....
- echo #########################################################################
- echo.
- type nul >"%userprofile%\id.spfile"
- md "%folder%\SecretLocker" & md "%AppData%\Wasif"
- echo %password% >"%AppData%\Wasif\pwd.spfile"
- echo %folder% >"%AppData%\Wasif\folder.spfile"
- call :LockFolder "%AppData%" "Wasif"
- call :LockFolder "%folder%" "SecretLocker"
- ping localhost -n 2 -w 1000 >nul 2>&1
- ::*************************************************************
- cls
- echo Creation of the private folder was done
- echo To work with the folder, re-launch this (%~nx0) batch file
- echo Then input the password again and options will come
- echo.
- pause >nul | echo Press any key to quit.....
- exit /b 0
- ::***********************************************************
- :Unlocker_Password
- ::***********************************************************
- cls & echo. & echo.
- Call :InputPassword "Enter your password"
- Call :UnlockFolder "%Appdata%" "Wasif" False
- set /p actpassword=<"%Appdata%\Wasif\pwd.spfile"
- if %actpassword%==%password% (goto :Unlocker_Menu)
- goto :Bad_Password
- ::***********************************************************
- :Bad_Password
- color 0c & cls
- echo Bad password entered
- pause >nul | echo Press any key to quit.....
- Call :LockFolder "%Appdata%" "Wasif"
- exit /b 0
- ::***********************************************************
- :Unlocker_Menu
- cls & color 0a & echo. & echo.
- for /f "tokens=* delims= " %%a in ('type "%Appdata%\Wasif\folder.spfile"') do set "folder=%%a"
- echo ###################################
- echo Folder Locker Menu
- echo ###################################
- echo Private folder is in: %folder:~0,-1%
- echo.
- echo [1] Unlock Private folder
- echo [2] Unlock Private folder and open in explorer
- echo [3] Change password
- echo [4] Delete Private folder
- echo [5] Lock and Quit (Recommended you quit from here)
- choice /c 12345 /n
- goto %errorlevel%
- ::***********************************************************
- :1
- Call :UnlockFolder "%folder:~0,-1%" "SecretLocker" False
- cls & echo Unlocked!
- pause & Goto :Unlocker_Menu
- ::***********************************************************
- :2
- Call :UnlockFolder "%folder:~0,-1%" "SecretLocker" True
- cls & echo Unlocked!
- pause & Goto :Unlocker_Menu
- ::***********************************************************
- :3
- Call :InputPassword "Enter new password"
- echo %password% >"%Appdata%\Wasif\pwd.spfile"
- cls & echo Changed password!
- pause & goto :Unlocker_Menu
- ::***********************************************************
- :4
- Call :Unlock_Folder "%folder:~0,-1%" "SecretLocker" False
- rd /s /q "%folder:~0,-1%\SecretLocker"
- rd /s /q "%Appdata%\Wasif"
- del /f /q "%userprofile%\id.spfile"
- cls & echo Deletion was successful!
- pause >nul | echo Press any key to quit...
- exit /b 0
- ::***********************************************************
- :5
- Call :LockFolder "%Appdata%" "Wasif"
- Call :LockFolder "%folder:~0,-1%" "SecretLocker"
- exit /b 0
- ::***********************************************************
- :: Functions
- ::************************************************************
- :ChooseFolder <StrInitialFolderPath> <StrDescription>
- for /f "usebackq tokens=* delims=" %%a in (`powershell -Command "& {Add-Type -AssemblyName System.windows.forms;$f=New-Object System.Windows.Forms.FolderBrowserDialog;$f.SelectedPath='%~1';$f.Description='%~2';$f.ShowDialog();$f.SelectedPath}"`) do set "folder=%%a"
- exit /b 0
- ::************************************************************
- :LockFolder <StrParentFolderPath> <StrFolderName>
- set "alias=AnonymousHacker.{2227A280-3AEA-1069-A2DE-08002B30309D}"
- ren "%~1\%~2" "%alias%" >nul 2>&1 & attrib +r +s +h "%~1\%alias%" >nul 2>&1
- icacls "%~1\%alias%" /deny Users:F >nul 2>&1 & exit /b 0
- ::************************************************************
- :UnlockFolder <StrParentFolderPath> <StrOldFolderName> <BoolOpenInExplorer>
- set "alias=AnonymousHacker.{2227A280-3AEA-1069-A2DE-08002B30309D}"
- icacls "%~1\%alias%" /grant Users:F >nul 2>&1 & attrib -r -s -h "%~1\%alias%" >nul 2>&1
- ren "%~1\%alias%" "%~2" >nul 2>&1 & if '%~3'=='True' (explorer "%~1\%~2")
- exit /b 0
- ::************************************************************
- :InputPassword <StrPrompt>
- for /f "tokens=* delims=" %%a in ('powershell -command "& {$Password=read-host '%~1' -AsSecureString;$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password);[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)}"') do set "password=%%a"
- exit /b 0
- ::************************************************************@echo off & title Folder Locker & pushd "%~dp0" & color 0a
- ::****************************************************************
- openfiles >nul 2>&1 & if %errorlevel% EQU 1 (
- setlocal disableDelayedExpansion & color 4f
- echo Running Admin Shell, Please wait.... & ping localhost -n 1 >nul
- set "bPath=%~f0" & setlocal enableDelayedExpansion
- echo Dim UAC : Set UAC = CreateObject^("Shell.Application"^) >Elevate.vbs
- echo For Each strArg in Wscript.Arguments >>Elevate.vbs
- echo args = args ^& strArg ^& " " >>Elevate.vbs
- echo Next >>Elevate.vbs
- echo UAC.ShellExecute "!bPath!",args,"","runas",1 >>Elevate.vbs
- echo Set objShell = Nothing >>Elevate.vbs
- cscript //nologo Elevate.vbs & del Elevate.vbs & exit /b
- )
- ::****************************************************************
- if not exist "%userprofile%\desktop\%~n0.lnk" (
- (
- echo Call Shortcut("%~f0","Folder Locker"^)
- echo Sub Shortcut(Application,Name^)
- echo Dim objShell,DesktopPath,objShortCut,MyTab
- echo Set objShell = CreateObject("WScript.Shell"^)
- echo MyTab = Split(Application,"\"^)
- echo If Name = "" Then
- echo Name = MyTab(UBound(MyTab^)^)
- echo End if
- echo DesktopPath = objShell.SpecialFolders("Desktop"^)
- echo Set objShortCut = objShell.CreateShortcut(DesktopPath ^& "\" ^& Name ^& ".lnk"^)
- echo objShortCut.TargetPath = Chr(34^) ^& Application ^& Chr(34^)
- echo ObjShortCut.IconLocation = "shell32.dll,47"
- echo objShortCut.Save
- echo End Sub
- ) >>crshort.vbs
- cscript //nologo crshort.vbs & del crshort.vbs
- )
- ::**************************************************************
- mode 160,40
- if not exist "%userprofile%\id.spfile" goto first_lock
- goto :Unlocker_Password
- :first_lock
- cls & echo. & echo.
- echo #########################################
- echo Welcome to Folder Locker
- echo #########################################
- echo.
- echo No Private Folder was found, a folder is needed to be created
- echo.
- Call :InputPassword "Create a strong password for the locker"
- ::**************************************************************
- cls & echo. & echo.
- echo Please choose a folder where to create the locker, a dialog box will come:
- Call :ChooseFolder "%Userprofile%\Desktop" "Choose the folder where the hidden folder locker will be created, preffereably choose an unpredictable secure location, though it will be completely hidden"
- cls
- ::**************************************************************
- echo #########################################################################
- echo Creating the private folder, please wait.....
- echo #########################################################################
- echo.
- type nul >"%userprofile%\id.spfile"
- md "%folder%\SecretLocker" & md "%AppData%\Wasif"
- echo %password% >"%AppData%\Wasif\pwd.spfile"
- echo %folder% >"%AppData%\Wasif\folder.spfile"
- call :LockFolder "%AppData%" "Wasif"
- call :LockFolder "%folder%" "SecretLocker"
- ping localhost -n 2 -w 1000 >nul 2>&1
- ::*************************************************************
- cls
- echo Creation of the private folder was done
- echo To work with the folder, re-launch this (%~nx0) batch file
- echo Then input the password again and options will come
- echo.
- pause >nul | echo Press any key to quit.....
- exit /b 0
- ::***********************************************************
- :Unlocker_Password
- ::***********************************************************
- cls & echo. & echo.
- Call :InputPassword "Enter your password"
- Call :UnlockFolder "%Appdata%" "Wasif" False
- set /p actpassword=<"%Appdata%\Wasif\pwd.spfile"
- if %actpassword%==%password% (goto :Unlocker_Menu)
- goto :Bad_Password
- ::***********************************************************
- :Bad_Password
- color 0c & cls
- echo Bad password entered
- pause >nul | echo Press any key to quit.....
- Call :LockFolder "%Appdata%" "Wasif"
- exit /b 0
- ::***********************************************************
- :Unlocker_Menu
- cls & color 0a & echo. & echo.
- for /f "tokens=* delims= " %%a in ('type "%Appdata%\Wasif\folder.spfile"') do set "folder=%%a"
- echo ###################################
- echo Folder Locker Menu
- echo ###################################
- echo Private folder is in: %folder:~0,-1%
- echo.
- echo [1] Unlock Private folder
- echo [2] Unlock Private folder and open in explorer
- echo [3] Change password
- echo [4] Delete Private folder
- echo [5] Lock and Quit (Recommended you quit from here)
- choice /c 12345 /n
- goto %errorlevel%
- ::***********************************************************
- :1
- Call :UnlockFolder "%folder:~0,-1%" "SecretLocker" False
- cls & echo Unlocked!
- pause & Goto :Unlocker_Menu
- ::***********************************************************
- :2
- Call :UnlockFolder "%folder:~0,-1%" "SecretLocker" True
- cls & echo Unlocked!
- pause & Goto :Unlocker_Menu
- ::***********************************************************
- :3
- Call :InputPassword "Enter new password"
- echo %password% >"%Appdata%\Wasif\pwd.spfile"
- cls & echo Changed password!
- pause & goto :Unlocker_Menu
- ::***********************************************************
- :4
- Call :Unlock_Folder "%folder:~0,-1%" "SecretLocker" False
- rd /s /q "%folder:~0,-1%\SecretLocker"
- rd /s /q "%Appdata%\Wasif"
- del /f /q "%userprofile%\id.spfile"
- cls & echo Deletion was successful!
- pause >nul | echo Press any key to quit...
- exit /b 0
- ::***********************************************************
- :5
- Call :LockFolder "%Appdata%" "Wasif"
- Call :LockFolder "%folder:~0,-1%" "SecretLocker"
- exit /b 0
- ::***********************************************************
- :: Functions
- ::************************************************************
- :ChooseFolder <StrInitialFolderPath> <StrDescription>
- for /f "usebackq tokens=* delims=" %%a in (`powershell -Command "& {Add-Type -AssemblyName System.windows.forms;$f=New-Object System.Windows.Forms.FolderBrowserDialog;$f.SelectedPath='%~1';$f.Description='%~2';$f.ShowDialog();$f.SelectedPath}"`) do set "folder=%%a"
- exit /b 0
- ::************************************************************
- :LockFolder <StrParentFolderPath> <StrFolderName>
- set "alias=AnonymousHacker.{2227A280-3AEA-1069-A2DE-08002B30309D}"
- ren "%~1\%~2" "%alias%" >nul 2>&1 & attrib +r +s +h "%~1\%alias%" >nul 2>&1
- icacls "%~1\%alias%" /deny Users:F >nul 2>&1 & exit /b 0
- ::************************************************************
- :UnlockFolder <StrParentFolderPath> <StrOldFolderName> <BoolOpenInExplorer>
- set "alias=AnonymousHacker.{2227A280-3AEA-1069-A2DE-08002B30309D}"
- icacls "%~1\%alias%" /grant Users:F >nul 2>&1 & attrib -r -s -h "%~1\%alias%" >nul 2>&1
- ren "%~1\%alias%" "%~2" >nul 2>&1 & if '%~3'=='True' (explorer "%~1\%~2")
- exit /b 0
- ::************************************************************
- :InputPassword <StrPrompt>
- for /f "tokens=* delims=" %%a in ('powershell -command "& {$Password=read-host '%~1' -AsSecureString;$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password);[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)}"') do set "password=%%a"
- exit /b 0
- ::************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement