Sort/Select Password Protected Archive Files Only

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
te7
Posts: 1
Joined: 14 Jul 2019 03:02

Sort/Select Password Protected Archive Files Only

Post 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!

highend
Posts: 13330
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Sort/Select Password Protected Archive Files Only

Post 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
cc.png (9.9 KiB) Viewed 390 times
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"; }
One of my scripts helped you out? Please donate via Paypal

Post Reply