From 98f54c9dc43353e2b99976db2921176a0f5ed036 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Sun, 23 Oct 2011 01:02:19 +0200 Subject: [PATCH] make driftnet read from pcap dumpfile --- driftnet.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/driftnet.c b/driftnet.c index 5169a9a..9af871d 100644 --- a/driftnet.c +++ b/driftnet.c @@ -656,14 +656,19 @@ int main(int argc, char *argv[]) { if (verbose) fprintf(stderr, PROGNAME": using temporary file directory %s\n", tmpdir); - if (!interface && !(interface = pcap_lookupdev(ebuf))) { + if (!dumpfile && !interface && !(interface = pcap_lookupdev(ebuf))) { fprintf(stderr, PROGNAME": pcap_lookupdev: %s\n", ebuf); fprintf(stderr, PROGNAME": try specifying an interface with -i\n"); return -1; } - if (verbose) - fprintf(stderr, PROGNAME": listening on %s%s\n", interface ? interface : "all interfaces", promisc ? " in promiscuous mode" : ""); + if (verbose) { + if (interface) { + fprintf(stderr, PROGNAME": listening on %s%s\n", interface ? interface : "all interfaces", promisc ? " in promiscuous mode" : ""); + } else if (dumpfile) { + fprintf(stderr, PROGNAME": processing packets from dumpfile '%s'\n", dumpfile); + } + } /* Build up filter. */ if (optind < argc) {