Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(commands): add documentation about build command #23

Merged
merged 5 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ getrlimit

These are the syscalls that have been executed by the traced function!

**N.B.** For a complete list of available command, take a look [here](docs/commands.md).
**N.B.** For a complete list of available commands, take a look [here](docs/commands.md).

## Installation

Expand Down
22 changes: 19 additions & 3 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Harpoon has several commands that you can use.

The common way of using `harpoon` is to execute the available commands as follow:

* [`harpoon analyze`](#analyze-) to analyze the project to infer symbols to be traced. This will create a `.harpoon.yml` file.

* [`harpoon hunt`](#hunt-) by passing the `.harpoon.yml` file to trace the functions and get their system calls. This will generate the `./harpoon/` directory with the metadata that contains the system calls traced.
alegrey91 marked this conversation as resolved.
Show resolved Hide resolved

* [`harpoon build`](#build-️) to read the metadata files and provide the **seccomp** profile.

## Analyze

The `analyze` command is used to analyze the project's folder and get the list of function symbols you want to trace.
Expand All @@ -16,12 +24,20 @@ Run it on your project folder:
sudo harpoon analyze --exclude .git/ .
```

## Build

The `build` command collect the metadata files (created by the `hunt` command under the `harpoon/` directory) and use them to create a **seccomp** profile based on their content.
alegrey91 marked this conversation as resolved.
Show resolved Hide resolved

```sh
sudo harpoon build -D ./harpoon/
```

## Capture

The `capture` command is the "core" of `harpoon`. This trace the function symbols passed as argument for the give binary.
alegrey91 marked this conversation as resolved.
Show resolved Hide resolved

```sh
sudo harpoon capture -f github.com/alegrey91/fwdctl/pkg/iptables.interfaceExists .harpoon/interface.test
sudo harpoon capture -f github.com/user/repo/pkg/pkgname.functionName .harpoon/packagebin.test
```

The result, is a list of system call executed by the function during the run of the binary.
Expand All @@ -35,7 +51,7 @@ The command needs a file as input paramenter that is the result of the `analyze`
This will loop over the entries of the file, capturing the system calls of each entry.

```sh
harpoon hunt --file .harpoon.yml -S -D seccomp
harpoon hunt --file .harpoon.yml -S
```

This will create a directory `seccomp/` with the list of system calls traced from the execution of the different test binaries present in the `.harpoon.yml` file.
This will create the directory `harpoon/` with the list of system calls traced from the execution of the different test binaries present in the `.harpoon.yml` file.