ib / xarchiver

(continuation of the Xfce master branch)
GNU General Public License v2.0
164 stars 40 forks source link

prefer 7z over unzip #29

Closed slavkoja closed 6 years ago

slavkoja commented 7 years ago

I recently got AES encrypted ZIP archive, and with the xarchiver 0.5.4.10 i got:

skipping: XYZ.pdf  need PK compat. v5.1 (can do v4.6)

The same result i got with unzip, but i have no problem to extract it with 7z. I don't know how it is handled by xarchiver, but i cannot find any configuration option for this. AFAIK unzip is not AES capable...

ib commented 7 years ago

Unzip/zip will remain the default for zip archives, but if it's possible to recognize these type of zip archives, it might be possible to switch to 7z for these.

Is it possible to get a sample?

slavkoja commented 7 years ago

For me it seems as reasonable solution.

I am sorry, i cannot provide original ZIP, it is from my bank with private info. After quick Internet research I generated ZIP sample archive via 7z with (the 123456 is password):

echo Hello world > test.txt
7z a test.zip test.txt -tzip -mem=AES256 -mx9 -p123456

On both files now file returns (but i really don't know if it is the same format):

Zip archive data, at least v5.1 to extract

Running unzip on it provides the same result as with original:

unzip test.zip 
Archive:  test.zip
   skipping: test.txt                need PK compat. v5.1 (can do v4.6)

Can you generate own one or i have to attach it?

ib commented 7 years ago

Thanks, this information is sufficient.

I know now how to recognize compatibility issues with unzip. So if unzip isn't capable, an alternative (7z, unar) could be used instead. (I just have no idea yet how to program it.)

slavkoja commented 7 years ago

I don't know if this help you (i am not programmer), but see the version line:

7z l -slt test.zip | grep -E "^Method|^Version"
Method = AES-256 Store
Version = 51

IMO, there must be the way, to get this info outside of terminal. Another help can be unzip's return value. For this archive it returns 81 and manpage tells:

81     testing or extraction of one or more files failed due to unsupported compression methods or unsupported decryption.

Then, if unzip returns 81, you can try 7z...

ib commented 7 years ago

IMO, there must be the way, to get this info outside of terminal.

The problem is not about getting the info, it's about processing the information during the flow of execution.

Tabby commented 7 years ago

Thanks for making this change, but I've just built and tried 0.5.4.12 and the "Enter password" menu entry is greyed out and disabled after deselecting unzip as the default zip file handler. The same is true of the password entry box in the extraction dialog. As a result, it's still not possible to extract an AES encrypted zip file using xarchiver.

ib commented 7 years ago

Your AES encrypted zip file is password protected?

Tabby commented 7 years ago

Yup. The "Hello world" example created following @slavkoja's steps above is also password protected. Should just need the password boxes enabling and use of the "-p" parameter of 7z, I'd imagine

slavkoja commented 7 years ago

I can confirm, that it doesn't work.

When i have checked the "prefer unzip...", the file is marked with the key icon (on the left), and when i try to extract it, i am asked for password (it fails of course).

But when i uncheck the "prefer unzip..." (and close/open xarchiver), the file is not more marked by key icon and when i try to unpack it, i am not asked for password. It fails too, with:

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=sk_SK.utf8,Utf16=on,HugeFiles=on,64 bits,6 CPUs AMD FX(tm)-6100 Six-Core Processor              (600F12),ASM,AES-NI)

Scanning the drive for archives:
1 file, 29825 bytes (30 KiB)

Extracting archive: /home/myhome/tmp/4022418342_20170930_9_MSKB.zip
--
Path = /home/myhome/tmp/4022418342_20170930_9_MSKB.zip
Type = zip
Physical Size = 29825

ERROR: Wrong password : 4022418342_20170930_9_MSKB.pdf
Enter password (will not be echoed):
Sub items Errors: 1

Archives with Errors: 1

Sub items Errors: 1

Edit: The "Enter password" menu entry is grayed in both cases.

ib commented 6 years ago

Should work now.