Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
insomniacslk committed Oct 7, 2015
0 parents commit f850917
Show file tree
Hide file tree
Showing 35 changed files with 4,671 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.o
.*.swp
*.pyc
*.so
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "dependencies/libtins"]
path = dependencies/libtins
url = https://github.com/mfontanini/libtins.git
[submodule "dependencies/jsoncpp"]
path = dependencies/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp.git
7 changes: 7 additions & 0 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake
a recent enough C++11 compiler (gcc >= 4.6 or clang >= 3.3)
libpcap-dev
libtins >= 3 (or use the one provided here)
python-dev
python-pygraphviz
python-tabulate
2,352 changes: 2,352 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

171 changes: 171 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
SRCDIR=$(shell pwd)/src
INCLUDEDIR=$(shell pwd)/include
PROG=dublin-traceroute
PREFIX=/usr/local

TINS_BASE_DIR=$(shell pwd)/dependencies/libtins
TINS_BUILD_DIR=$(TINS_BASE_DIR)/build
TINS_LIB_DIR=$(TINS_BUILD_DIR)/lib
TINS_AR=$(TINS_LIB_DIR)/libtins.a
TINS_SO=$(TINS_LIB_DIR)/libtins.so
TINS_INCLUDE_DIR=$(TINS_BASE_DIR)/include

JSONCPP_BASE_DIR=$(shell pwd)/dependencies/jsoncpp
JSONCPP_BUILD_DIR=$(JSONCPP_BASE_DIR)/dist
JSONCPP_INCLUDE_DIR=$(JSONCPP_BUILD_DIR)

DOCS_DIR=$(shell pwd)/docs

CXXFLAGS=-I. -Iinclude -I$(TINS_INCLUDE_DIR) -I$(JSONCPP_INCLUDE_DIR) -Wall -Werror -pedantic -std=c++11 -ggdb -O0 -Wno-nested-anon-types
LDFLAGS= -lpthread -L$(TINS_LIB_DIR) -ltins
LDFLAGS_STATIC=$(LDFLAGS) -L$(TINS_BUILD_DIR)/lib $(TINS_AR) -static -Wl,-Bdynamic -lc -Wl,-Bstatic -lpcap
LDFLAGS_DYNAMIC=$(LDFLAGS) -ltins -L. -L$(TINS_LIB_DIR) -ldublintraceroute
SOFLAGS=-fPIC
SRCS=$(SRCDIR)/common.cc \
$(SRCDIR)/dublin_traceroute.cc \
$(SRCDIR)/traceroute_results.cc \
$(SRCDIR)/hop.cc \
$(JSONCPP_BUILD_DIR)/jsoncpp.cpp
TMP=$(SRCS:.cc=.o)
OBJS=$(TMP:.cpp=.o)
HDRS=$(INCLUDEDIR)/dublintraceroute/common.h \
$(INCLUDEDIR)/dublintraceroute/exceptions.h \
$(INCLUDEDIR)/dublintraceroute/dublin_traceroute.h \
$(INCLUDEDIR)/dublintraceroute/traceroute_results.h \
$(INCLUDEDIR)/dublintraceroute/icmp_messages.h \
$(INCLUDEDIR)/dublintraceroute/hop.h \
$(JSONCPP_INCLUDE_DIR)/json/json.h

.PHONY: clean all doc dependencies

all: cli

static: cli_static

libdublintraceroute.so: $(TINS_SO) $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) -shared

libdublintraceroute.a: $(TINS_AR) $(OBJS)
$(CXX) $(CXXFLAGS) -o $@.a $(TINS_AR) $(OBJS)

$(JSONCPP_BUILD_DIR)/jsoncpp.o: $(JSONCPP_BUILD_DIR)/jsoncpp.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@ $(SOFLAGS)

%.o: %.cc
$(CXX) -c $(CXXFLAGS) $< -o $@ $(SOFLAGS)


%.cc: %.h


cli_static: dependencies $(TINS_AR) $(SRCDIR)/main.o $(OBJS) $(HDRS)
$(CXX) $(CXXFLAGS) -o $(PROG) $(SRCDIR)/main.o $(OBJS) $(LDFLAGS_STATIC)

