In the first part I showed you that you can use libguestfs directly on QEMU snapshots and backing files, and this can be used to forensically look at changes made to virtual machines, eg. by installing new software.
Given the backing file and changes from yesterday, we can also look at differences in file content and permissions on files — in other words, what existing files did the Google Chrome installer change in the Windows guest?
A simple and easy way to do this is to instruct guestfish to export the whole filesystem as a tarball, which we’ll use on the host to compare file permissions and sizes:
$ guestfish --ro -i -a backing.qcow2 tar-out / - | tar tvvf - | sort -k6 > files.without-chrome $ guestfish --ro -i -a win7.qcow2 tar-out / - | tar tvvf - | sort -k6 > files.with-chrome $ diff -u files.without-chrome files.with-chrome | less [... 1,677 lines of output ...] --rwxrwxrwx root/root 1157779 2011-06-02 11:06 ./Windows/WindowsUpdate.log +-rwxrwxrwx root/root 1221259 2011-06-03 10:04 ./Windows/WindowsUpdate.log
What did I find out? As well as adding its own files to
AppData/Local, Chrome also made changes to all of the registry hives, and as a result of installing new files, many internal Windows indexes were updated.
This technique will miss several changes which might be important to you: it will miss files that have had their content changed, but the file size and modification date didn’t change. And it will omit changes to extended attributes such as file forks, NT symbolic links and so on. If you want to list those changes too, you have to get down and dirty in the libguestfs API. This posting would be a good place to start.
Tomorrow we’ll look at changes in the Windows registry.