there is a password-protected zip archive
there is a txt file with a list of passwords
How can I quickly go through this list and unpack the archive?
unpack encrypted file using passwords list
Moderators: Hacker, petermad, Stefan2, white
unpack encrypted file using passwords list
OS: Win10 | TC: latest x64
Re: unpack encrypted file using passwords list
You could use 7-Zip with a CMD file like this:
Code: Select all
@echo off
setlocal enabledelayedexpansion
cls
set archive=%1
set szexe="C:\PathTo\7-Zip24\7z.exe"
set pw_list="C:\PathTo\7-Zip24\passwords.txt"
for /F "usebackq delims=" %%P in (%pw_list%) do (
%szexe% t -p%%P %archive% > nul 2>&1
if !errorlevel! EQU 0 (echo Password: && echo %%P && pause && goto :eof)
)
pause
Re: unpack encrypted file using passwords list
does not work(
will https://www.7-zip.org/a/7zr.exe be enough?
without set will be better... using path
can you make that .txt = archive name? e.g for encryptedarchive.zip searching encryptedarchive.txt in same folder
OS: Win10 | TC: latest x64
Re: unpack encrypted file using passwords list
7zr only supports 7z files, you could use 7za.exe for more formats.KozakMak wrote: 2024-04-18, 10:29 UTC does not work(
will https://www.7-zip.org/a/7zr.exe be enough?
I'm note quite sure what you mean. Do you have the 7-Zip path in your "path" environment variable? Then you could use 7za.exe instead of %szexe%, see "rem" line below.without set will be better... using path
Or do you have the 7za.exe in the same folder as the archives? Then you could use the second "rem" line.
Use this CMD file with parameterscan you make that .txt = archive name? e.g for encryptedarchive.zip searching encryptedarchive.txt in same folder
Code: Select all
%P%N
Code: Select all
@echo off
setlocal enabledelayedexpansion
set archive=%1
set pw_list=%~dpn1.txt
set szexe="c:\PathTo\7za.exe"
for /F "usebackq delims=" %%P in ("%pw_list%") do (
%szexe% l -p%%P %archive% > nul 2>&1
rem or 7za.exe l -p%%P %archive% > nul 2>&1
rem %~dp17za.exe l -p%%P %archive% > nul 2>&1
if !errorlevel! EQU 0 (echo Password: && echo %%P && pause && goto :eof)
)
pause
Code: Select all
setlocal enabledelayedexpansion
set archive=%1
set pw_list=%~dpn1.txt
set szexe="c:\PathTo\7za.exe"
for /F "usebackq delims=" %%P in ("%pw_list%") do (
%szexe% l -p%%P %archive%
rem or 7za.exe l -p%%P %archive%
rem %~dp17za.exe l -p%%P %archive%
if !errorlevel! EQU 0 (echo Password: && echo %%P && pause && goto :eof)
)
pause
Last edited by ZoSTeR on 2024-04-18, 14:54 UTC, edited 1 time in total.