cli: dependencies libdublintraceroute.so $(SRCDIR)/main.o $(OBJS) $(HDRS)
$(CXX) $(CXXFLAGS) -o $(PROG) $(SRCDIR)/main.o $(LDFLAGS_DYNAMIC)

dependencies: submodules $(JSONCPP_BUILD_DIR)

submodules:
git submodule update --init --recursive

$(TINS_AR): $(TINS_BASE_DIR)
( \
cd $(TINS_BASE_DIR) && \
git checkout tags/v3.2 && \
$(RM) -r $(TINS_BUILD_DIR) && \
mkdir $(TINS_BUILD_DIR) && \
cd $(TINS_BUILD_DIR) && \
cmake ../ -DLIBTINS_BUILD_SHARED=0 -DLIBTINS_ENABLE_CXX11=1 -DLIBTINS_ENABLE_WPA2=0 && \
make \
)

$(TINS_SO): $(TINS_BASE_DIR)
( \
cd $(TINS_BASE_DIR) && \
git checkout tags/v3.2 && \
$(RM) -r $(TINS_BUILD_DIR) && \
mkdir $(TINS_BUILD_DIR) && \
cd $(TINS_BUILD_DIR) && \
cmake ../ -DLIBTINS_BUILD_SHARED=1 -DLIBTINS_ENABLE_CXX11=1 -DLIBTINS_ENABLE_WPA2=0 && \
make \
)


$(JSONCPP_BUILD_DIR)/jsoncpp.cpp: $(JSONCPP_BUILD_DIR)

$(JSONCPP_BUILD_DIR):
( \
cd $(JSONCPP_BASE_DIR) && \
python amalgamate.py \
)

python-extension: all
( \
cd python && \
python setup.py build \
)

doc: Doxyfile
doxygen Doxyfile

install: install-shared-library install-headers install-cli install-python-extension

install-shared-library: libdublintraceroute.so install-libtins
# install the shared library
install -d $(DESTDIR)/$(PREFIX)/lib
install libdublintraceroute.so $(DESTDIR)/$(PREFIX)/lib
ldconfig

install-libtins: $(TINS_SO)
( \
cd $(TINS_BUILD_DIR) && \
make install \
)

install-headers: $(HDRS)
# install the development headers
install -d $(DESTDIR)/$(PREFIX)/include/dublintraceroute
install -t $(DESTDIR)/$(PREFIX)/include/dublintraceroute $(HDRS)

install-cli: cli
# install the command-line tool
install -d $(DESTDIR)/$(PREFIX)/bin
install -t $(DESTDIR)/$(PREFIX)/bin $(PROG)
# let it use raw socket without root
if command -v setcap ; \
then \
setcap cap_net_raw=ep $(DESTDIR)/$(PREFIX)/bin/$(PROG); \
else \
chmod u+s $(DESTDIR)/$(PREFIX)/bin/$(PROG); \
fi

install-python-extension: python-extension
# install the python extension
( \
cd python && \
python setup.py install \
)

install-all: install install-python-extension

uninstall: uninstall-shared-library uninstall-headers uninstall-cli uninstall-python-extension

uninstall-shared-library:
$(RM) $(DESTDIR)/$(PREFIX)/lib/libdublintraceroute.so

uninstall-headers:
$(RM) -r $(DESTDIR)/$(PREFIX)/include/dublintraceroute/

uninstall-cli:
$(RM) $(DESTDIR)/$(PREFIX)/bin/$(PROG)

uninstall-python-extension:
# TODO uninstall the Pyton extension

clean:
$(RM) -r $(OBJS) $(PROG) $(DOCS_DIR) $(JSONCPP_BUILD_DIR) libdublintraceroute.so libdublintraceroute.a

distclean: clean
$(RM) -r $(TINS_BUILD_DIR)

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Dublin Traceroute is a NAT-aware multipath traceroute tool. You should really
read more at https://dublin-traceroute.net .

But, in a few words, you can run traceroutes in multi-path networks (i.e. with ECMP load-balancing enabled), recognize NATs, have nice diagrams like the one below, export to JSON, and do this with a command-line tool, a C++ library or a Python library.

