How To Install afl-cov on Ubuntu 18.04

In this tutorial we learn how to install afl-cov on Ubuntu 18.04. afl-cov is code coverage for afl (American Fuzzy Lop)

Introduction

In this tutorial we learn how to install afl-cov on Ubuntu 18.04.

What is afl-cov

afl-cov is:

afl-cov uses test cases produced by the fuzzer afl to produce gcov code coverage results (what parts of program are actually executed) of the targeted binary.

afl-cov can be used to analyze the test results of afl after fuzzing has been completed. However, a typical workflow is to run afl-cov while afl-fuzz builds test cases during the fuzzing cycle runs on the same system, and to review the cumulative code coverage results.

Analyzing code coverage results of afl test cases can help to maximize its effectiveness, e.g. when its needed to patch the project code to help the fuzzer to reach code that would be otherwise inaccessible.

There are three methods to install afl-cov on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install afl-cov Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install afl-cov using apt-get by running the following command:

sudo apt-get -y install afl-cov

Install afl-cov Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install afl-cov using apt by running the following command:

sudo apt -y install afl-cov

Install afl-cov Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install afl-cov using aptitude by running the following command:

sudo aptitude -y install afl-cov

How To Uninstall afl-cov on Ubuntu 18.04

To uninstall only the afl-cov package we can use the following command:

sudo apt-get remove afl-cov

Uninstall afl-cov And Its Dependencies

To uninstall afl-cov and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove afl-cov

Remove afl-cov Configurations and Data

To remove afl-cov configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge afl-cov

Remove afl-cov configuration, data, and all of its dependencies

We can use the following command to remove afl-cov configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge afl-cov

References

Summary

In this tutorial we learn how to install afl-cov package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.