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

use signalfd() for signal handling #1

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 0 additions & 5 deletions Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /usr/bin/env make

CC= @CC@
CFLAGS=@CFLAGS@ -O2 -g -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIE -fPIC
LDFLAGS=@LDFLAGS@ -fPIC -pie -z relro -z now -fstack-protector
LDLIBS=@LIBS@
prefix := /usr/local

all: net2pcap

net2pcap: net2pcap.o

.PHONY: static
static: net2pcap.$(shell uname -m)
net2pcap.$(shell uname -m): net2pcap.c
$(CC) $(CFLAGS) -static -o $@ $<


.PHONY: clean
clean:
rm -f net2pcap.o net2pcap
10 changes: 5 additions & 5 deletions README
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

Net2PCAP is a simple network to pcap capture file for Linux. Its goal
is to be as simple as possible (hence auditable) so that good
confidence can be reached, for it to be used in hostile
environments.

It does not use any library except a bit of libc. It does not do
It does not require any library except a bit of libc. It does not do
anything except dumping network traffic from an interface to a pcap
file. It is less than 400 lines of C. Please audit it !
file. It is less than 600 lines of C. Please audit it !

Comparison with tcpdump

Expand All @@ -19,9 +18,10 @@ Comparison with tcpdump
* net2pcap can reopen its capture file (SIGHUP) (used for capture file rotation)
* net2pcap does not do anything else than reading from network and dumping to file
* net2pcap does not use libpcap
* net2pcap drops its privileges
* net2pcap sandboxes itself (if libseccomp is available)
* net2pcap runs only on Linux
* net2pcap is auditable (less than 400 lines)
* net2pcap is auditable (less than 600 lines)

Original code from Philippe Biondi, bugs added by Nicolas Bareil :)

http://www.secdev.org/projects/net2pcap/
4 changes: 4 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/sh

autoreconf --install
automake --add-missing --copy > /dev/null 2>&1
25 changes: 25 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AC_INIT([net2pcap], [0.2], [nico@chdir.org], [net2pcap], [http://github.com/nbareil/net2pcap/])
AC_PREREQ([2.59])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_ARG_ENABLE([sandbox],
[ --disable-sandbox do not use SECCOMP sandbox],
[sandbox=${enableval}], [sandbox=auto])

have_seccomp=no

if test "x${sandbox}" != xno; then
AC_SEARCH_LIBS([seccomp_init], [seccomp], [have_seccomp=yes])
AC_CHECK_HEADERS([seccomp.h])
fi

if test "x${sandbox}" = xyes && test "x${have_seccomp}" != xyes; then
AC_MSG_ERROR([
--------------------------------------------
Unable to find libseccomp. Abording.
--------------------------------------------
])
fi

AC_PROG_CC
AC_OUTPUT
Loading