Page 1 of 1

Sort/Select Password Protected Archive Files Only

Posted: 14 Jul 2019 03:06
by te7
Hi,

Is there a way to sort password-protected zip/rar/7z/etc. files into password protected and unprotected?

Also/instead, is there a way to test multiple passwords on one file and only extract it if a password is correct?

Thanks in advance!

Re: Sort/Select Password Protected Archive Files Only

Posted: 14 Jul 2019 09:03
by highend
1. Use a custom column with a script like:

Code: Select all

    $extract = "D:\Tools\7-Zip\7z.exe";
    $result = runret("""$extract"" t -pNOPASSWORD ""<cc_item>""");
    if (regexmatches($result, "wrong password")) { return 1; }
    else { return 0; }
cc.png
Ofc you need to install 7zip first and adapt the path to it in the script!

2. Use a script or an extraction utility that can use a password list on its own...
E.g.:

Code: Select all

    $extract = "D:\Tools\7-Zip\7z.exe";
    $extractable = false;
    foreach($password, $passwords, <crlf>, "e") {
        $result = runret("""$extract"" t -p""$password"" ""<curitem>""");
        if (regexmatches($result, "everything is ok")) {
            // Some command to extract the current file...
            $extractable = true;
            break;
        }
    }
    if (!$extractable) { status "No password matched, aborted!", "8B4513", "stop"; }