![dublin-traceroute example](documentation/readme/traceroute_8.8.8.8.png)
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
insomniac <[email protected]>
175 changes: 175 additions & 0 deletions documentation/article_template.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Journal Article
% LaTeX Template
% Version 1.3 (9/9/13)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Frits Wenneker (http://www.howtotex.com)
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[twoside]{article}

\usepackage{lipsum} % Package to generate dummy text throughout this template

\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage{multicol} % Used for the two-column layout of the document
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{float} % Required for tables and figures in the multi-column environment - they need to be placed in specific locations with the [H] (e.g. \begin{table}[H])
\usepackage{hyperref} % For hyperlinks in the PDF

\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{paralist} % Used for the compactitem environment which makes bullet points with less space between them

\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text

\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\Roman{subsection}} % Roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles

\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Running title $\bullet$ October 2015} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text

%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------

\title{\vspace{-15mm}\fontsize{24pt}{10pt}\selectfont\textbf{Detecting NATs in multipath traceroutes}} % Article title

\author{
\large
\textsc{Andrea Barberio}\thanks{A thank you or further information}\\[2mm] % Your name
% \normalsize University of California \\ % Your institution
\normalsize \href{mailto:[email protected]}{[email protected]} % Your email address
\vspace{-5mm}
}
\date{}

%----------------------------------------------------------------------------------------

\begin{document}

\maketitle % Insert title

\thispagestyle{fancy} % All pages have headers and footers

%----------------------------------------------------------------------------------------
% ABSTRACT
%----------------------------------------------------------------------------------------

\begin{abstract}

\noindent \lipsum[1] % Dummy abstract text

\end{abstract}

%----------------------------------------------------------------------------------------
% ARTICLE CONTENTS
%----------------------------------------------------------------------------------------

\begin{multicols}{2} % Two-column layout throughout the main article text

\section{Introduction}

\lettrine[nindent=0em,lines=3]{L} orem ipsum dolor sit amet, consectetur adipiscing elit.
\lipsum[2-3] % Dummy text

%------------------------------------------------

\section{Methods}

Maecenas sed ultricies felis. Sed imperdiet dictum arcu a egestas.
\begin{compactitem}
\item Donec dolor arcu, rutrum id molestie in, viverra sed diam
\item Curabitur feugiat
\item turpis sed auctor facilisis
\item arcu eros accumsan lorem, at posuere mi diam sit amet tortor
\item Fusce fermentum, mi sit amet euismod rutrum
\item sem lorem molestie diam, iaculis aliquet sapien tortor non nisi
\item Pellentesque bibendum pretium aliquet
\end{compactitem}
\lipsum[4] % Dummy text

%------------------------------------------------

\section{Results}

\begin{table}[H]
\caption{Example table}
\centering
\begin{tabular}{llr}
\toprule
\multicolumn{2}{c}{Name} \\
\cmidrule(r){1-2}
First name & Last Name & Grade \\
\midrule
John & Doe & $7.5$ \\
Richard & Miles & $2$ \\
\bottomrule
\end{tabular}
\end{table}

\lipsum[5] % Dummy text

\begin{equation}
\label{eq:emc}
e = mc^2
\end{equation}

\lipsum[6] % Dummy text

%------------------------------------------------

\section{Discussion}

\subsection{Subsection One}

\lipsum[7] % Dummy text

\subsection{Subsection Two}

\lipsum[8] % Dummy text

%----------------------------------------------------------------------------------------
% REFERENCE LIST
%----------------------------------------------------------------------------------------

\begin{thebibliography}{99} % Bibliography - this is intentionally simple in this template

\bibitem[Figueredo and Wolf, 2009]{Figueredo:2009dg}
Figueredo, A.~J. and Wolf, P. S.~A. (2009).
\newblock Assortative pairing and life history strategy - a cross-cultural
study.
\newblock {\em Human Nature}, 20:317--330.

\end{thebibliography}

%----------------------------------------------------------------------------------------

\end{multicols}

\end{document}
Loading

0 comments on commit f850917

Please sign in to comment.