Utility to extract files from images

Installing

Important

First need to do setting up the environment. All commands are executed only from superuser.

Mode superuser:

sudo -i
  1. Install required system packages:

    apt install python3-guestfs
    
  2. Install virt-extract:

    pip3 install virt-extract
    

Note

To install utility on Astra Linux (Smolensk) do following:

  1. Connect the provided repository with AccentOS packages.

  2. Install the package with the command:

    sudo apt install -y aos-virt-extract
    

Utility description

virt-extract is console utility for extracting files from image. Utility allows to save the hierarchy of paths of the extracted files. Functional of utility is need for correct work of module AppLevel.

Utility arguments
Parameter Description
-h, --help Help output. Optional parameter.
-a Path to the image.
-d Instance name (libvirt domain).
file|dir Path to files or directories inside image.
localdir Local directory where files and directories will be extracted.
--ignore-missing Flag to ignore errors about the absence of the specified files inside the image. Optional parameter.
-v Enabling verbose output. Optional parameter.

Examples of using

Extracting files by instance name

Command:

virt-extract -d instance-00000010  /etc/cirros/version /home /tmp/backup

Directory /tmp/backup structure after command execution:

/tmp/backup/
├── etc
│   └── cirros
│       └── version
└── home
    ├── cirros
    │   ├── .profile
    │   ├── .shrc
    │   └── .ssh
    │       └── authorized_keys
    └── ftp

Extracting files indicating the path to the image

Command:

virt-extract -a instance-00000010  /etc/cirros/version /home/cirros /tmp/backup