summaryrefslogtreecommitdiff
path: root/net/modpcap
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2010-11-29 07:25:04 +0000
committeragc <agc@pkgsrc.org>2010-11-29 07:25:04 +0000
commit6a08188a4b1cffa9f31b0ea8bb4598cfb128c320 (patch)
treefcc68536a7284977c937c23028dcc89960b6b630 /net/modpcap
parentc599659a297f600c1ca585457f21092a24e423cf (diff)
downloadpkgsrc-6a08188a4b1cffa9f31b0ea8bb4598cfb128c320.tar.gz
Initial import of modpcap version 0.0.5 into the packages collection.
A small C program to modify PCAP files to forge them and use them for test and so on. It allows you to change IP address, Mac address, time of the capture, Mbit/second, Packets/second.
Diffstat (limited to 'net/modpcap')
-rw-r--r--net/modpcap/DESCR3
-rw-r--r--net/modpcap/Makefile27
-rw-r--r--net/modpcap/PLIST2
-rw-r--r--net/modpcap/distinfo6
-rw-r--r--net/modpcap/patches/patch-aa79
5 files changed, 117 insertions, 0 deletions
diff --git a/net/modpcap/DESCR b/net/modpcap/DESCR
new file mode 100644
index 00000000000..a7b2bae1cb8
--- /dev/null
+++ b/net/modpcap/DESCR
@@ -0,0 +1,3 @@
+A small C program to modify PCAP files to forge them and use them for
+test and so on. It allows you to change IP address, Mac address, time
+of the capture, Mbit/second, Packets/second.
diff --git a/net/modpcap/Makefile b/net/modpcap/Makefile
new file mode 100644
index 00000000000..5dbbf8d8be6
--- /dev/null
+++ b/net/modpcap/Makefile
@@ -0,0 +1,27 @@
+# $NetBSD: Makefile,v 1.1.1.1 2010/11/29 07:25:04 agc Exp $
+#
+
+DISTNAME= modcap.c
+PKGNAME= modcap-0.0.5
+CATEGORIES= net security
+MASTER_SITES= http://www.emcy.it/Linux/files/
+EXTRACT_SUFX= # empty
+
+MAINTAINER= agc@NetBSD.org
+COMMENT= Command line utility to modify pcap capture files
+LICENSE= gnu-gpl-v2
+
+PKG_DESTDIR_SUPPORT= user-destdir
+AUTO_MKDIRS= yes
+
+WRKSRC= ${WRKDIR}
+
+do-build:
+ cd ${WRKSRC} && ${CC} -I${PREFIX}/include modcap.c -lm -lpcap -o modcap
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/modcap ${DESTDIR}${PREFIX}/bin/
+
+.include "../../net/libpcap/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/net/modpcap/PLIST b/net/modpcap/PLIST
new file mode 100644
index 00000000000..563703a5cb0
--- /dev/null
+++ b/net/modpcap/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2010/11/29 07:25:04 agc Exp $
+bin/modcap
diff --git a/net/modpcap/distinfo b/net/modpcap/distinfo
new file mode 100644
index 00000000000..9dfdcec7ec3
--- /dev/null
+++ b/net/modpcap/distinfo
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1.1.1 2010/11/29 07:25:04 agc Exp $
+
+SHA1 (modcap.c) = e6f41df0432dc95883606eaf2a66778ec9843552
+RMD160 (modcap.c) = 1cc60d790c446d917a0fefc15c5da06a59825533
+Size (modcap.c) = 31124 bytes
+SHA1 (patch-aa) = 4c568040d21e766d5506a88abd18291ad0c53a2c
diff --git a/net/modpcap/patches/patch-aa b/net/modpcap/patches/patch-aa
new file mode 100644
index 00000000000..7130df9ac28
--- /dev/null
+++ b/net/modpcap/patches/patch-aa
@@ -0,0 +1,79 @@
+$NetBSD: patch-aa,v 1.1.1.1 2010/11/29 07:25:04 agc Exp $
+
+--- modcap.c 2010/05/26 16:25:26 1.1
++++ modcap.c 2010/05/26 16:28:42
+@@ -581,6 +581,7 @@
+ guint32 Prev_sec=0;
+ guint32 Prev_usec=0;
+ int NSP;
++ int i;
+
+ if (Param > MICRO)
+ {
+@@ -629,7 +630,7 @@
+ /// Store beginning of burst
+ Prev_sec=PR.header.ts_sec;
+ Prev_usec=PR.header.ts_usec;
+- for (int i=1;i<=NSP;i++)
++ for (i=1;i<=NSP;i++)
+ {
+ /// Read, shift
+ ReadRec(&PR);
+@@ -666,6 +667,7 @@
+ guint32 Prev_usec=0;
+ guint32 NSB=0;
+ guint32 NSP=0;
++ guint32 j;
+
+ /// From MegaBits/sec to Bytes/sec
+ unsigned long LParam = (unsigned long)(Param*1024*1024/8);
+@@ -715,13 +717,13 @@
+ /// Store beginning of burst
+ Prev_sec=PR.header.ts_sec;
+ Prev_usec=PR.header.ts_usec;
+- for (guint32 i=1;i<=NSP;i++)
++ for (j=1;j<=NSP;j++)
+ {
+ /// Read, shift
+ ReadRec(&PR);
+ /// Compress
+ PR.header.ts_sec = Prev_sec;
+- PR.header.ts_usec = (guint32)(Prev_usec + MICRO*((float)i*NSB)/((float)LParam*NSP));
++ PR.header.ts_usec = (guint32)(Prev_usec + MICRO*((float)j*NSB)/((float)LParam*NSP));
+ while (PR.header.ts_usec >= MICRO)
+ {
+ PR.header.ts_usec -= MICRO;
+@@ -755,6 +757,7 @@
+ int DeltaCks;
+ guint16 cks;
+ guint32 Checksum=0;
++ int i;
+
+ *ip0 = 0;
+ inet_aton(ip1, &dst);
+@@ -791,7 +794,7 @@
+ RunLen = IPHeader;
+ bzero (&Rec.body[ETHEADER+10],2);
+ Checksum=0;
+- for (int i=0; i<RunLen; i+=2)
++ for (i=0; i<RunLen; i+=2)
+ Checksum+=(guint16)((Rec.body[ETHEADER+i]<<8)+Rec.body[ETHEADER+i+1]);
+ Checksum = (Checksum >> 16) + (Checksum & 0xFFFF);
+ Checksum+= (Checksum >> 16);
+@@ -906,6 +909,7 @@
+ guint32 IPHeader=(Rec.body[ETHEADER+0] & 0x0F)<<2;
+ guint32 TCPHeader= IPHeader+ETHEADER;
+ guint32 RunLen = (Rec.body[ETHEADER+2]<<8) + (Rec.body[ETHEADER+3]) - IPHeader;
++ int i;
+
+ /// Repalce PORT
+ Rec.body[match] = (port2 & 0xFF00)>>8;
+@@ -914,7 +918,7 @@
+ /// Clear Previous Checksum a Bytes
+ bzero (&Rec.body[TCPHeader+16],2);
+ /// Summ Header and Dat
+- for (int i=0; i<RunLen; i+=2)
++ for (i=0; i<RunLen; i+=2)
+ Checksum+=(guint16)((Rec.body[TCPHeader+i]<<8)+Rec.body[TCPHeader+i+1]);
+ /// Add PseudoHeader Fields
+ Checksum+=(guint16) ((Rec.body[ETHEADER+12]<<8) + (Rec.body[ETHEADER+13]));