Ubuntu: Find and search inside encrypted compressed files



Question:

I want to get a list of all contents inside a (ZipCrypto) password protected zip archive inside the terminal.

Also, how can I filter/search specific file types using grep (Can I)?


Solution:1

You can encrypt files, but still leave the file list unencrypted. If thats the case, save the following code, as finda.sh, or any other name as you like:

for file in *.*; do      if ( 7z l -slt "$file"> /tmp/$file.log); then         echo $file:; cat /tmp/$file.log | grep -iE 'Path*'> $file.log && cat $file.log      fi  done  

Save funda.sh In a directory were all of your archives are in, then execute it, and this is the output:

./finda.sh   one.7z:  Path = one/abradabra.png  Path = one/birb.png  three.rar:  Path = three/blah.png  Path = three/qwa0g.jpg  two.zip:  Path = two/whut.png  


Solution:2

I don't think you can do this with encrypted compressed file.

But you can search for compressed files with no password using zgrep

 zgrep 'word-to-search' /path/to/test.gz  

man zgrep

Zgrep invokes grep on compressed or gzipped files. All options speci‐ fied are passed directly to grep.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »