Kali linux zip file

Как распаковать ZIP в Linux

В операционной системе Windows формат архивов ZIP считается чуть ли не стандартным, он даже поддерживается в этой операционной системе, что называется «из коробки». Если вы только перешли с Windows, то у вас, наверное, есть много таких архивов с различными файлами, также ZIP-архивы могут часто попадаться на просторах интернета. Поэтому работать с такими файлами в Linux вам однозначно придётся.

В этой небольшой статье мы рассмотрим, как распаковать ZIP Linux. Разберём несколько способов и воспользуемся несколькими утилитами, которые справятся с этой задачей.

Распаковка ZIP Linux

Формат ZIP был создан в 1989 году на замену очень медленному формату ARC. Здесь используется сжатие deflate, и на то время оно работало намного быстрее чем ARC. Исторически сложилось так, что стандартным форматом для Linux стали TAR и GZ — это усовершенствованные алгоритмы сжатия и архивации. Многие графические распаковки воспринимают и ZIP-файлы. Но они обрабатывают архивы не сами, а дают команду предназначенным для этого формата утилитам.

Утилита для распаковки ZIP называется unzip, она не всегда установлена по умолчанию. Но вы можете очень просто добавить её в свою систему из официальных репозиториев. Для этого в Ubuntu выполните:

sudo apt install unzip

А в системах, использующих формат пакетов Red Hat, команда будет выглядеть немного по-другому:

sudo yum install unzip zip

После установки большинство графических утилит для работы с архивами смогут распаковать архив ZIP Linux. Команда ZIP Linux установлена на случай, если вы захотите создавать ZIP-архивы.

Но этой утилите не нужны дополнительные оболочки для распаковки архива. Вы можете сделать всё прямо из консоли. Давайте рассмотрим синтаксис утилиты:

$ unzip опции файл_архива.zip файлы -x исключить -d папка

  • файл архива — это тот файл, с которым нам предстоит работать;
  • файлы — здесь вы можете указать файлы, которые нужно извлечь, разделять имена файлов пробелом;
  • исключить — файлы, которые извлекать не нужно;
  • папка — папка, в которую будет распакован архив.

Теперь рассмотрим опции утилиты, поскольку она позволяет не только распаковывать архивы, но и выполнять с ними определённые действия:

  • -l — вывести список файлов в архиве;
  • -t — протестировать файл архива на ошибки;
  • -u — обновить существующие файлы на диске;
  • -z — вывести комментарий к архиву;
  • -c — извлекать файлы на стандартный вывод, перед каждым файлом будет выводиться его имя;
  • -p — то же самое, только имя выводится не будет;
  • -f — извлечь только те файлы, которые уже существуют на диске, и файлы в архиве более новые;
  • -v — вывести всю доступную информацию;
  • -P — указать пароль для расшифровки архива;
  • -n — не перезаписывать существующие файлы;
  • -j — игнорировать структуру архива и распаковать всё в текущую папку;
  • -q — выводить минимум информации.

Все самые основные опции рассмотрели, теперь давайте рассмотрим несколько примеров работы с программой в терминале. Чтобы распаковать ZIP Linux в текущую папку, достаточно набрать:

Причём расширение указывать не обязательно. Протестировать архив можно с помощью опции -t:

unzip -tq имя_файла.zip

Вы можете протестировать все архивы в текущей папке, выполнив:

Если нужно распаковывать архив не в текущую папку, можно очень просто указать нужную:

unzip имя_файла.zip -d /tmp

Также можно распаковывать не весь архив, а только нужные файлы или файлы нужного формата:

unzip имя_файла.zip \*.txt -d /tmp

С помощью опции -l вы можете посмотреть список файлов в архиве:

unzip -l file.zip

Утилиту unzip разобрали и теперь вы с ней точно справитесь. Но я говорил, что мы рассмотрим несколько способов, как выполняется распаковка ZIP Linux. Поэтому дальше мы поговорим об утилите 7z.

Демонстрация работы утилит zip и unzip в терминале:

Как распаковать ZIP Linux с помощью 7z

7z — это кроссплатформенный набор утилит для работы с архивами. Кроме собственного формата, здесь поддерживается большое количество других, в том числе tar и zip. Плюс этой утилиты — в контекстное меню файлового менеджера будет добавлен пункт, с помощью которого вы сможете распаковывать или создавать архивы.

Читайте также:  Compile boost on linux

Для установки утилиты в Ubuntu или Debian выполните:

sudo apt install p7zip-full

А в Red Hat и CentOS:

sudo yum install p7zip

Теперь вы можете использовать контекстное меню вашего файлового менеджера, чтобы распаковать архив ZIP Linux. Также можно использовать программу в консоли. Синтаксис очень похож на unzip:

