13de95056a
The patches are a modified version of some enhancements to tcpflow from Debian Adds the following options: -e When outputting to the console each flow will be output in alternating colours. -C Console print without the packet source and destination details being printed. Print the contents of packets to stdout as they are received, without storing any captured data to files (implies -s).
60 lines
2.4 KiB
Text
60 lines
2.4 KiB
Text
$NetBSD: patch-ab,v 1.1 2006/01/02 19:23:40 adrianp Exp $
|
|
|
|
--- src/main.c.orig 2003-08-07 08:35:24.000000000 +0100
|
|
+++ src/main.c
|
|
@@ -70,7 +70,9 @@ int bytes_per_flow = 0;
|
|
int max_flows = 0;
|
|
int max_desired_fds = 0;
|
|
int console_only = 0;
|
|
+int supress_header = 0;
|
|
int strip_nonprint = 0;
|
|
+int use_colour = 0;
|
|
|
|
char error[PCAP_ERRBUF_SIZE];
|
|
|
|
@@ -79,11 +81,13 @@ void print_usage(char *progname)
|
|
{
|
|
fprintf(stderr, "%s version %s by Jeremy Elson <jelson@circlemud.org>\n\n",
|
|
PACKAGE, VERSION);
|
|
- fprintf(stderr, "usage: %s [-chpsv] [-b max_bytes] [-d debug_level] [-f max_fds]\n", progname);
|
|
+ fprintf(stderr, "usage: %s [-cCehpsv] [-b max_bytes] [-d debug_level] [-f max_fds]\n", progname);
|
|
fprintf(stderr, " [-i iface] [-w file] [expression]\n\n");
|
|
fprintf(stderr, " -b: max number of bytes per flow to save\n");
|
|
fprintf(stderr, " -c: console print only (don't create files)\n");
|
|
+ fprintf(stderr, " -C: console print only, but without the display of source/dest header\n");
|
|
fprintf(stderr, " -d: debug level; default is %d\n", DEFAULT_DEBUG_LEVEL);
|
|
+ fprintf(stderr, " -e: use colours when printing to console\n");
|
|
fprintf(stderr, " -f: maximum number of file descriptors to use\n");
|
|
fprintf(stderr, " -h: print this help message\n");
|
|
fprintf(stderr, " -i: network interface on which to listen\n");
|
|
@@ -124,7 +128,7 @@ int main(int argc, char *argv[])
|
|
|
|
opterr = 0;
|
|
|
|
- while ((arg = getopt(argc, argv, "b:cd:f:hi:pr:sv")) != EOF) {
|
|
+ while ((arg = getopt(argc, argv, "b:cCd:ef:hi:pr:sv")) != EOF) {
|
|
switch (arg) {
|
|
case 'b':
|
|
if ((bytes_per_flow = atoi(optarg)) < 0) {
|
|
@@ -134,6 +138,10 @@ int main(int argc, char *argv[])
|
|
DEBUG(10) ("capturing max of %d bytes per flow", bytes_per_flow);
|
|
}
|
|
break;
|
|
+ case 'C':
|
|
+ supress_header = 1;
|
|
+ DEBUG(10) ("packet header dump suppressed");
|
|
+ /* fall through */
|
|
case 'c':
|
|
console_only = 1;
|
|
DEBUG(10) ("printing packets to console only");
|
|
@@ -148,6 +156,10 @@ int main(int argc, char *argv[])
|
|
DEBUG(1) ("warning: -d flag with 0 debug level '%s'", optarg);
|
|
}
|
|
break;
|
|
+ case 'e':
|
|
+ use_colour = 1;
|
|
+ DEBUG(10) ("Using colours");
|
|
+ break;
|
|
case 'f':
|
|
if ((max_desired_fds = atoi(optarg)) < (NUM_RESERVED_FDS + 2)) {
|
|
DEBUG(1) ("warning: -f flag must be used with argument >= %d",
|