From b640481ab1f7b7416325852210b9bbbb1ede45a8 Mon Sep 17 00:00:00 2001 From: Albirew Date: Wed, 12 Jun 2024 19:45:10 +0200 Subject: [PATCH] refreshed old windows scripts collection --- .../{chiffrer-PDF.bat => PDF-chiffrer.bat} | 5 +-- windows/PDF-dechiffrer.bat | 22 ++++++++++++ windows/PDF-dechiffrer2.bat | 23 ++++++++++++ windows/WebDavVista+.bat | 11 ------ windows/capture-error-winload.bat | 8 +++-- windows/htaccess.bat | 5 +-- windows/remove_GWX.bat | 2 ++ windows/wannaPatch.bat | 6 ++-- windows/webDavOnVista+.bat | 36 +++++++++++++++++++ 9 files changed, 97 insertions(+), 21 deletions(-) rename windows/{chiffrer-PDF.bat => PDF-chiffrer.bat} (82%) create mode 100644 windows/PDF-dechiffrer.bat create mode 100644 windows/PDF-dechiffrer2.bat delete mode 100644 windows/WebDavVista+.bat create mode 100644 windows/webDavOnVista+.bat diff --git a/windows/chiffrer-PDF.bat b/windows/PDF-chiffrer.bat similarity index 82% rename from windows/chiffrer-PDF.bat rename to windows/PDF-chiffrer.bat index a65489e..3163f14 100644 --- a/windows/chiffrer-PDF.bat +++ b/windows/PDF-chiffrer.bat @@ -7,11 +7,12 @@ set pdftk=%~dp0 :: ensuite, votre mot de passe pour chiffrer votre PDF -set pwd=Putain de mot de passe en or massif 24 carats serti de diamants! +set "passwd=Putain de mot de passe en or massif 24 carats serti de diamants!" if not exist "%pdftk%\pdftk.exe" echo pdftk.exe not found. exiting... & echo. & pause & exit 1 if [%1]==[] goto noarg -"%pdftk%\pdftk.exe" %1 cat output "%~dpn1-prot.pdf" encrypt_128bit owner_pw "%pwd%" allow Printing CopyContents +"%pdftk%\pdftk.exe" %1 cat output "%~dpn1-prot.pdf" encrypt_128bit owner_pw "%passwd%" allow Printing CopyContents +if errorlevel 1 pause exit :noarg diff --git a/windows/PDF-dechiffrer.bat b/windows/PDF-dechiffrer.bat new file mode 100644 index 0000000..6daf921 --- /dev/null +++ b/windows/PDF-dechiffrer.bat @@ -0,0 +1,22 @@ +@echo off +:: permet de chiffrer un fichier pdf avec pdftk simplement en lachant le fichier pdf sur ce bat. +:: vous aurez besoin de pdftk: http://www.accesspdf.com/pdftk/ +:: utile pour faire chier les administrations en bloquant le copier-coller et en permettant que l'impression + +:: si vous voulez placer ce fichier en dehors du dossier de pdftk, veuillez remplacer %~dp0 dans la ligne suivante +set pdftk=%~dp0 + +:: mettez ici votre mot de passe pour déchiffrer votre PDF +set "passwd=Putain de mot de passe en or massif 24 carats serti de diamants!" + +if not exist "%pdftk%\pdftk.exe" echo pdftk.exe not found. exiting... & echo. & pause & exit 1 +if [%1]==[] goto noarg +"%pdftk%\pdftk.exe" %1 input_pw "%passwd%" cat output "%~dpn1-unprot.pdf" +if errorlevel 1 pause +exit + +:noarg +echo Usage: %~nx0 "file to unprotect.pdf" +echo. +pause +exit \ No newline at end of file diff --git a/windows/PDF-dechiffrer2.bat b/windows/PDF-dechiffrer2.bat new file mode 100644 index 0000000..6772ce1 --- /dev/null +++ b/windows/PDF-dechiffrer2.bat @@ -0,0 +1,23 @@ +@echo off +:: permet de déchiffrer un fichier pdf avec qpdf simplement en lachant le fichier pdf sur ce bat. +:: vous aurez besoin de qpdf: https://github.com/qpdf/qpdf +:: utile pour stocker les PDF des administrations qui les protègent avec un mot de passe + +:: si vous voulez placer ce fichier en dehors du dossier de pdftk, veuillez remplacer %~dp0 dans la ligne suivante +set qpdf=%~dp0\qpdf\bin + +:: mettez ici votre mot de passe pour déchiffrer votre PDF +set "passwd=Putain de mot de passe en or massif 24 carats serti de diamants!" + +set qpdf=%~dp0\bin +if [%1]==[] goto noarg +if [%2] neq [] (set passwd=%2) +"%qpdf%\qpdf.exe" --password=%passwd% --decrypt %1 "%~dpn1-unprot.pdf" +if errorlevel 1 pause +exit + +:noarg +echo Usage: %~nx0 "protected file.pdf" "password" +echo. +pause +exit \ No newline at end of file diff --git a/windows/WebDavVista+.bat b/windows/WebDavVista+.bat deleted file mode 100644 index ba40d8a..0000000 --- a/windows/WebDavVista+.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -:: Allow Windows explorer on Vista and up to use basic auth -echo Windows Registry Editor Version 5.00 >"%Temp%\WebDavBasicAuthLevel.reg" -echo. >>"%Temp%\WebDavBasicAuthLevel.reg" -echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters] >>"%Temp%\WebDavBasicAuthLevel.reg" -echo "BasicAuthLevel"=dword:00000002 >>"%Temp%\WebDavBasicAuthLevel.reg" -"%windir%\regedit.exe" /s "%Temp%\WebDavBasicAuthLevel.reg" -net stop webclient -del "%temp%\WebDavBasicAuthLevel.reg" -net start webclient -echo Over, Have a nice Dav. \ No newline at end of file diff --git a/windows/capture-error-winload.bat b/windows/capture-error-winload.bat index 817ccac..b8ac942 100644 --- a/windows/capture-error-winload.bat +++ b/windows/capture-error-winload.bat @@ -1,9 +1,9 @@ @echo off :: script to use when capture image capture shows error 0xc000000f (failed to start winload.*) under 2012r2 :: https://gist.github.com/Albirew/ff86c4871b252acf6d7b5c298283859c -echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» -echo º Bypass error 0xc000000f on capture.wim (failed to start winload.*) º -echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ +echo ###################################################################### +echo # Bypass error 0xc000000f on capture.wim (failed to start winload.*) # +echo ###################################################################### echo. if [%1]==[] goto noarg :: UAC privilege escalation @@ -40,8 +40,10 @@ echo OK! exit :noarg +echo. echo Usage: drop on this .bat file the capture.wim file to fix. echo Or use the command line: %~nx0 X:\path\to\capture.wim echo Default is C:\RemoteInstall\Boot\x64\Images\ +echo. pause exit \ No newline at end of file diff --git a/windows/htaccess.bat b/windows/htaccess.bat index 0728fac..30fd13a 100644 --- a/windows/htaccess.bat +++ b/windows/htaccess.bat @@ -1,10 +1,11 @@ @echo off -:: rename file in .htaccess in widows (cuz microsoft is a dick that don't allow filename starting with a dot) +:: rename file in .htaccess in windows +:: (cuz before windows 8 or 10, microsoft was a dick that don't allowed filename starting with a dot) if [%1]==[] goto noarg ren %1 .htaccess exit :noarg -echo rename input file into .htaccess +echo rename any input file into .htaccess echo Usage: htaccess.bat "truc.txt" pause exit \ No newline at end of file diff --git a/windows/remove_GWX.bat b/windows/remove_GWX.bat index 9263db9..3a0391d 100644 --- a/windows/remove_GWX.bat +++ b/windows/remove_GWX.bat @@ -1,4 +1,5 @@ @echo off +:: This script allowed to remove the whole "Get Windows 10" annoyances on Windows7 :: Writed by CynerOne, updated and commented by Albirew :: CynerOne original located here: http://lecrabeinfo.net/desinstaller-lapplication-obtenir-windows-10-supprimer-icone-windows-10.html#comment-2374542969 :: also added rev.18 of Matt's privilege escalation script: http://stackoverflow.com/posts/12264592/revisions @@ -9,6 +10,7 @@ :: V6 modified error check to make it not stop when non fatal error occur and added script to automatically hide nasty updates on Windows Update ( https://gist.github.com/neckcen/f099eda0b1cde283cdc9 ) :: V7 added WGA update and fixed lack of escaping characters :: V8 added KB3173040 +:: V9 added script description :: before anything, let's specify what "yes" is interpreted in your language (for takeown) for /F "tokens=3 delims= " %%G in ('reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage') do ( diff --git a/windows/wannaPatch.bat b/windows/wannaPatch.bat index 5f19974..dfc91ee 100644 --- a/windows/wannaPatch.bat +++ b/windows/wannaPatch.bat @@ -27,9 +27,9 @@ setlocal & pushd . cd /d %~dp0 :: /UAC privilege escalation -echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» -echo º SMBv1 patch against malwares like WannaCry ou notPetya / Petwrap º -echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ +echo #################################################################### +echo # SMBv1 patch against malwares like WannaCry ou notPetya / Petwrap # +echo #################################################################### echo. :: deactivate SMBv1 on SMB server reg add "HKLM\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" /v SMB1 /t REG_DWORD /d 0 /f diff --git a/windows/webDavOnVista+.bat b/windows/webDavOnVista+.bat new file mode 100644 index 0000000..b8c2de0 --- /dev/null +++ b/windows/webDavOnVista+.bat @@ -0,0 +1,36 @@ +@echo off +echo Allow Windows explorer on Vista and up to use basic auth +echo. +echo. +echo. + +:: UAC privilege escalation +:checkPrivileges +NET FILE 1>NUL 2>NUL +if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) +echo. +echo Invoking UAC for Privilege Escalation +setlocal DisableDelayedExpansion +set "batchPath=%~0" +setlocal EnableDelayedExpansion +echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" +echo args = "ELEV " >> "%temp%\OEgetPrivileges.vbs" +echo For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs" +echo args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs" +echo Next >> "%temp%\OEgetPrivileges.vbs" +echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" +"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %* +exit /B +:gotPrivileges +if '%1'=='ELEV' shift /1 +setlocal & pushd . +cd /d %~dp0 +:: /UAC privilege escalation + +net stop webclient +reg add "HKLM\SYSTEM\CurrentControlSet\services\WebClient\Parameters" /f /v BasicAuthLevel /t REG_DWORD /d 2 +net start webclient +echo Done, Have a nice Day. +pause \ No newline at end of file