$ 7z команда опции имя_архива

Команда задаёт нужное действие. Нас будут интересовать только четыре команды:

  • e (Extract) — извлечь файлы из архива;
  • x eXtract — извлечь файлы из архива, сохраняя полный путь;
  • l (List) — список файлов архива;
  • t (Test) — проверить архив.

Теперь рассмотрим самые полезные опции:

  • -o — указать папку для распаковки;
  • -p — указать пароль;
  • -x — не извлекать эти файлы;
  • -w — указать рабочую директорию;
  • -y — отвечать положительно на все вопросы;

Ну и рассмотрим примеры работы с утилитой. Сначала проверим содержимое архива:

Распаковываем архив, сохраняя структуру подкаталогов:

Или распаковываем все файлы в одну папку, игнорируя подкаталоги:

Или вы можете указать папку, в которую нужно распаковать файлы с помощью опции -o:

7z x файл.zip -o /tmp/

Выводы

В этой статье была рассмотрена распаковка ZIP Linux, как видите, это ненамного сложнее, чем распаковка стандартных архивов TAR. Мы рассмотрели два способа ,и теперь вы точно будете знать, что делать, когда столкнетесь с такой ситуацией. Если у вас остались вопросы, спрашивайте в комментариях!

Источник

How To Zip, Unzip Files In Linux?

Winzip, Winrar are popular packaging and compression tools for Windows operating system. Winzip was very popular in old times and this made the zip compression algorithm popular too. Currently, a lot of files and folders are compressed with zip algorithms too. Zip compression is supported by Minix, Atari, MacOS, Android too. We look at how to compress and decompress with the zip algorithm in this post.

Install Zip For Ubuntu, Debian, Mint, Kali

To use zip functionality required packages should be downloaded they are not installed by default. We will install the packages named zip and unzip for deb based distributions.

Install Zip For Fedora, CentOS, RHEL

We can use yum package manager in order to install zip .

zip Command Syntax

zip command uses the following syntax. It accepts multiple files and folders to zip with a single step with.

  • OPTIONS will be used to set some attributes or behavior to the zip command like compressions level etc.
  • ARCHIVE is the name of the compressed file which will be created.
  • INPATH is the files and folders we can compress. There may be more than one INPATH.

Compress A File

We will start with a simple example where we will compress a single file named report.xm and compress it into an archive named report.zip . We can see from the output that the compression level is about 63%.

Compress Multiple Files With Zip

We can compress multiple files with zip command we will add all files and folders at the end of the command as a parameter. In this example will compress files and folders named report.xml, workspace/, example.txt into an archive named backup.zip .

Compress Multiple Files According To Their Extension

We can compress multiple files according to their extension. We will use the glob for bash and provide the extension like txt, png, XML, etc. In this example, we will compress text files with *.txt extension into an archive file named text_backup.zip.

Compress Folders and Directories

Compressing files requires no option to zip command but compressing folders requires a recursive flag to the zip command. In order to compress directories or folders, we have to provide the -r option like below.

Compress File By Searching Them

find command can be used to find for a specific file by searching its name, extension, size, etc. and then we can compress the files or folders with the zip command. In this example, we will search the current working directory for files with txt extension and compress them in their current path.

Decompress or Extract Zip Files

Decompressing is easier than compressing we just provide archive file to unzip command. In this example, we will unzip the compressed file named text_backup.zip. We may be asked the replacement question if the same files exist.

Читайте также:  Windows 9 будет x64

Extract Specific File From Zip Archive

We can decompress a specific file from a zip archive like below. In this example, we will extract files with the rc as an extension.

This will extract only files ends with rc .

Источник

Zydra — ZIP Password Cracker

Zydra is a password recovery tool that can recover passwords from files and Linux shadow files using brute-force or dictionary attack. That means, it can crack passwords of ZIP, RAR and PDF files. Also it can recover passwords of Linux systems using the shadow file (shadow file stores user passwords in Linux system).

Key Features of Zydra

Zydra’s main features are following:

  • The most important features of Zydra is the multiprocessing feature that speeds up the program. For example if we have 8 CPU cores, Zydra will use all of them for processing at the same time.
  • It can be use against Legacy ZIP files, RAR files, PDF files and shadow files.
  • Cracking files password using two methods dictionary method and brute force method.
  • In the brute force method, we can specify the min length and max length of the passwords, also we can specify the type of characters that may be used in the password.
  • A percent progress bar showing how much of the process has been performed.
  • Error handling.

Installing Zydra on Kali Linux

We can found Zydra on it’s GitHub repository but before that we will install some dependencies to work Zydra perfectly.

First of all we update our system by using following command:

Then we download some dependencies by using following command:

The above command will install qpdf and unrar on our system as we can see in the following screenshot:

