summaryrefslogtreecommitdiff
path: root/net-analyzer/sancp
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-analyzer/sancp
reinit the tree, so we can have metadata
Diffstat (limited to 'net-analyzer/sancp')
-rw-r--r--net-analyzer/sancp/Manifest14
-rw-r--r--net-analyzer/sancp/files/sancp-1.6.1-compiler.patch45
-rw-r--r--net-analyzer/sancp/files/sancp-1.6.1-gcc6.patch26
-rw-r--r--net-analyzer/sancp/files/sancp.confd15
-rw-r--r--net-analyzer/sancp/files/sancp.rc142
-rw-r--r--net-analyzer/sancp/files/sguil_sancp.conf69
-rw-r--r--net-analyzer/sancp/metadata.xml14
-rw-r--r--net-analyzer/sancp/sancp-1.6.1-r4.ebuild69
8 files changed, 294 insertions, 0 deletions
diff --git a/net-analyzer/sancp/Manifest b/net-analyzer/sancp/Manifest
new file mode 100644
index 000000000000..a362bb6eb45a
--- /dev/null
+++ b/net-analyzer/sancp/Manifest
@@ -0,0 +1,14 @@
+AUX sancp-1.6.1-compiler.patch 4603 SHA256 9fd58d1cb8db0b8b190085ea4bb54ee33b8fa976b2bafdae2063633164b23133 SHA512 7ae67ce719f36ea795eda87d7d9d97885ea544c150f568d7751397172d8608be5980f386b7f24fe4d7e3a9a49b4cae4efb3987cdbb9dfc85c69397e3d603535c WHIRLPOOL a475b3a57b33f01b7ab468b24b11f46ca16f4bfd3073221c3d99281601cfa6229d4473b0ac5991c33341c2b8c126ab2a066520da74bf41743cf92395e0692d10
+AUX sancp-1.6.1-gcc6.patch 864 SHA256 99e466253e5bf7858bd90490c2e427586397fc32992b2f0d2114c789980085ef SHA512 7dd6b24ed478866194bdd898b40c107f70b455b96856c854b6f458fad0a4001d14623e72c01d0313bb5b14c8b93a2a3451d3c30c8276c35631a616018dc9d88f WHIRLPOOL 723627517d94f1599ac914a05426810453514093dae1ea97bd1ac67433b510612d619f29a3fd9c4570beac151c219e99d2c6e659e13c0845364025715640037a
+AUX sancp.confd 382 SHA256 cc0794c0a65400e42351fb84aa706ab26eed0758c9ab71c5991bea24ef1f4577 SHA512 4ae33d655ca0a81a3bf71a382241bca90b1e58e121695041ef5210bd4abdcdbbc4385dfe673a4367898303ae64f9998453c95d2e71d8271ca322473ee61368df WHIRLPOOL c7fa87a45421850729d132eda6c828e8aad3fa34138ab679a254f618c72ca03bd44259557f8a931c89132df1136d1dcaee6b221767576987ba6e8f500c950aa3
+AUX sancp.rc1 859 SHA256 65af3fd4d32d9c5883b6c63c651afab3dc03b8883cff11be836e597e0f04e30d SHA512 16c713cf009d597c67981caa5f159b5597732c7f984fb9e91568d2956abdfdc2afb3ef6c35f8189dcca3e89757622c67c1fb67a9a6390851d0db118fd92efd0e WHIRLPOOL e215bab1257aa6e648ee0ae8ac1003efedddc4ff2baaadbad2500a77cd4757e189a7f6860292e9903988d5b2a539c86a6b3cde2fbd3bdb00db3098c34a4ea972
+AUX sguil_sancp.conf 2123 SHA256 b7d840a977f9bddd7aa6a7a541e0e69eac92c85d123778c76481e43da37b9ff6 SHA512 13a6b2573cc239328aabd6b582fcdd6b2102a4fd5380474ab5a3b85e5e4de6547c26aed888baf204e442dbe8be69c11422404c83ac0a2008cad8b6de542ac95e WHIRLPOOL 5333862640ba0982e32460b0ecba9528f1ec413487b9dec7261e37f535099e8bd89ccec02fd49f05ebdd5ef6e8ed35614d5d9a5732d4c4dff83a142c7f6fad43
+DIST sancp-1.6.1.fix200511.a.patch 662 SHA256 f80ea77873f03de40399c2c9247590829f02421d68758425cd139c48151eb13c SHA512 87662d9ea863a3a2468b7b64c81a191d34c81348eab9374245a73d3ed63cf2f25df54561f092f3713d516d9cc4eb553d4d7286fd920676a301e61669a023142e WHIRLPOOL b5881305d4dc85410fe00c23f5a923e4a41aaf570e0085035a6e9208ab55eb2cd3d99df0dff8a475c772ee332ea5ba1b3600d441f6914f4ceccb82d4b6f0def8
+DIST sancp-1.6.1.fix200511.b.patch 870 SHA256 0bbcf2797d689f9eaa46933262edc3badd644636fb8821832264bab454a870c0 SHA512 a54bbec1ce3799f83c006f7375297bafee85b12a90361f1f5dbbf46c936193c7e0f1196483a2bdf560019e93ceffe9129b3c01322eedc397e5dfa3a1a6b76b81 WHIRLPOOL d312e54489cfa9c073c6c499e56d1e24daa65d7d09558b291bc1de3b12249ca285c0ccb8c39eff03afe268f9f28db5427633f93df81c6c50f0f782cd7e04a352
+DIST sancp-1.6.1.fix200601.c.patch 3578 SHA256 38fe2e2db7419fb79c57b1e0505dbfda9958f56ab85259a84485111eb644880f SHA512 3d15028d33e7dbddc74d8c6eefac6d66e357f024dca15afdfb8156b0cf969ab093c26baa43ebf7c1ac88f4275ef4bdc91c1cc69c5aa7b439a042ed966edea30f WHIRLPOOL 20333f0f26a26ade0afc5f5fc332274e6522c2f4d36f0ea6579220349f3104c7eb3153b68ce79378e1fcd16c8c35ac927dfa29f619ac7fb7599a5400b8891747
+DIST sancp-1.6.1.fix200606.d.patch 6847 SHA256 1c62a44d75f3cd8b07445b02d9535f3eede3a60329bda111dd855c674e2745a9 SHA512 474a69052a2b9642fdc59e28c0237852d49b7b05445f0ffbbd2ea3f01b70a44e10ee49fba6294b413a53afe50271aaf88f979f8c479fb4b464b3ba5a70534276 WHIRLPOOL 9593161b57e153b3f25de9d958e57364a5fcdfa99bbdea183be3c25033a818de4724df2b5271d51fc64c78d17683c227afb691e871cd4804881e54921ab76107
+DIST sancp-1.6.1.tar.gz 69986 SHA256 58e487a4bd83716e90ff19d0d7fab352e28bbe143be60f4ee61c34d5fa6380a3 SHA512 41c6b35a2e7295d3b8185b9cc556c56b285cae7542c7ace78e663e54cef8d470bfa2ee083d9837fa34cf5ad1e7c325fb838b00e4f776f5662cade7d61e07145c WHIRLPOOL 8c0058ec1878e23cf3787fef318bfdc22bc301f9a898cccb7533954a7a587dab89147ca841f708d1bf27e986842ea5856c451678d76e4b0f1ee5ee507c726621
+EBUILD sancp-1.6.1-r4.ebuild 1712 SHA256 1b9d46184e2572b742786be3e5bbaf76dd2d48e956ecb2ebb29d3656aa1394bd SHA512 9ae4fdda34f9e2d4bf59e0c3eec641bdec84f7a468647b528ce5e3abda3ab3abacf7a287d80cee6fcdff285284a42a68e78bfed1460b574f70e218e8e6e5e525 WHIRLPOOL a29006274039a179f7820ba61bad633e752c992fabfc28dd214cb8ad1991621ba3edf81389620882d757684aed7f25e0715a41cdfcb143ccfa622a28c9465c13
+MISC ChangeLog 3182 SHA256 b8f52c1d53dd56f6c6d7a2772fa3fef0e40b26047ed808ae321e4330abcb0e89 SHA512 ccf514dcf2185d24ef866245ee1629ed099ed2804ed3a3226110fe95d19dd760285c60fd20ec06848dcaa9ad353a021aed4b69e6a5c90386094f28361d83160d WHIRLPOOL 7bc23a5344faddf3124ec48e1d6b8caef49ef6fc09b2cc3ebf4dcb14b6a0983af3466a0d2d987d5edeb7a137b91dde007be48134fca894bc35a4300866c6f314
+MISC ChangeLog-2015 2768 SHA256 75106476e6bb403c2249016838834a414f9541b18522573dbac720398742988e SHA512 73b5ba728fa1dee281aad1ff631f099655ebad0d6d56d7ff94fd772f79176e31c0c90a05df8a2ce283ef8991a572735ce613932a33b31ceadda6bf46d2f05ef9 WHIRLPOOL a690a6e8745b918aac3d22290451dd90a7da83b3be4fc5400ad938848d9453f47cb96160e490c5eaf4d3db6b2ea9632070a9735964bf0e9df6e0505ba49fe983
+MISC metadata.xml 473 SHA256 9727a78272160c20c6f21e385ffb8d65e659442de2a69dcc60236a1d341d7fb5 SHA512 3328fdd1dc68198464db9730005254454691ac8f4fbdd76dc09eb21c12f21fcd011ce7fb6cb1ce06262eb79fcc3c43abddd2314bdc64e2022fc8e5bb58360a85 WHIRLPOOL 17322647632febb92712c356eb659a6dd26917745e4e26853fb9716417ca3f3dc9ede47007ea677accce4b3347fadb503899f45da4da50500fbbc5ae6514bc63
diff --git a/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch b/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch
new file mode 100644
index 000000000000..d7816cbdd5de
--- /dev/null
+++ b/net-analyzer/sancp/files/sancp-1.6.1-compiler.patch
@@ -0,0 +1,45 @@
+--- a/Makefile 2004-01-19 23:04:56.000000000 +0100
++++ b/Makefile 2010-09-15 02:02:26.000000000 +0200
+@@ -1,26 +1,26 @@
+
+ # !!! Uncomment this CFLAGS for a small binary !!!
+-CFLAGS = -O3 -s -I/usr/include/pcap -L/usr/lib/libpcap.so.0.6.2
++CFLAGS += -I/usr/include/pcap -L/usr/lib/libpcap.so.0.6.2
+
+ # !!! or uncomment this CFLAGS for a large binary with symbols; use for debugging !!!
+ #CFLAGS = -O0 -g -I/usr/include/pcap -L/usr/lib/libpcap.so.0.6.2
+
+ final : sancp.cc Makefile
+- if [ ! -f build_acl.o -o build_acl.cc -nt build_acl.o ]; then g++ -Wall $(CFLAGS) -c build_acl.cc -o build_acl.o; fi
+- if [ ! -f misc_functs.o -o misc_functs.cc -nt misc_functs.o ]; then g++ -Wall $(CFLAGS) -c misc_functs.cc -o misc_functs.o; fi
+- if [ ! -f outputFileHandle.o -o outputFileHandle.cc -nt outputFileHandle.o ]; then g++ -Wall $(CFLAGS) -c outputFileHandle.cc -o outputFileHandle.o; fi
+- if [ ! -f apply_rule.o -o apply_rule.cc -nt apply_rule.o ]; then g++ -Wall $(CFLAGS) -c apply_rule.cc -o apply_rule.o; fi
+- if [ ! -f decode.o -o decode.cc -nt decode.o ]; then g++ -Wall $(CFLAGS) -c decode.cc -o decode.o; fi
+- if [ ! -f fileHandle.o -o fileHandle.cc -nt fileHandle.o ]; then g++ -Wall $(CFLAGS) -c fileHandle.cc -o fileHandle.o; fi
+- if [ ! -f MemoryPool.o -o MemoryPool.cc -nt MemoryPool.o ]; then g++ -Wall $(CFLAGS) -c MemoryPool.cc -o MemoryPool.o; fi
+- if [ ! -f pcapFileHandle.o -o pcapFileHandle.cc -nt pcapFileHandle.o ]; then g++ -Wall $(CFLAGS) -c pcapFileHandle.cc -o pcapFileHandle.o; fi
+- if [ ! -f sancp.o -o sancp.cc -nt sancp.o ]; then g++ -Wall $(CFLAGS) -c sancp.cc -o sancp.o; fi
+- if [ ! -f pcap_functions.o -o pcap_functions.c -nt pcap_functions.o ]; then gcc -Wall $(CFLAGS) -c pcap_functions.c -o pcap_functions.o; fi
+- if [ ! -f help.o -o help.cc -nt help.o ]; then g++ -Wall $(CFLAGS) -c help.cc -o help.o ; fi
+- if [ ! -f permissions.o -o permissions.cc -nt permissions.o ]; then g++ -Wall $(CFLAGS) -c permissions.cc -o permissions.o ; fi
+- if [ ! -f check_packet.o -o check_packet.cc -nt check_packet.o ]; then g++ -Wall $(CFLAGS) -c check_packet.cc -o check_packet.o; fi
+- if [ ! -f statefull_logging.o -o statefull_logging.cc -nt statefull_logging.o ]; then g++ -Wall $(CFLAGS) -c statefull_logging.cc -o statefull_logging.o ; fi
+- g++ -Wall $(CFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o help.o permissions.o outputFileHandle.o -lpcap
++ if [ ! -f build_acl.o -o build_acl.cc -nt build_acl.o ]; then $(CXX) -Wall $(CFLAGS) -c build_acl.cc -o build_acl.o; fi
++ if [ ! -f misc_functs.o -o misc_functs.cc -nt misc_functs.o ]; then $(CXX) -Wall $(CFLAGS) -c misc_functs.cc -o misc_functs.o; fi
++ if [ ! -f outputFileHandle.o -o outputFileHandle.cc -nt outputFileHandle.o ]; then $(CXX) -Wall $(CFLAGS) -c outputFileHandle.cc -o outputFileHandle.o; fi
++ if [ ! -f apply_rule.o -o apply_rule.cc -nt apply_rule.o ]; then $(CXX) -Wall $(CFLAGS) -c apply_rule.cc -o apply_rule.o; fi
++ if [ ! -f decode.o -o decode.cc -nt decode.o ]; then $(CXX) -Wall $(CFLAGS) -c decode.cc -o decode.o; fi
++ if [ ! -f fileHandle.o -o fileHandle.cc -nt fileHandle.o ]; then $(CXX) -Wall $(CFLAGS) -c fileHandle.cc -o fileHandle.o; fi
++ if [ ! -f MemoryPool.o -o MemoryPool.cc -nt MemoryPool.o ]; then $(CXX) -Wall $(CFLAGS) -c MemoryPool.cc -o MemoryPool.o; fi
++ if [ ! -f pcapFileHandle.o -o pcapFileHandle.cc -nt pcapFileHandle.o ]; then $(CXX) -Wall $(CFLAGS) -c pcapFileHandle.cc -o pcapFileHandle.o; fi
++ if [ ! -f sancp.o -o sancp.cc -nt sancp.o ]; then $(CXX) -Wall $(CFLAGS) -c sancp.cc -o sancp.o; fi
++ if [ ! -f pcap_functions.o -o pcap_functions.c -nt pcap_functions.o ]; then $(CC) -Wall $(CFLAGS) -c pcap_functions.c -o pcap_functions.o; fi
++ if [ ! -f help.o -o help.cc -nt help.o ]; then $(CXX) -Wall $(CFLAGS) -c help.cc -o help.o ; fi
++ if [ ! -f permissions.o -o permissions.cc -nt permissions.o ]; then $(CXX) -Wall $(CFLAGS) -c permissions.cc -o permissions.o ; fi
++ if [ ! -f check_packet.o -o check_packet.cc -nt check_packet.o ]; then $(CXX) -Wall $(CFLAGS) -c check_packet.cc -o check_packet.o; fi
++ if [ ! -f statefull_logging.o -o statefull_logging.cc -nt statefull_logging.o ]; then $(CXX) -Wall $(CFLAGS) -c statefull_logging.cc -o statefull_logging.o ; fi
++ $(CXX) -Wall $(CFLAGS) $(LDFLAGS) -o sancp sancp.o misc_functs.o check_packet.o statefull_logging.o build_acl.o apply_rule.o decode.o pcap_functions.o pcapFileHandle.o fileHandle.o MemoryPool.o help.o permissions.o outputFileHandle.o -lpcap
+
+ clean :
+ rm -f *.o sancp
diff --git a/net-analyzer/sancp/files/sancp-1.6.1-gcc6.patch b/net-analyzer/sancp/files/sancp-1.6.1-gcc6.patch
new file mode 100644
index 000000000000..e56d7114468e
--- /dev/null
+++ b/net-analyzer/sancp/files/sancp-1.6.1-gcc6.patch
@@ -0,0 +1,26 @@
+--- a/pcapFileHandle.h
++++ b/pcapFileHandle.h
+@@ -16,7 +16,12 @@
+
+ #define PCAP_HEADER_SIZE 24
+
+-const char pcap_header[] = { 0xd4,0xc3,0xb2,0xa1,0x02,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x4e,0x00,0x00,0x01,0x00,0x00,0x00 };
++const char pcap_header[] = {
++ (char) 0xd4,(char) 0xc3,(char) 0xb2,(char) 0xa1,(char) 0x02,(char) 0x00,
++ (char) 0x04,(char) 0x00,(char) 0x00,(char) 0x00,(char) 0x00,(char) 0x00,
++ (char) 0x00,(char) 0x00,(char) 0x00,(char) 0x00,(char) 0x20,(char) 0x4e,
++ (char) 0x00,(char) 0x00,(char) 0x01,(char) 0x00,(char) 0x00,(char) 0x00
++};
+
+ class pcapFileHandle : public fileHandle {
+
+--- a/sancp.h
++++ b/sancp.h
+@@ -223,7 +223,6 @@
+ #define R_URG 0x20
+ #define R_RES2 0x40
+ #define R_RES1 0x80
+-#define max(i,j) (((i)>(j)) ? (i) : (j))
+ #define SIZE_OF_CLASS_C 11
+
+ struct t_ports {
diff --git a/net-analyzer/sancp/files/sancp.confd b/net-analyzer/sancp/files/sancp.confd
new file mode 100644
index 000000000000..31cbef82ec1b
--- /dev/null
+++ b/net-analyzer/sancp/files/sancp.confd
@@ -0,0 +1,15 @@
+# Config file for /etc/init.d/sancp
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Interface to listen on
+IFACE="eth0"
+
+# Directory to log in
+LOGDIR="/var/log/sancp"
+
+# Default config file
+CONF="/etc/sancp/sancp.conf"
+
+# You could add more options :)
+SANCP_OPTS="-d $LOGDIR/today -i $IFACE -c $CONF -u sancp -g sancp"
diff --git a/net-analyzer/sancp/files/sancp.rc1 b/net-analyzer/sancp/files/sancp.rc1
new file mode 100644
index 000000000000..07745f675676
--- /dev/null
+++ b/net-analyzer/sancp/files/sancp.rc1
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+today=$(date '+%Y-%m-%d')
+
+depend() {
+ need net
+}
+checkconfig() {
+ if [ ! -e /etc/sancp/sancp.conf ] ; then
+ eerror "You need an /etc/sancp/sancp.conf to run sancp"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ # Today's log directory
+ if [ ! -d $LOGDIR/$today ]; then
+ /bin/mkdir $LOGDIR/$today
+ /bin/rm -f $LOGDIR/today
+ fi
+
+ # today/ directory :)
+ if [ ! -d $LOGDIR/today ]; then
+ /bin/ln -s $LOGDIR/$today $LOGDIR/today
+ fi
+
+ ebegin "Starting sancp"
+ start-stop-daemon --start --quiet -m --pidfile /var/run/sancp.pid \
+ --exec /usr/bin/sancp \
+ -- ${SANCP_OPTS} > /var/log/sancp.log 2>&1 &
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping sancp"
+ start-stop-daemon --stop --quiet --pidfile /var/run/sancp.pid
+ eend $?
+}
diff --git a/net-analyzer/sancp/files/sguil_sancp.conf b/net-analyzer/sancp/files/sguil_sancp.conf
new file mode 100644
index 000000000000..f559286e7bb3
--- /dev/null
+++ b/net-analyzer/sancp/files/sguil_sancp.conf
@@ -0,0 +1,69 @@
+# $Id: sancp.conf,v 1.1 2004/03/19 20:33:59 bamm Exp $ #
+#
+# This sancp.conf is distributed as part of sguil (http://sguil.sf.net).
+# It's purpose is to define a default output that is compatible with table
+# schema defined by sguil. Please read the README.sancp for more information
+#
+# sancp is copyrighted by John Curry and can be downloaded at:
+# www.metre.net/sancp.html
+#
+
+# SANCP VERSION 1.5.3
+
+# Currently, sguil only supports the 'stats' output and we want it in
+# timestamped fields
+default stats tsfilename stats
+
+# Time in seconds we write a new file if expired cnxs are available
+default flush_interval=30
+# This tells sancp to open new file handle, write, and close in one step
+default burst_mode=enable
+
+# Default timeout: how many secs to wait after the last packet till we consider the cnx closed
+default timeout=120
+
+# Conforms with out sguil sancp table schema
+format stats sancp_id,start_time_gmt,stop_time_gmt,duration,ip_proto,src_ip_decimal,src_port,dst_ip_decimal,dst_port,src_pkts,src_bytes,dst_pkts,dst_bytes,sflags,dflags
+
+# From here on you define what stats/cnxs/sessions/flows (whatever you
+# want to call it) get logged. Please read the sancp documention for
+# more information. Most of the below are examples of setting
+# variables for complex rules.
+
+var ip 8 # ether proto 0x0800 # ip traffic
+
+# define some ip protocols
+
+var icmp 1
+var tcp 6
+var udp 17
+
+# define some tcp protocols
+
+var http 80
+var https 443
+var smtp 25
+var dns 53
+
+var HOME_NET 127.0.0.1
+#var WWW_NET 192.168.1.0/24
+#var MAIL_SERVER 192.168.1.2
+#var MAIL_SERVER2 192.168.1.3
+
+
+# Default output logging for each connection
+# We don't use realtime or pcap logging at this point so we pass them
+default realtime=pass
+default pcap=pass
+
+# Here is where our "rules" start. We log all stats by default
+# so this is defining exceptions.
+#
+# first six fields are required before rule options can be used
+#
+# eth_proto src_ip dst_ip ip_proto src_port dst_port
+#
+
+# Here is an example if ignoring outbound HTTP stats.
+#ip HOME_NET any tcp any http, stats pass
+#ip HOME_NET any tcp any https, stats pass
diff --git a/net-analyzer/sancp/metadata.xml b/net-analyzer/sancp/metadata.xml
new file mode 100644
index 000000000000..3f2ab8cd615e
--- /dev/null
+++ b/net-analyzer/sancp/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>netmon@gentoo.org</email>
+ <name>Gentoo network monitoring and analysis project</name>
+ </maintainer>
+ <use>
+ <flag name="sguil">Enable sguil (The Analyst Console for Network Security Monitoring) support</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">sancp</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/net-analyzer/sancp/sancp-1.6.1-r4.ebuild b/net-analyzer/sancp/sancp-1.6.1-r4.ebuild
new file mode 100644
index 000000000000..4f1bfd0b4e9f
--- /dev/null
+++ b/net-analyzer/sancp/sancp-1.6.1-r4.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs user
+
+DESCRIPTION="collect network traffic statistics and store them in pcap format"
+HOMEPAGE="http://www.metre.net/sancp.html"
+SRC_URI="
+ http://www.metre.net/files/${P}.tar.gz
+ http://sancp.sourceforge.net/${PN}-1.6.1.fix200511.a.patch
+ http://sancp.sourceforge.net/${PN}-1.6.1.fix200511.b.patch
+ http://sancp.sourceforge.net/${PN}-1.6.1.fix200601.c.patch
+ http://sancp.sourceforge.net/${PN}-1.6.1.fix200606.d.patch
+"
+
+LICENSE="QPL GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="sguil"
+
+RDEPEND="net-libs/libpcap"
+DEPEND="${RDEPEND}"
+
+pkg_setup() {
+ enewgroup sancp
+ enewuser sancp -1 -1 /dev/null sancp
+}
+
+src_prepare() {
+ epatch "${DISTDIR}"/${PN}-1.6.1.fix200511.a.patch
+ epatch "${DISTDIR}"/${PN}-1.6.1.fix200511.b.patch
+ # bug 138337
+ epatch "${DISTDIR}"/${PN}-1.6.1.fix200601.c.patch
+ epatch "${DISTDIR}"/${PN}-1.6.1.fix200606.d.patch
+ epatch "${FILESDIR}"/${P}-compiler.patch
+ epatch "${FILESDIR}"/${P}-gcc6.patch
+
+ tc-export CXX CC
+}
+
+src_install() {
+ keepdir /var/log/sancp/
+ dodoc docs/CHANGES docs/fields.LIST docs/README docs/SETUP \
+ "${FILESDIR}"/sguil_sancp.conf etc/sancp/sancp.conf
+
+ insinto /etc/sancp
+ if use sguil ; then
+ newins "${FILESDIR}"/sguil_sancp.conf sancp.conf
+ else
+ doins etc/sancp/sancp.conf
+ fi
+
+ dobin sancp
+
+ newinitd "${FILESDIR}"/sancp.rc1 sancp
+ newconfd "${FILESDIR}"/sancp.confd sancp
+ if use sguil ; then
+ sed -i -e /^SANCP_OPTS/s:'sancp':"sguil":g \
+ -e s:'-d $LOGDIR/today':"-d /var/lib/sguil/$(hostname)/sancp": \
+ "${D}/etc/conf.d/sancp"
+ fi
+
+ fowners sancp:sancp /var/log/sancp
+ fperms 0770 /var/log/sancp
+}