PyFlag Manual

Flag (Forensic and Log Analysis GUI) is a tool designed to simplify the examination of forensic evidence in the form of Hard disk images, logs and network captures. This manual documents some of the basic aspects of FLAG, but is by no means complete. There is a complete API documentation produced by epydoc in the docs directory. The API documentation is designed for developers who wish to contribute to PyFlag development.

Basic Concepts

Flag Cases

A central concept to flag is the case. A case is simply an area to collect related information regarding a particular incident. Internally a case is kept in its own database, and tables are added to the case as different forms of evidence are added.

To create a new case, click the Case Management tab and add a new case.

Resetting the case deletes all data from the case, which is essentially equivalent to dropping the case database and recreating it.

IO Sources

Another central concept to FLAG is the IO source. An IO source is simply a way of specifying a source of data for flag. The concept of IO Source is an abstraction of data sources. For example, a hard disk image is a source of data, however we could use a number of different types of hard disk images, e.g. dd images, encase evidence files etc.

Hence FLAG uses an IO source to handle data, and the specifics of how to access this form of data are abstracted. IO Sources are currently heavily utilised in the disk forensic module, but may be extended to other modules in the future. Although the following examples are concentrating on hard disk images, in the future similar IO Subsystems will be used for other aspects of FLAG, such as log files, and network captures.

The following IO Source types are currently supported. Other IO sources may be added in the future:

Table Viewer Widget and the Navigation Bar

The most powerfull widget in flag is the table viewer. This widget allows for extremely sophisticated searching of the dataset and is so important that an entire section is dedicated to it here. The figure below shows a typical usage of the Table widget, although it is used in many places within PyFlag.

The following components can be seen:

Modules

PyFlag has an extensible, open architecture which allows developers to add arbitrary modules to the program core easily. The modules all reside within the plugins directory. PyFlag will automatically import all modules within that directory and make these available to the user via the menu.

Following is a discussion on each module, and the functionality available through each module.

Disk Forensics

The Flag Disk Forensics Module provides the the following capabilities: These map to the reports which appear in the "Disk Forensics" tab in flag.

Before using these reports, the filesystem image must be loaded into flag. This is a three stage process:

Once the image is loaded the reports in the DiskForensics tab can be run. Note that the "MD5 Hash Comparison" can take a long time. Currently, before using the "Browse Registry" report, you must extract the registry hives from the image, this can be done my dowloading them using the "Browse Filesystem" report.

Unstructured Disk Forensics

Sometimes it is impossible to recover files directly off a hard disk image. This may be due to the disk being corrupted, or the files being deleted, while the filesystem does not support file undeletetion (for example NTFS). In these cases it may be possible to recover some files by looking at the raw disk as a big chunk of binary data, without structure or filesystem, hence the term unstructured forensics.

Most filesystems try to keep files unfragmented as much as possible. This is usually a performance consideration, but on the balance, files reside in allocated sequential blocks. This property can be exploited for forensically recovering the files. Since most files have a definite file header (sometimes called file magic), it is possible to search the raw disk for this magic and extract data.

This is the purpose of the "Extract Files" report. To look for possible files on the disks. This is not perfect since sometimes files are overwritten, or fragmentation corrupts them. Often though, this is enough evidence that contraband files were found (e.g. illegal pornography), or that document fragments can be retrieved (Often it is possible to read the text of office documents, despite them being corrupted). The image below illustrates the Unstructured Forensics report.

As can be seen, thumbnails are generated on the fly for each suspected file type. The filename given to each extracted file consistes of the offset within the image, and the extension based on the file type. (Note that Microsoft office documents all have the .doc extension, because all Microsoft office documents have the same magic).

By clicking of each image, it is possible to download the file, view a hexdump of the file or see strings within the file.

Log Analysis

Flags provides simple yet powerful log analysis capabilities based on the flag table view. Flag allows you to load arbitrary plain text log files by first describing the file format. The loading process is as follows: Once the logfile data is loaded, it can be analysed using the "List Log File Contents" report in the "LogAnalysis" tab. This report simply shows a table of the loaded log. The table can be search my multiple criteria at a time, and sorted or grouped by any column.

Network Packet Analysis

The Network capture analysis is based on disecting the packets using ethereal and loading the results into the database for analyisis. Network analysis can be performed in two modes, corresponding to the flag tabs:
Last modified: Tue Mar 16 21:43:28 EST 2004