1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-03 06:04:53 +00:00

Update to 3.03b.

Switch to using PLIST_FILES and PORTDOCS.
No longer require gmake.
Don't require bash (build.sh).

PR:		ports/166224 (based upon)
Submitted by:	Kurt Jaeger <fbsd-ports@opsec.eu>
Feature safe:	yes
This commit is contained in:
Wesley Shields 2012-03-19 01:19:52 +00:00
parent 798cb0c68f
commit 97ddcf58ff
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=293546
7 changed files with 125 additions and 94 deletions

View File

@ -6,42 +6,33 @@
#
PORTNAME= p0f
PORTVERSION= 2.0.8
PORTVERSION= 3.03b
PORTREVISION= 1
CATEGORIES= net-mgmt security
MASTER_SITES= http://lcamtuf.coredump.cx/p0f/ \
http://farrokhi.net/distfiles/
MASTER_SITES= http://lcamtuf.coredump.cx/p0f3/releases/
EXTRACT_SUFX= .tgz
MAINTAINER= ports@FreeBSD.org
MAINTAINER= wxs@FreeBSD.org
COMMENT= Passive OS fingerprinting tool
USE_GMAKE= yes
ALL_TARGET= all p0fq tools
PORTDOCS= COPYING CREDITS ChangeLog KNOWN_BUGS README TODO win-memleak.txt
MAN1= p0f.1
WRKSRC= ${WRKDIR}/${PORTNAME}
PLIST_FILES= bin/p0f bin/p0f-client bin/p0f-sendsyn \
bin/p0f-sendsyn6 etc/p0f.fp
PORTDOCS= COPYING ChangeLog README TODO existential-notes.txt extra-sigs.txt
post-patch:
.for f in config.h doc/README
@${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/${f}
.endfor
@${REINPLACE_CMD} -e 's|/etc|${PREFIX}/etc|g' ${WRKSRC}/README
@${REINPLACE_CMD} -e 's|p0f.fp|${PREFIX}/etc/p0f.fp|g' ${WRKSRC}/config.h
do-install:
.for ii in p0f test/p0fq test/sendack test/sendack2 test/sendsyn
.for ii in p0f tools/p0f-client tools/p0f-sendsyn tools/p0f-sendsyn6
${INSTALL_PROGRAM} ${WRKSRC}/${ii} ${PREFIX}/bin
.endfor
${INSTALL_SCRIPT} ${WRKSRC}/p0frep ${PREFIX}/bin
${MKDIR} ${PREFIX}/etc/p0f
.for ii in . a. o. r.
${INSTALL_DATA} ${WRKSRC}/p0f${ii}fp ${PREFIX}/etc/p0f
.endfor
${INSTALL_MAN} ${WRKSRC}/${MAN1} ${MANPREFIX}/man/man1
${INSTALL_DATA} ${WRKSRC}/p0f.fp ${PREFIX}/etc/
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
.for ii in ${PORTDOCS}
${INSTALL_DATA} ${WRKSRC}/doc/${ii} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/docs/${ii} ${DOCSDIR}
.endfor
.endif

View File

@ -1,2 +1,2 @@
SHA256 (p0f-2.0.8.tgz) = 6c4d8745f04e59f2ba68d56fd1554551592f08a0497c9fc21b84498f47d1aee0
SIZE (p0f-2.0.8.tgz) = 136877
SHA256 (p0f-3.03b.tgz) = b0d4f8a043d49c5f219be268c6cb10fe1a4eebc42a60843124e1e11bae16d8eb
SIZE (p0f-3.03b.tgz) = 91707

View File

@ -0,0 +1,91 @@
--- build.sh.orig 2012-01-18 18:50:23.000000000 -0500
+++ build.sh 2012-03-18 20:45:51.836691332 -0400
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# p0f - build script
# ------------------
@@ -154,7 +154,7 @@
rm -f "$TMP" || exit 1
echo "int main() { return 0; }" >"$TMP.c" || exit 1
-$CC $BASIC_CFLAGS $BASIC_LDFLAGS "$TMP.c" -o "$TMP" &>"$TMP.log"
+$CC $BASIC_CFLAGS $BASIC_LDFLAGS "$TMP.c" -o "$TMP" >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
@@ -179,7 +179,7 @@
rm -f "$TMP" "$TMP.c" "$TMP.log" || exit 1
echo "int main() { return 0; }" >"$TMP.c" || exit 1
-$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" &>"$TMP.log"
+$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
@@ -198,7 +198,7 @@
rm -f "$TMP" "$TMP.c" "$TMP.log" || exit 1
echo -e "#include \"types.h\"\nvolatile u8 tmp[6]; int main() { printf(\"%d\x5cn\", *(u32*)(tmp+1)); return 0; }" >"$TMP.c" || exit 1
-$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" &>"$TMP.log"
+$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
@@ -215,8 +215,8 @@
else
- ulimit -c 0 &>/dev/null
- ./"$TMP" &>/dev/null
+ ulimit -c 0 >/dev/null 2>&1
+ ./"$TMP" >/dev/null 2>&1
if [ "$?" = "0" ]; then
@@ -237,7 +237,7 @@
rm -f "$TMP" "$TMP.c" "$TMP.log" || exit 1
echo -e "#include <pcap.h>\nint main() { char i[PCAP_ERRBUF_SIZE]; pcap_lookupdev(i); return 0; }" >"$TMP.c" || exit 1
-$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS &>"$TMP.log"
+$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
echo "FAIL"
@@ -282,14 +282,14 @@
rm -f "$TMP" "$TMP.c" "$TMP.log" || exit 1
echo -e "#include <pcap.h>\n#include <pcap-bpf.h>\nint main() { return 0; }" >"$TMP.c" || exit 1
-$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS &>"$TMP.log"
+$CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
rm -f "$TMP" "$TMP.c" "$TMP.log" || exit 1
echo -e "#include <pcap.h>\n#include <net/bpf.h>\nint main() { return 0; }" >"$TMP.c" || exit 1
- $CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS &>"$TMP.log"
+ $CC $USE_CFLAGS $USE_LDFLAGS "$TMP.c" -o "$TMP" $USE_LIBS >"$TMP.log" 2>&1
if [ ! -x "$TMP" ]; then
echo "FAIL"
@@ -318,7 +318,7 @@
rm -f "$PROGNAME" || exit 1
-$CC $USE_CFLAGS $USE_LDFLAGS "$PROGNAME.c" $OBJFILES -o "$PROGNAME" $USE_LIBS &>"$TMP.log"
+$CC $USE_CFLAGS $USE_LDFLAGS "$PROGNAME.c" $OBJFILES -o "$PROGNAME" $USE_LIBS >"$TMP.log" 2>&1
if [ ! -x "$PROGNAME" ]; then
@@ -349,6 +349,9 @@
fi
+echo "[*] Compiling tools: "
+cd tools && make
+
echo
echo "Well, that's it. Be sure to review README. If you run into any problems, you"
echo "can reach the author at <lcamtuf@coredump.cx>."

View File

@ -1,19 +0,0 @@
--- mk/FreeBSD.orig Thu Mar 16 07:43:17 2006
+++ mk/FreeBSD Thu Mar 23 10:54:37 2006
@@ -7,12 +7,12 @@
# (C) Copyright 2000-2006 by Michal Zalewski <lcamtuf@coredump.cx>
#
-CC = gcc
+LOCALBASE ?= /usr/local
+CC ?= gcc
LIBS = -lpcap
STRIP = strip
-CFLAGS = -O3 -Wall -fomit-frame-pointer -funroll-loops \
- -DUSE_BPF=\"${USE_BPF}\" \
- -I/usr/include/pcap -I/usr/local/include/pcap -I/usr/local/include
+CFLAGS += -DUSE_BPF=\"${USE_BPF}\" \
+ -I/usr/include/pcap -I${LOCALBASE}/include/pcap -I${LOCALBASE}/include
FILE = p0f
TOOLS = test/sendack test/sendack2 test/sendsyn

View File

@ -1,42 +0,0 @@
--- p0f.c.orig 2006-08-21 10:16:00.000000000 -0400
+++ p0f.c 2012-01-06 15:46:38.918380578 -0500
@@ -212,8 +212,11 @@
#endif
#ifdef DLT_PFLOG
+#include <net/if.h>
+#include <sys/queue.h>
+#include <net/if_pflog.h>
case DLT_PFLOG:
- header_len=28;
+ header_len=PFLOG_HDRLEN;
break;
#endif
@@ -1281,11 +1284,15 @@
/* Whoops, IP header ends past end_ptr */
if ((_u8*)(iph + 1) > end_ptr) return;
- if ( ((iph->ihl & 0x40) != 0x40) || iph->proto != IPPROTO_TCP) {
- debug("[!] WARNING: Non-IP packet received. Bad header_len!\n");
+ if ( iph->proto != IPPROTO_TCP) {
+ debug("[!] WARNING: Non-IP packet received.\n");
return;
}
+ if ( ((iph->ihl & 0x40) != 0x40) ) {
+ debug("[!] WARNING: Bad header_len!\n");
+ return;
+ }
/* If the declared length is shorter than the snapshot (etherleak
or such), truncate this bad boy. */
@@ -1699,7 +1706,7 @@
if (!use_iface) use_iface=pcap_lookupdev(errbuf);
#endif /* ^WIN32 */
- if (!use_iface) use_iface = "lo";
+ if (!use_iface) use_iface = "lo0";
/* We do not rely on pcap timeouts - they suck really bad. Of
course, the documentation sucks, and if you use the timeout

View File

@ -0,0 +1,21 @@
--- process.c.orig 2012-01-16 22:43:57.000000000 -0500
+++ process.c 2012-03-18 16:01:24.966689978 -0400
@@ -22,6 +22,9 @@
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/stat.h>
+#include <net/if.h>
+#include <net/pfvar.h>
+#include <net/if_pflog.h>
#include "types.h"
#include "config.h"
@@ -106,7 +109,7 @@
case DLT_LINUX_SLL: link_off = 16; return;
#endif /* DLT_LINUX_SLL */
- case DLT_PFLOG: link_off = 28; return;
+ case DLT_PFLOG: link_off = PFLOG_HDRLEN; return;
case DLT_IEEE802_11: link_off = 32; return;
}

View File

@ -1,11 +0,0 @@
bin/p0f
bin/p0frep
bin/p0fq
bin/sendack
bin/sendack2
bin/sendsyn
etc/p0f/p0f.fp
etc/p0f/p0fa.fp
etc/p0f/p0fo.fp
etc/p0f/p0fr.fp
@dirrm etc/p0f