diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1a1edcc --- /dev/null +++ b/Dockerfile @@ -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/ diff --git a/README.md b/README.md index c68058e..44ecadd 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,14 @@ 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. @@ -56,13 +57,25 @@ Newest Contributor: - 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 @@ -98,6 +111,36 @@ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DDOCDIR=/usr/share/doc/package/callflow -D make install DESTDIR= ``` +### 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: @@ -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. diff --git a/callflow b/callflow index 4691aba..5250f7e 100755 --- a/callflow +++ b/callflow @@ -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!"