ports/100601: New port: py-pypcap A Python Module for PCAP Access

George V. Neville-Neil gnn at FreeBSD.org
Thu Jul 20 09:30:10 UTC 2006


>Number:         100601
>Category:       ports
>Synopsis:       New port: py-pypcap A Python Module for PCAP Access
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 20 09:30:09 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     George V. Neville-Neil
>Release:        
>Organization:
Neville-Neil Consulting
>Environment:
>Description:
There are several of these, but this one is the best that I've found.  A fully
functional interface to PCAP from within Python.  This is used in another new
port, PCS, which I also submitted.
xccat
>How-To-Repeat:

>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	py-pypcap
#	py-pypcap/Makefile
#	py-pypcap/files
#	py-pypcap/files/patch-pcap.pyx
#	py-pypcap/pkg-descr
#	py-pypcap/distinfo
#	py-pypcap/pkg-plist
#
echo c - py-pypcap
mkdir -p py-pypcap > /dev/null 2>&1
echo x - py-pypcap/Makefile
sed 's/^X//' >py-pypcap/Makefile << 'END-of-py-pypcap/Makefile'
X# New ports collection makefile for:	py-pypcap
X# Date created:		15 Jul 2006
X# Whom:			George V. Neville-Neil
X#
X# $FreeBSD$
X#
X
XPORTNAME=	pypcap
XPORTVERSION=	1.1
XCATEGORIES=	net python
XMASTER_SITES=	http://monkey.org/~dugsong/pypcap/
XPKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
X
XMAINTAINER=	gnn at freebsd.org
XCOMMENT=	Simplified object-oriented Python extension module for libpcap
X
XBUILD_DEPENDS=	pyrexc:${PORTSDIR}/devel/pyrex
X
XUSE_PYTHON=	yes
XUSE_PYTHON_PREFIX=	yes
X
Xpost-patch:
X	${RM} ${WRKDIR}/${PORTNAME}-${PORTVERSION}/pcap.c
X.include <bsd.port.mk>
END-of-py-pypcap/Makefile
echo c - py-pypcap/files
mkdir -p py-pypcap/files > /dev/null 2>&1
echo x - py-pypcap/files/patch-pcap.pyx
sed 's/^X//' >py-pypcap/files/patch-pcap.pyx << 'END-of-py-pypcap/files/patch-pcap.pyx'
X*** pcap.pyx	Mon Oct 17 08:00:11 2005
X--- /Users/gnn/src/pypcap-1.1.new/pcap.pyx	Fri Jun 23 18:22:03 2006
X***************
X*** 61,66 ****
X--- 64,70 ----
X      int     pcap_stats(pcap_t *p, pcap_stat *ps)
X      char   *pcap_geterr(pcap_t *p)
X      void    pcap_close(pcap_t *p)
X+     int     pcap_inject(pcap_t *p, char *buf, int size)
X      int     bpf_filter(bpf_insn *insns, char *buf, int len, int caplen)
X  
X  cdef extern from "pcap_ex.h":
X***************
X*** 313,318 ****
X--- 318,338 ----
X              elif n == -2:
X                  break
X      
X+     def inject(self, packet, len):
X+         """Inject a packet onto an interface.
X+         May or may not work depending on platform.
X+ 
X+         Arguments:
X+ 
X+         packet -- a pointer to the packet in memory
X+         """
X+         cdef int n
X+         n = pcap_inject(self.__pcap, packet, len)
X+         if (n < 0):
X+             raise OSError, pcap_geterr(self.__pcap)
X+ 
X+         return n
X+     
X      def geterr(self):
X          """Return the last error message associated with this handle."""
X          return pcap_geterr(self.__pcap)
END-of-py-pypcap/files/patch-pcap.pyx
echo x - py-pypcap/pkg-descr
sed 's/^X//' >py-pypcap/pkg-descr << 'END-of-py-pypcap/pkg-descr'
XA simplified object-oriented Python extension module for libpcap 
X
XWWW: http://monkey.org/~dugsong/pypcap/
END-of-py-pypcap/pkg-descr
echo x - py-pypcap/distinfo
sed 's/^X//' >py-pypcap/distinfo << 'END-of-py-pypcap/distinfo'
XMD5 (pypcap-1.1.tar.gz) = 034c3cbbfa81aa19e8f685b767c65764
XSHA256 (pypcap-1.1.tar.gz) = 087677295c795f543fad2c286df1807d55876e85d04f7292335cd149f4d8d47f
XSIZE (pypcap-1.1.tar.gz) = 22951
END-of-py-pypcap/distinfo
echo x - py-pypcap/pkg-plist
sed 's/^X//' >py-pypcap/pkg-plist << 'END-of-py-pypcap/pkg-plist'
Xlib/python2.4/site-packages/pcap.so
END-of-py-pypcap/pkg-plist
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list