21

From what I've read, an Appimage file is a compressed application along with all of its resources, and when run it is auto-mounted and then executed.

I want to inspect the resources and files inside an Appimage file I've downloaded, without actually running the Appimage.

How can I do this?

Wildcard
  • 1,098
  • 1
  • 17
  • 36
  • I searched for this question before posting and was surprised to find no version of the question at all already posted. So I've kept this one as simple as possible. – Wildcard Apr 26 '20 at 19:58
  • 1
    It appears there isn't currently a reliable way to do this without executing the binary :( The documentation suggests using `mount`, but even that requires you to extract the image offset from the file. Creating an external command that can do the mounting automatically is filed as [bug #830](https://github.com/AppImage/AppImageKit/issues/830) in their bug tracker. – IMSoP Apr 27 '20 at 15:25

2 Answers2

20

Without changing their extension:

As such, an appimage can be mounted or extracted. That is:

To mount them: (which amounts to executing them, something the OP wants to avoid - and for that very reason needs to be aware of - as stated in a comment by @Jasen)

my.AppImage --appimage-mount

The AppImage is unmounted when the application called in the example is interrupted (e.g., by pressing Ctrl+C, closing the terminal etc.).

Note: This is only available for type 2 AppImages. Type 1 AppImages do not provide any self-mounting mechanism. To mount type 1 AppImages, use

mount -o loop

To extract them:

An alternative to mounting the AppImages is to extract their contents. This allows for modifying the contents. The resulting directory is a valid AppDir, and users can create AppImages from them again using appimagetool.

Analog to mounting AppImages, there is a simple commandline switch to extract the contents of type 2 AppImages without external tools. Just call the AppImage with the parameter --appimage-extract. This will cause the runtime to create a new directory called squashfs-root, containing the contents of the AppImage’s AppDir specification.

Type 1 AppImages require the deprecated tool AppImageExtract to extract the contents of an AppImage. It’s very limited functionality wise, and requires a GUI to run. It creates a new directory in the user’s desktop directory.

There is an answer on superuser on how to extract files from an AppImage.

Looking at my appimages I see that only some of them can be mounted with gnome-disk-image-mounter. Also here.


Changing their extension:

Not all appimages have exactly the same structure, but all are archives. Wikipedia says: "An AppImage of version 1.0 is an ISO 9660 Rock Ridge file (which can be optionally zisofs compressed) containing a minimal AppDir and a tiny runtime. (Version 2 may use other file system image formats like SquashFS)".

So, it can be extracted. In this way you can examine the files.

Simply changing the extension from AppImage to an archive extension that my file-roller archive manager can read (I tested with zip, 7z, etc) and double-clicking the file reveals the contents in file-roller:

enter image description here

They can also be extracted, of course. The "extract" file manager context menu action works too in order to extract the archive. (As said in comment, the unzip command reports an error with a file renamed with a zip extension, so renaming to zip is not the proper choice in itself, but it works with archive managers like file-roller.)

cipricus
  • 3,102
  • 1
  • 25
  • 70
  • I tried copying an AppImage to `test.zip` and running `unzip test.zip` and I got the message: `End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. note: test.zip may be a plain executable, not an archive` – Wildcard Apr 26 '20 at 23:43
  • 2
    @Wildcard - it seems that some archive managers like file-roller do not care about the proper archive extension as long as the file IS an archive with an archive extension (no matter what that is), and are able to extract it, while `unzip` tool is extension-oriented and looks for more extension-specific properties in order to operate. So, instead of `unzip`, use the file manager extract action or `file-roller -f`. See `file-roller --help` for details. – cipricus Apr 27 '20 at 07:37
  • 1
    I would like to point out that the first method does actually exec the appimage binary, so its not a suitable method to examine untrusted files. – Jasen Jan 20 '22 at 00:09
  • @Jasen - I have added a note on that. – cipricus May 23 '23 at 08:28
10

According to AppImage documentation the --appimage-mount option allows you to mount and inspect the contents.

For example:

./Joplin.AppImage --appimage-mount /tmp/mount_myXXXX

The application's help can usually be shown with ./whatever.AppImage --help like any other application, but to see the AppImage specific options, you can run:

./whatever.AppImage --appimage-help

Here is the relevant portion of the output:

AppImage options:
...
  --appimage-mount                Mount embedded filesystem image and print
                                  mount point and wait for kill with Ctrl-C

You don't have to create a mountpoint for it or delete the directory afterwards; the AppImage will take care of all of that.

Wildcard
  • 1,098
  • 1
  • 17
  • 36
Clover
  • 194
  • 5