--- ngrep-1.45.ds2.orig/debian/repack.sh +++ ngrep-1.45.ds2/debian/repack.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +_usage() +{ + printf "usage: %s \n" `basename $0` + exit 1 +} + +if [ $# -ne 1 ]; then + _usage +else + TARFILE="$1" +fi + +DIR=$(tar tf $TARFILE | cut -d/ -f1 | tail -1) +tar xf $TARFILE +rm -rf $DIR/pcre-* $DIR/regex-* $DIR/win32 +tar cvvzf $DIR.tar.gz $DIR --- ngrep-1.45.ds2.orig/debian/docs +++ ngrep-1.45.ds2/debian/docs @@ -0,0 +1,3 @@ +doc/README.txt +doc/CREDITS.txt +doc/REGEX.txt --- ngrep-1.45.ds2.orig/debian/control +++ ngrep-1.45.ds2/debian/control @@ -0,0 +1,22 @@ +Source: ngrep +Section: net +Priority: optional +Maintainer: Romain Francoise +Build-Depends: debhelper (>> 5.0.0), libpcap0.8-dev, libpcre3-dev, autotools-dev, quilt (>= 0.40), libnet1-dev +Standards-Version: 3.7.3 +Homepage: http://ngrep.sf.net/ +Vcs-Browser: http://git.debian.org/?p=users/rfrancoise/ngrep.git +Vcs-Git: git://git.debian.org/git/users/rfrancoise/ngrep.git + +Package: ngrep +Architecture: any +Depends: ${shlibs:Depends} +Description: grep for network traffic + ngrep strives to provide most of GNU grep's common features, + applying them to the network layer. ngrep is a pcap-aware tool that + will allow you to specify extended regular expressions to match + against data payloads of packets. It currently recognizes TCP, UDP + and ICMP across Ethernet, PPP, SLIP and null interfaces, and + understands bpf filter logic in the same fashion as more common + packet sniffing tools, such as tcpdump and snoop. + --- ngrep-1.45.ds2.orig/debian/changelog +++ ngrep-1.45.ds2/debian/changelog @@ -0,0 +1,219 @@ +ngrep (1.45.ds2-2) unstable; urgency=low + + * debian/rules: Bump Standards-Version to 3.7.3; no changes needed. + + -- Romain Francoise Fri, 11 Apr 2008 19:26:31 +0200 + +ngrep (1.45.ds2-1) unstable; urgency=low + + * Repack tarball from Git. + * debian/control: Add Homepage, Vcs-Browser and Vcs-Git fields. + + -- Romain Francoise Fri, 12 Oct 2007 20:11:58 +0200 + +ngrep (1.45.ds1-2) unstable; urgency=low + + * debian/patches/10_debian-build.diff: Don't strip the binary by default + at link time, let dh_strip do it (closes: #437633). + + * debian/patches/30_tcpkill.diff: New patch adding the ability to kill + matching TCP connections. Based on a patch by Florian Weimer, ported + to libnet 1.1 (closes: #240054). + * debian/patches/series: Update. + + * debian/repack.sh: Include this script in the package, just in case. + + -- Romain Francoise Mon, 13 Aug 2007 22:35:24 +0200 + +ngrep (1.45.ds1-1) unstable; urgency=low + + * New upstream release (closes: #412181), the .tar.bz2 upstream tarball + was repacked into a .tar.gz tarball, removing the pcre-5.0, regex-0.12 + and win32 directories in the process. + + * debian/patches/10_debian-build.diff: New patch redoing Debian changes + to use the system's version of PCRE. + * debian/patches/20_setlocale.diff: New patch, fold Debian change to set + the locale for isprint() (see #307496). + * debian/patches/50_autotools-dev.diff: New patch, make + config.{guess,sub} use autotools-dev's fresher versions automatically. + * debian/patches/series: New file. + * debian/rules: + + Don't copy config.{guess,sub} in clean target. + + Don't ignore errors from 'make distclean'. + + Include /usr/share/quilt/quilt.make and call its targets. + + Various cleanups. + * debian/control: Add build-depends on quilt. + + -- Romain Francoise Sun, 12 Aug 2007 21:20:11 +0200 + +ngrep (1.44-3) unstable; urgency=low + + * Backport patch from upstream CVS making the `clean_exit' signal + handler safer (closes: #395248). + + -- Romain Francoise Sat, 4 Nov 2006 15:54:58 +0100 + +ngrep (1.44-2) unstable; urgency=low + + * debian/control: + + Set myself as maintainer, not just uploader. + + Bump Standards-Version to 3.7.2, no changed needed. + + Build-Depend on debhelper (>> 5.0.0). + * debian/compat: New file. + * debian/rules: Don't set DH_COMPAT. + + -- Romain Francoise Wed, 27 Sep 2006 12:20:20 +0200 + +ngrep (1.44-1) unstable; urgency=low + + * New upstream release, with support for IPv6 (closes: #282362). + * debian/rules: Add --enable-ipv6 to configure flags. + + * Apply patch from Max Kosmach adding a call to + setlocale(), which makes isprint() decide what's printable depending + on the current locale (closes: #307496). + + * debian/control: Bump Standards-Version to 3.6.2.1, no changed needed. + + -- Romain Francoise Tue, 5 Jul 2005 20:24:07 +0200 + +ngrep (1.43-3) unstable; urgency=medium + + * Further cleanup the build process to get rid of the shipped pcre + library: + + Patch ngrep.c to use instead of the header in pcre-5.0. + + Patch configure to skip the pcre configure stage. + + Patch Makefile.in to not try to clean the pcre-5.0 directory. + * debian/rules: Cleanups. + + Remove obsolete deletion command from clean target (useless since + 1.43-1). + + Remove dh-make comments, cut lines to fit in 80 columns, credit + Nathan, Steve and myself. + * debian/control: Cosmetic change. + + -- Romain Francoise Fri, 25 Mar 2005 16:39:16 +0100 + +ngrep (1.43-2) unstable; urgency=low + + * Patch Makefile.in to not build (and link) the package's pcre since we + want to use the system's version (it will still be configured but at + least the binary will remain untouched). + * debian/control: Remove obsolete local variables. + + -- Romain Francoise Tue, 22 Mar 2005 20:27:31 +0100 + +ngrep (1.43-1) unstable; urgency=medium + + * Hijacked package, new maintainer: + http://lists.debian.org/debian-qa/2005/03/msg00059.html + * Added Romain Francoise as a co-maintainer. + * Build depend upon autotools-dev, so that we can copy in the most + recent config.{sub guess} files. + (Closes: #135337, #168649) + * Rebuilt against libpcap, which closes the bug fixed in the + old NMU (Now using libpcap0.8 instead of 0.7) (Closes: #156178) + * Use the system's installed copy of PCRE instead of the bundled + copy. (Closes: #166783) + * Removed the duplicate '-F' option from the manpage. + (Closes: #293728) + * New upstream version + Some previously broken code is now removed from the upstream + version so some older bugs no longer exist. + They will be closed individually as part of a bug triage. + + -- Steve Kemp Mon, 14 Mar 2005 16:15:39 +0000 + +ngrep (1.42-1) unstable; urgency=low + + * New Upstream Version (closes: #243613) + * Changed manpage to use minus signs (\-) instead of hyphens (-) + (closes: #207279) + * Updated libtool script (closes: #201948) + + -- Nathan Sandver Sat, 07 Aug 2004 12:54:33 -0700 + +ngrep (1.40.1-3) unstable; urgency=low + + * Maintainer upload to resolve some outstanding issues with the package. + Thanks to Samuele, Robert, Torsten, and Randolph for working on the + package when I was inactive. + * Updated config.guess, config.sub (closes: Bug#168649) + * Links dynamically against Debian's libpcre (closes: Bug#166783) + + -- Nathan E. Sandver Sat, 30 Nov 2002 01:23:43 -0800 + +ngrep (1.40.1-2.4) unstable; urgency=low + + * NMU + * recompiled against libpcap0.7 (closes: Bug#156178) + + -- Samuele Giovanni Tonon Wed, 6 Nov 2002 23:31:47 +0100 + +ngrep (1.40.1-2.3) unstable; urgency=low + + * NMU + * ngrep is not supposed to be a debian-native package - redownloaded + pristine upstream source and fixed that + * Applied patch to copy libpcap packet buffers to aligned positions to + avoid segfaults on architectures where that matters (like Sparc) + closes: #138847 + * Clean up stray pcre-3.4/dftables executable in clean target to allow + for repeated package building + + -- Robert Woodcock Sun, 27 Oct 2002 15:49:33 -0800 + +ngrep (1.40.1-2.2) unstable; urgency=low + + * Non maintainer upload + * Rebuilt with new libpcap to remove dependency on libpcap0, which I + got removed from unstable by accident. Sorry about this... + + -- Torsten Landschoff Sat, 10 Aug 2002 11:37:22 +0200 + +ngrep (1.40.1-2.1) unstable; urgency=low + + * NMU + * Update config.guess/sub. (closes: Bug#135337) + + -- Randolph Chung Tue, 12 Mar 2002 22:55:28 -0800 + +ngrep (1.40.1-2) unstable; urgency=low + + * Bitten by outdated config.sub & config.guess in included pcre source + again. Updated both files. (closes: Bug#133308) + + -- Nathan Sandver Mon, 18 Feb 2002 14:12:53 -0800 + +ngrep (1.40.1-1) unstable; urgency=low + + * New upstream version. + + -- Nathan Sandver Sat, 9 Feb 2002 18:42:30 -0800 + +ngrep (1.40-1) unstable; urgency=low + + * New upstream release + * Updated config.sub & config.guess. (Closes #111406) + + -- Nathan Sandver Thu, 25 Oct 2001 21:54:41 -0700 + +ngrep (1.39.2-2) unstable; urgency=low + + * Added Build-depends: libpcap-dev + + -- Nathan Sandver Thu, 5 Jul 2001 17:01:55 -0700 + +ngrep (1.39.2-1) unstable; urgency=low + + * New upstream version + * Using PCRE for regular expressions support + + -- Nathan Sandver Sat, 26 May 2001 13:12:54 -0700 + +ngrep (1.35-1) unstable; urgency=low + + * Initial Release. + + -- Nathan E. Sandver Thu, 28 Oct 1999 18:39:00 -0700 + --- ngrep-1.45.ds2.orig/debian/compat +++ ngrep-1.45.ds2/debian/compat @@ -0,0 +1 @@ +5 --- ngrep-1.45.ds2.orig/debian/README.Debian +++ ngrep-1.45.ds2/debian/README.Debian @@ -0,0 +1,20 @@ +ngrep for Debian +---------------- + +ngrep is now compiled against the Perl-Compatible Regular Expressions library +instead of the GNU regex library. According to the FSF's website +(http://www.gnu.org/), the original BSD license which included the advertising +clause is not compatible with the GPL. As ngrep's license is modeled after +the original BSD license and includes the advertising clause, I have decided +to compile against PCRE, which is under a less restrictive license. + + Regular expression support is provided by the PCRE library package, + which is open source software, written by Philip Hazel, and copyright + by the University of Cambridge, England. + +Also as required by the ngrep license, this statement declares that the +original source distribution has been modified for Debian. I have made +changes to ensure that the package builds and installs in accordance with +Debian policy. + + -- Nathan Sandver , Sat, 07 Aug 2004 11:18:00 -0800 --- ngrep-1.45.ds2.orig/debian/dirs +++ ngrep-1.45.ds2/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/man/man8 +usr/share/doc --- ngrep-1.45.ds2.orig/debian/copyright +++ ngrep-1.45.ds2/debian/copyright @@ -0,0 +1,76 @@ +This package was debianized by Nathan Sandver on +Sat, 26 May 2001 12:42:54 -0700. + +It was downloaded from: http://ngrep.sourceforge.net + +Upstream Author: Jordan Ritter + +Copyright: + +Copyright (c) 2006 Jordan Ritter. All rights reserved. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The origin of this software must not be misrepresented, either by + explicit claim or by omission. + +2. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Any altered version + must clearly and properly represent the origin of this software in + any accompanying documentation. + +3. All advertising materials which relate specifically to derivate + works of this software must display the following acknowledgement: + This product includes software developed by Jordan Ritter. + +4. The name of the Author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +5. This notice, and any references to this notice, in any original or + derived source distribution of or documentation for this software, + may not be removed or altered. + + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Portions were copied from tcpkill (part of dsniff), which has the +following copyright: + + Copyright (c) 1999, 2000 Dug Song + All rights reserved, all wrongs reversed. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --- ngrep-1.45.ds2.orig/debian/rules +++ ngrep-1.45.ds2/debian/rules @@ -0,0 +1,69 @@ +#!/usr/bin/make -f +# GNU copyright 1997 to 1999 by Joey Hess. +# Modified for ngrep by Nathan Sandver, Steve Kemp and Romain Francoise. + +# Uncomment this to turn on verbose mode. +# export DH_VERBOSE=1 + +-include /usr/share/quilt/quilt.make + +configure: configure-stamp +configure-stamp: + dh_testdir + + ./configure --prefix=/usr --bindir=/usr/bin --mandir=/usr/share/man \ + --infodir=/usr/share/info --enable-pcre --enable-ipv6 + + touch configure-stamp + +build: patch configure-stamp build-stamp +build-stamp: + dh_testdir + $(MAKE) + touch build-stamp + +clean: clean-patched unpatch +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + [ ! -f Makefile ] || $(MAKE) distclean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install prefix=$(CURDIR)/debian/ngrep + mv $(CURDIR)/debian/ngrep/share/man/man8/*.8 \ + $(CURDIR)/debian/ngrep/usr/share/man/man8 + mv $(CURDIR)/debian/ngrep/bin/ngrep $(CURDIR)/debian/ngrep/usr/bin + rm -rf $(CURDIR)/debian/ngrep/share $(CURDIR)/debian/ngrep/bin + +binary-indep: build install +# We have nothing to do by default. + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installcron + dh_installman + dh_installinfo + dh_installchangelogs -v doc/CHANGES.txt + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- ngrep-1.45.ds2.orig/debian/patches/30_tcpkill.diff +++ ngrep-1.45.ds2/debian/patches/30_tcpkill.diff @@ -0,0 +1,237 @@ +This patch adds tcpkill support to ngrep (new option -K). It was +initially written by Florian Weimer in 2004, and +updated for libnet 1.1 by Romain Francoise . + +--- ngrep-1.45.ds1.orig/LICENSE.txt ++++ ngrep-1.45.ds1/LICENSE.txt +@@ -36,3 +36,32 @@ + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++Portions were copied from tcpkill (part of dsniff), which has the ++following copyright: ++ ++ Copyright (c) 1999, 2000 Dug Song ++ All rights reserved, all wrongs reversed. ++ ++ Redistribution and use in source and binary forms, with or without ++ modification, are permitted provided that the following conditions ++ are met: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ 3. The name of author may not be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, ++ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ++ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ++ THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ++ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ++ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR ++ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ++ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- ngrep-1.45.ds1.orig/Makefile.in ++++ ngrep-1.45.ds1/Makefile.in +@@ -7,16 +7,18 @@ + + CC=@CC@ + +-CFLAGS=@CFLAGS@ -D@OS@ @DEFS@ @EXTRA_DEFINES@ ++CFLAGS_LIBNET := $(shell libnet-config --defines ; libnet-config --cflags) ++CFLAGS=@CFLAGS@ -D@OS@ @DEFS@ @EXTRA_DEFINES@ $(CFLAGS_LIBNET) + INCLUDES=-I@srcdir@ @PCAP_INCLUDE@ @EXTRA_INCLUDES@ + + LDFLAGS=@LDFLAGS@ @PCAP_LINK@ +-LIBS=-lpcap @EXTRA_LIBS@ ++LIBNET := $(shell libnet-config --libs) ++LIBS=-lpcap @EXTRA_LIBS@ $(LIBNET) + + STRIPFLAG=@STRIPFLAG@ + +-SRC=ngrep.c +-OBJS=ngrep.o ++SRC=ngrep.c tcpkill.c ++OBJS=ngrep.o tcpkill.o + TARGET=ngrep + MANPAGE=ngrep.8 + +--- ngrep-1.45.ds1.orig/ngrep.8 ++++ ngrep-1.45.ds1/ngrep.8 +@@ -196,6 +196,10 @@ + Change the non-printable character from the default ``.'' to the + character specified. + ++.IP "-K num" ++Kill matching TCP connections (like tcpkill). The numeric argument ++controls how many RST segments are sent. ++ + .IP "\fI match expression\fP" + A match expression is either an extended regular expression, or if the + \fI-X\fP option is specified, a string signifying a hexadecimal value. +--- ngrep-1.45.ds1.orig/ngrep.c ++++ ngrep-1.45.ds1/ngrep.c +@@ -110,6 +110,7 @@ + + uint16_t snaplen = 65535, limitlen = 65535, promisc = 1, to = 100; + uint16_t match_after = 0, keep_matching = 0, matches = 0, max_matches = 0; ++uint16_t tcpkill_active = 0; + + uint8_t re_match_word = 0, re_ignore_case = 0, re_multiline_match = 1; + uint8_t show_empty = 0, show_hex = 0, show_proto = 0, quiet = 0; +@@ -199,7 +200,7 @@ + + setlocale(LC_ALL, ""); + +- while ((c = getopt(argc, argv, "LNhXViwqpevxlDtTRMs:n:c:d:A:I:O:S:P:F:W:")) != EOF) { ++ while ((c = getopt(argc, argv, "LNhXViwqpevxlDtTRMK:s:n:c:d:A:I:O:S:P:F:W:")) != EOF) { + switch (c) { + case 'W': { + if (!strcasecmp(optarg, "normal")) +@@ -314,6 +315,9 @@ + case 'N': + show_proto++; + break; ++ case 'K': ++ tcpkill_active = atoi(optarg); ++ break; + case 'h': + usage(0); + default: +@@ -353,6 +357,10 @@ + clean_exit(-1); + } + ++ if (tcpkill_active) { ++ tcpkill_init(); ++ } ++ + if (pcap_lookupnet(dev, &net.s_addr, &mask.s_addr, pc_err) == -1) { + perror(pc_err); + memset(&net, 0, sizeof(net)); +@@ -887,6 +895,10 @@ + + if (pd_dump) + pcap_dump((u_char*)pd_dump, h, p); ++ ++ if (tcpkill_active) { ++ tcpkill_kill(h, p, link_offset, tcpkill_active); ++ } + } + + int8_t re_match_func(unsigned char *data, uint32_t len) { +@@ -1256,6 +1268,7 @@ + #else + " -d is use specified device instead of the pcap default\n" + #endif ++ " -K is kill matching TCP connections\n" + ""); + + exit(e); +--- /dev/null ++++ ngrep-1.45.ds1/tcpkill.c +@@ -0,0 +1,88 @@ ++/* ++ * tcpkill.c ++ * ++ * Kill TCP connections already in progress. ++ * ++ * Copyright (c) 2000 Dug Song ++ * ++ * $Id: tcpkill.c,v 1.17 2001/03/17 08:10:43 dugsong Exp $ ++ */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "tcpkill.h" ++ ++libnet_t *l; ++ ++void ++tcpkill_kill(const struct pcap_pkthdr *pcap, const u_char *pkt, ++ unsigned pcap_off, unsigned kill_count) ++{ ++ struct libnet_ipv4_hdr *ip; ++ struct libnet_tcp_hdr *tcp; ++ u_char ctext[64]; ++ u_int32_t seq, win; ++ int i, len; ++ ++ pkt += pcap_off; ++ len = pcap->caplen - pcap_off; ++ ++ ip = (struct libnet_ipv4_hdr *)pkt; ++ if (ip->ip_p != IPPROTO_TCP) ++ return; ++ ++ tcp = (struct libnet_tcp_hdr *)(pkt + (ip->ip_hl << 2)); ++ if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST)) ++ return; ++ ++ seq = ntohl(tcp->th_ack); ++ win = ntohs(tcp->th_win); ++ ++ snprintf(ctext, sizeof(ctext), "%s:%d > %s:%d:", ++ libnet_addr2name4(ip->ip_src.s_addr, LIBNET_DONT_RESOLVE), ++ ntohs(tcp->th_sport), ++ libnet_addr2name4(ip->ip_dst.s_addr, LIBNET_DONT_RESOLVE), ++ ntohs(tcp->th_dport)); ++ ++ for (i = 0; i < kill_count; i++) { ++ seq += (i * win); ++ ++ libnet_clear_packet(l); ++ ++ libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport), ++ seq, 0, TH_RST, 0, 0, 0, LIBNET_TCP_H, ++ NULL, 0, l, 0); ++ ++ libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H, 0, ++ libnet_get_prand(LIBNET_PRu16), 0, 64, ++ IPPROTO_TCP, 0, ip->ip_dst.s_addr, ++ ip->ip_src.s_addr, NULL, 0, l, 0); ++ ++ if (libnet_write(l) < 0) ++ warn("write"); ++ ++ fprintf(stderr, "%s R %lu:%lu(0) win 0\n", ctext, seq, seq); ++ } ++} ++ ++void ++tcpkill_init(void) ++{ ++ char *intf, ebuf[PCAP_ERRBUF_SIZE]; ++ char libnet_ebuf[LIBNET_ERRBUF_SIZE]; ++ ++ if ((intf = pcap_lookupdev(ebuf)) == NULL) ++ errx(1, "%s", ebuf); ++ ++ if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL) ++ errx(1, "couldn't initialize sending"); ++ ++ libnet_seed_prand(l); ++} +--- /dev/null ++++ ngrep-1.45.ds1/tcpkill.h +@@ -0,0 +1,7 @@ ++#ifndef TCPKILL_H ++#define TCPKILL_H ++ ++void tcpkill_init(void); ++void tcpkill_kill(const struct pcap_pkthdr *pcap, const u_char *pkt, unsigned pcap_off, unsigned kill_count); ++ ++#endif --- ngrep-1.45.ds2.orig/debian/patches/series +++ ngrep-1.45.ds2/debian/patches/series @@ -0,0 +1,4 @@ +10_debian-build.diff +20_setlocale.diff +30_tcpkill.diff +50_autotools-dev.diff --- ngrep-1.45.ds2.orig/debian/patches/50_autotools-dev.diff +++ ngrep-1.45.ds2/debian/patches/50_autotools-dev.diff @@ -0,0 +1,27 @@ +Make config.{guess,sub} use autotools-dev's fresher versions +automatically. + +--- ngrep-1.45.orig/config.guess ++++ ngrep-1.45/config.guess +@@ -1,4 +1,9 @@ + #! /bin/sh ++ ++if [ -x /usr/share/misc/config.guess ]; then ++ exec /usr/share/misc/config.guess "$@" ++fi ++ + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +--- ngrep-1.45.orig/config.sub ++++ ngrep-1.45/config.sub +@@ -1,4 +1,9 @@ + #! /bin/sh ++ ++if [ -x /usr/share/misc/config.sub ]; then ++ exec /usr/share/misc/config.sub "$@" ++fi ++ + # Configuration validation subroutine script. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, --- ngrep-1.45.ds2.orig/debian/patches/10_debian-build.diff +++ ngrep-1.45.ds2/debian/patches/10_debian-build.diff @@ -0,0 +1,99 @@ +Change ngrep's build system to use the system's version of PCRE. + +--- ngrep-1.45.ds1.orig/configure ++++ ngrep-1.45.ds1/configure +@@ -3624,13 +3624,10 @@ + + if test $use_pcre = yes; then + +- echo +- echo 'Configuring Perl-Compatible Regular Expression (PCRE) library ...' +- echo +- +- REGEX_DIR='pcre-5.0' +- REGEX_OBJS="$REGEX_DIR/pcre.o $REGEX_DIR/study.o" ++ REGEX_DIR='' ++ REGEX_OBJS="" + USE_PCRE="1" ++ EXTRA_LIBS="$EXTRA_LIBS -lpcre" + + else + +@@ -3644,8 +3641,6 @@ + + fi + +-( cd $REGEX_DIR && ./configure ) +- + + + +--- ngrep-1.45.ds1.orig/configure.in ++++ ngrep-1.45.ds1/configure.in +@@ -126,13 +126,10 @@ + + if test $use_pcre = yes; then + +- echo +- echo 'Configuring Perl-Compatible Regular Expression (PCRE) library ...' +- echo +- +- REGEX_DIR='pcre-5.0' +- REGEX_OBJS="$REGEX_DIR/pcre.o $REGEX_DIR/study.o" ++ REGEX_DIR='' ++ REGEX_OBJS="" + USE_PCRE="1" ++ EXTRA_LIBS="$EXTRA_LIBS -lpcre" + + else + +@@ -146,8 +143,6 @@ + + fi + +-( cd $REGEX_DIR && ./configure ) +- + AC_SUBST(REGEX_DIR) + AC_SUBST(REGEX_OBJS) + +--- ngrep-1.45.ds1.orig/Makefile.in ++++ ngrep-1.45.ds1/Makefile.in +@@ -39,13 +39,13 @@ + all: $(TARGET) + + $(TARGET): $(REGEX_OBJS) $(OBJS) +- $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS) + + debug: $(REGEX_OBJS) $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -g -o $(TARGET) $(OBJS) $(REGEX_OBJS) $(LIBS) + + static: $(REGEX_OBJS) $(OBJS) +- $(CC) $(CFLAGS) $(LDFLAGS) $(STRIPFLAG) -o $(TARGET).static -static $(OBJS) $(REGEX_OBJS) $(LIBS) ++ $(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET).static -static $(OBJS) $(REGEX_OBJS) $(LIBS) + + install: $(TARGET) + $(INSTALL) -c -m 0755 $(TARGET) $(DESTDIR)/$(BINDIR_INSTALL)/$(TARGET) +@@ -55,11 +55,9 @@ + $(CC) $(CFLAGS) $(INCLUDES) -g -c $< + + clean: +- make -C $(REGEX_DIR) clean + rm -f *~ $(OBJS) $(REGEX_OBJS) $(TARGET) $(TARGET).static + + distclean: clean +- make -C $(REGEX_DIR) distclean + rm -f config.status config.cache config.log config.h Makefile + + $(REGEX_OBJS): $(REGEX_OBJS:.o=.c) $(REGEX_DIR)/*.h +--- ngrep-1.45.ds1.orig/ngrep.c ++++ ngrep-1.45.ds1/ngrep.c +@@ -92,7 +92,7 @@ + #endif + + #if USE_PCRE +-#include "pcre-5.0/pcre.h" ++#include + #else + #include "regex-0.12/regex.h" + #endif --- ngrep-1.45.ds2.orig/debian/patches/20_setlocale.diff +++ ngrep-1.45.ds2/debian/patches/20_setlocale.diff @@ -0,0 +1,23 @@ +Call setlocale to make isprint() decide what's printable depending +on the current locale. See #307496. + +--- ngrep-1.45.ds1.orig/ngrep.c ++++ ngrep-1.45.ds1/ngrep.c +@@ -97,6 +97,8 @@ + #include "regex-0.12/regex.h" + #endif + ++#include ++ + #include "ngrep.h" + + +@@ -195,6 +197,8 @@ + signal(SIGWINCH, update_windowsize); + #endif + ++ setlocale(LC_ALL, ""); ++ + while ((c = getopt(argc, argv, "LNhXViwqpevxlDtTRMs:n:c:d:A:I:O:S:P:F:W:")) != EOF) { + switch (c) { + case 'W': {