Skip to content

Commit

Permalink
Docker Ready & Latest Inkscape For Ubuntu
Browse files Browse the repository at this point in the history
* Removed code that prevented the program from running when running as root user. The default user in Docker containers is root.
* Added a Dockerfile with which images can be built. Updated the README file with instructions on how to use the Docker image.
* Updated the README file to include instructions for installing the latest version of Inkscape from the repos. This ensure PNG file creation does not fail as the CLI options are different in the latest version of Inkscape.
* Updated the README file to include missing dependency tshark.
* Also updated the README with the link to the releases page to download built versions.
  • Loading branch information
karthicraghupathi committed May 25, 2020
1 parent ef326db commit 5569e4d
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 7 deletions.
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:20.04 AS builder
LABEL maintainer="karthicr@gmail.com"
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Etc/UTC
ENV CALLFLOWVERSION=20200523
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
ca-certificates \
cmake \
make \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN wget -O callflow-${CALLFLOWVERSION}.tar.bz2 https://github.com/karthicraghupathi/callflow/releases/download/v${CALLFLOWVERSION}/callflow-${CALLFLOWVERSION}.tar.bz2 \
&& tar xf callflow-${CALLFLOWVERSION}.tar.bz2 \
&& cd callflow-${CALLFLOWVERSION} \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make install \
&& rm -rf callflow-${CALLFLOWVERSION}

FROM ubuntu:20.04
LABEL maintainer="karthicr@gmail.com"
RUN apt-get update \
&& apt-get -y install --no-install-recommends software-properties-common \
&& add-apt-repository -u -y ppa:inkscape.dev/stable \
&& apt-get -y install --no-install-recommends gawk inkscape tshark \
&& apt-get -y purge --auto-remove software-properties-common \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/callflow /usr/local/bin/
COPY --from=builder /usr/local/share/doc/callflow /usr/local/share/doc/callflow
COPY --from=builder /usr/local/callflow/ /usr/local/callflow/
COPY --from=builder /usr/local/share/man/man1/callflow.1 /usr/local/share/man/man1/
COPY --from=builder /usr/local/etc/callflow/callflow.conf /usr/local/etc/callflow/
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,40 @@ Newest Contributor:
- GNU `getopt`
- `cmake`
- Inkscape
- TShark

#### macOS

- On macOS, install the dependencies using `brew`:
```
brew install cmake gawk gnu-sed gnu-getopt
brew cask install inkscape
brew cask install inkscape wireshark
```
- Ensure these dependencies are first by correctly setting `PATH` typically in your `.bashrc` or `.zshrc` files.

#### Ubuntu

- On Ubuntu, install the dependencies using `apt`:
```
apt install gawk sed inkscape
apt install gawk sed
```
- `getopt` should already be present on Debian based distros.
- Ensure these dependencies are first by correctly setting `PATH` typically in your `.bash_profile` file.
- Install the latest version of Inkscape from their repo by running the following commands:
```
add-apt-repository ppa:inkscape.dev/stable
apt update && apt install inkscape tshark
```
- If you don't have the latest version of Inkscape, you will get the following error:
```
Unknown option --export-png
```
- `--export-png` was changed to `--export-filename` in [v1.0](https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line)

### Build Instructions

Download an archived version of `callflow` from the [releases](https://github.com/karthicraghupathi/callflow/releases) page and extract it.

Inside your `callflow` folder, run the following commands:

``` bash
Expand Down Expand Up @@ -98,6 +111,36 @@ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DDOCDIR=/usr/share/doc/package/callflow -D
make install DESTDIR=<package build directory>
```

### Docker Instructions

Docker images are available at https://hub.docker.com/r/karthicr/callflow.

#### First Run

With Docker installed, run the following command to have a running container having a working version of `callflow`:

```
docker run \
--name callflow \
-v /source/folder/containing/PCAPs:/PCAPs
-it \
karthicr/callflow:latest /bin/bash
```

- `--name callflow` creates a container called `callflow`
- `-v /source/folder/containing/PCAPs:/PCAPs` maps the source folder from your local machine to a folder called `PCAPs` inside your container. You will change into this folder inside your container to invoke `callflow`.
- `-it` keeps STDIN open and allocates a pseudo-TTY.
- `karthicr/callflow:latest` pulls the latest `callflow` image from the Docker registry
- `/bin/bash` is the command that is run when the container has booted resulting in an interactive shell for you to work with.

#### Subsequent Runs

Once the earlier command is issued, you will always have a `callflow` container ready to go. To use the existing container next time, run the following command:

```
docker exec -it callflow /bin/bash
```

## Using `callflow`

With callflow in your path, just type:
Expand All @@ -112,4 +155,13 @@ In this directory, you will find `callflow.svg`, `callflow.png` file, an `index.

Both the SVG file and the HTML file contain links into the frames directory so that you can look at the contents of the full packet frame. All the frames have been processed to remove the IP headers, which usually aren't interesting.

You will typically use the following command:

```
callflow -d --no-archive capture-file.cap
```

- `-d` removes duplicate frames while processing the PCAP files.
- `--no-archive` disables the creation of the archive containing the callflow. This option can also be configured in `callflow.conf` so you don't repeat it everytime you invoke `callflow`.

Refer to the `man` page for the most complete and latest instructions.
5 changes: 0 additions & 5 deletions callflow
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,6 @@ while true; do
shift
done

[[ $(id -u) == 0 ]] && {
echo "$PRGNAME: error: do not run as user 'root'"
exit 1
}

inputfile="$1"
if [[ ! -f "$inputfile" ]]; then
echo "$PRGNAME: error: Input file ($inputfile) does not exists!"
Expand Down

0 comments on commit 5569e4d

Please sign in to comment.