首页
社区
课程
招聘
[推荐]Lighthouse - Code Coverage Explorer for IDA Pro
发表于: 2017-11-3 17:34 4697

[推荐]Lighthouse - Code Coverage Explorer for IDA Pro

2017-11-3 17:34
4697
 

原文链接

Lighthouse - Code Coverage Explorer for IDA Pro

image

Overview

Lighthouse is a code coverage plugin for IDA Pro. The plugin leverages IDA as a platform to map, explore, and visualize externally collected code coverage data when symbols or source may not be available for a given binary.

 

This plugin is labeled only as a prototype and IDA / Qt code example for the community.

 

Special thanks to @0vercl0k for the inspiration.

Releases

  • v0.6 -- Intel pintool, cyclomatic complexity, batch load, bugfixes.
  • v0.5 -- Search, IDA 7 support, many improvements, stability.
  • v0.4 -- Most compute is now asynchronous, bugfixes.
  • v0.3 -- Coverage composition, interactive composing shell.
  • v0.2 -- Multifile support, performance improvements, bugfixes.
  • v0.1 -- Initial release

Installation

Install Lighthouse into the IDA plugins folder.

  • Copy the contents of the plugin folder to the IDA plugins folder
    • On Windows, the folder is at C:\Program Files (x86)\IDA 6.8\plugins
    • On MacOS, the folder is at /Applications/IDA\ Pro\ 6.8/idaq.app/Contents/MacOS/plugins
    • On Linux, the folder may be at /opt/IDA/plugins/

The plugin is platform agnostic, but has only been tested on Windows for IDA 6.8 --> 7.0

Usage

Lighthouse loads automatically when an IDB is opened, installing a handful of menu entries into the IDA interface.

 

image

 

These are the entry points for a user to load and view coverage data.

- File --> Load file --> Code coverage file...
- File --> Load file --> Code coverage batch...
- View --> Open subviews --> Coverage Overview

Batch load can quickly aggregate hundreds (thousands?) of collected coverage files into a single composite at load time.

Coverage Painting

Lighthouse 'paints' the active coverage data across the three major IDA views as applicable. Specifically, the Disassembly, Graph, and Pseudocode views.

 

image

Coverage Overview

The Coverage Overview is a dockable widget that provides a function level view of the active coverage data for the database.

 

image

 

This table can be sorted by column, and entries can be double clicked to jump to their corresponding disassembly.

Coverage Composition

Building relationships between multiple sets of coverage data often distills deeper meaning than their individual parts. The shell at the bottom of the Coverage Overview provides an interactive means of constructing these relationships.

 

image

 

Pressing enter on the shell will evaluate and save a user constructed composition.

Composition Syntax

Coverage composition, or Composing as demonstrated above is achieved through a simple expression grammar and 'shorthand' coverage symbols (A to Z) on the composing shell.

Grammar Tokens

  • Logical Operators: |, &, ^, -
  • Coverage Symbol: A, B, C, ..., Z
  • Coverage Range: A,C, Q,Z, ...
  • Parenthesis: (...)

Example Compositions

  • A & B
  • (A & B) | C
  • (C & (A - B)) | (F,H & Q)

The evaluation of the composition may occur right to left, parenthesis are suggested for potentially ambiguous expressions.

Hot Shell

Additionally, there is a 'Hot Shell' mode that asynchronously evaluates and caches user compositions in real-time.

 

image

 

The hot shell serves as a natural gateway into the unguided exploration of composed relationships.

Search

Using the shell, one can search and filter the functions listed in the coverage table by prefixing their query with /.

 

image

 

The head of the shell will show an updated coverage % computed only from the remaining functions. This is useful when analyzing coverage for specific function families.

Jump

Entering an address or function name into the shell can be used to jump to corresponding function entries in the table.

 

image

Coverage ComboBox

Loaded coverage data and user constructed compositions can be selected or deleted through the coverage combobox.

 

image

Collecting Coverage

Before using Lighthouse, one will need to collect code coverage data for their target binary / application.

 

The examples below demonstrate how one can use DynamoRIO or Intel Pin to collect Lighthouse compatible coverage agaainst a target. The .log files produced by these instrumentation tools can be loaded directly into Lighthouse.

DynamoRIO

Code coverage data can be collected via DynamoRIO's drcov code coverage module.

 

Example usage:

..\DynamoRIO-Windows-7.0.0-RC1\bin64\drrun.exe -t drcov -- boombox.exe

Intel Pin (Experimental)

Using a custom pintool contributed by Agustin Gianni, the Intel Pin DBI can also be used to collect coverage data.

 

Example usage:

pin.exe -t CodeCoverage64.dll -- boombox.exe

For convenience, binaries for the Windows pintool can be found on the releases page. MacOS and Linux users need to compile the pintool themselves following the instructions included with the pintool for their respective platforms.

Future Work

Time and motivation permitting, future work may include:

  • Profiling based heatmaps/painting
  • Coverage & Profiling Treemaps
  • Additional coverage sources, trace formats, etc
  • Improved Pseudocode painting

I welcome external contributions, issues, and feature requests.

Authors


[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 14444
活跃值: (5703)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
good
2017-11-13 16:19
0
游客
登录 | 注册 方可回帖
返回
//