Then we need to install some Python3 modules using pip.

These will be installed on our system after using above command as we can see it.

Now we just need to download figlet font «epic» for Zydra by using following command:

Now it’s time to download the Zydra from GitHub. Either we can clone the whole repository or we can just download the Python script. Let we download just the Python script by using following command:

The python script will be saved our current working directory by the name of zydra.py.

Now we can run the script. First of all we check the help option by applying following command:

We can see the help menu of Zydra in the following screenshot:

Either we can read the boring help section of Zydra or continue reading out guide to know the important uses of this tool.

How to Crack ZIP files password on Kali Linux

Here we have a ZIP file on our Desktop which is protected by a password. We can see that it prompt for password on the following screenshot:

Now we try to brake the password with dictionary attack. To perform this we need a password list. We will use the 10k-most-common.txt (password list). It comes with our Kali Linux (/usr/share/seclists/Passwords/Common-Credentials/10k-most-common.txt), which contains 10,000 most commonly used passwords.

So we open our terminal and our command will be following:

Here we have used the -f flag to specify the location of the ZIP file (in our case which is /home/kali/Desktop/images.zip ) and using the -d flag we have specify the location of the dictionary (password list). Output shown in the following screenshot:

On the above screenshot we can see that we have successfully cracked the password of the ZIP file using Zydra.

This is how we can use the dictionary attack we also can try without password list. In that case we need to use brute-force attack and we need to specify the type of characters that may be used in the password.

Here we have choose -b flag for brute force attack and specified our password (mixing digits and symbols), then we use -m flag for minimum length of our password (we choose 4) and -x for maximum length of our password (we choose 6).

On the above screenshot we can see that Zydra has created a count of possible password list which is very big (5622834672 passwords). Which will take a lot of time. Also may gives error (but the scan continues).

Читайте также:  Windows 10 нет подходящего разрешения экрана

Note: Zydra can recover legacy ZIP files password (The standard one). We have created a ZIP file on Linux system (using Archive Manager) Zydra can’t break it. But ZIP files created from Windows and internet works perfectly.

How to crack RAR files password using Zydra

Cracking a RAR file’s password is very similar to cracking ZIP file’s password on Zydra. To do it we need to run following command on our terminal:

Then Zydra will start scanning the process. Here we have again choose 10k-most-common.txt password list inside our /usr/share/seclists/Passwords directory which is specified by -d flag and our target RAR file is specified by -f flag located on our Desktop.

After waiting very few moments we got our password, as we can see in the screenshot:

Now we can see on the above screenshot that we have successfully recovered the password of the RAR file.

We also can use bruteforce attack to recover the password. To do that we need to use -b flag in the place of -d flag and we should specify the type of password and length as we did on ZIP files section, an example command is following:

This is how we can Crack RAR file’s password on our Kali Linux system.

How to Break or Crack Password of PDF file

Cracking PDF file’s password is also very similar as ZIP and RAR. We just need to use Zydra and tell Zydra the location of PDF file and the location of password list.

Here we have an example PDF file on our Desktop, which is locked. As we can see in the following screenshot:

Locked PDF file on Desktop

Now we run Zydra and try to break the password of this PDF file by using following command:

Here we have used -f flag to specify our PDF file location and we used -d to specify location of our passsword list. The output of the command shows in the following screenshot:

This is how we can crack the password of a PDF file using Zydra on our Kali Linux system.

Recover Linux passwords from shadow file

Linux’s users password stored (encrypted) on the shadow file,located on /etc/shadow. Using Zydra we also able to crack shadow file’s passwords. Zydra will crack the passwords one by one for every user on the system.

Either we can copy the shadow file from a system or we can run Zydra on the target system. Here for an example we run copied all the texts from shadow file from another system and saved it on our system (Desktop) in a file called shadow without file extension and try recover the password.

To do so we can apply following command on our terminal:

The screenshot shows that Zydra cracked one user and trying for the other

If we need to crack our own system’s password then we need to use our root account (also may need to install rarfile pyfiglet py-term there). The command will be following(we need to log in as root, sudo command from non-root user may show error here):

Conclusion

This is how to crack password protected ZIP, RAR, PDF files using Zydra on Kali Linux or other debian based Linux system. We also can recover password of Linux users using Zydra.

This is created for educational perpose only we also can use it to recover forgotten password of files. But using Zydra against other’s protected file will be considered crime as per law. So please do not use it to others without proper permission. We will not be responsible if anyone did this.

Liked our article then please follow our blog’s email subscription for free. We also have Telegram group to direct conversation with everyone. We also update our new articles on Twitter and GitHub make sure to follow us there.

For any kind of query or problem our comment box is always open to everyone. We read each and every comment and we always reply.

Источник

Оцените статью