diff options
Diffstat (limited to 'pcap2tzsp.c')
-rw-r--r-- | pcap2tzsp.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/pcap2tzsp.c b/pcap2tzsp.c index e84f5bf..29687bb 100644 --- a/pcap2tzsp.c +++ b/pcap2tzsp.c @@ -1,5 +1,25 @@ -/* Library dependencies : - libpcap (sudo apt-get install libpcap0.8-dev) +/* + + Pcap2tzsp allows to capture ethernet trafic and send all headers + to a defined host using the TaZmen Sniffing Protocol (TZSP). + + Copyright (C) 2012 Ludovic Pouzenc <lpouzenc@gmail.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + + This file is part of Pcap2tzsp. See LICENCE file. */ /* Basics */ @@ -13,8 +33,6 @@ #include <libgen.h> /* UDP stuff */ -/*#include <arpa/inet.h> -#include <netinet/in.h> no longer used */ #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> @@ -48,10 +66,9 @@ #define NI_MAXHOST_NUMERIC 40 /* TODO List - * Resolution DNS host -> IP (c'est l'ip qu'il faut dans le filtre et pas le host !!) * Implémenter une bwlimit en sortie (ptks/s et/ou bytes/s) - * TZSP over IPv6 (le filter doit avoir le dst qui va bien , pas le nom, l'adresse) - * getopts -v et --help + * Version qui compile sous Windows + * Calcul dynamique de MAX_TZSP_PAYLOAD * Licence GPL */ @@ -117,6 +134,7 @@ int main(int argc, char *argv[]) { {"brief", no_argument, &opt_verbose, 0}, /* These options don't set a flag. We distinguish them by their indices. */ + {"help", no_argument, 0, 'H'}, {"interface", required_argument, 0, 'i'}, {"host", required_argument, 0, 'h'}, {"port", required_argument, 0, 'p'}, @@ -126,7 +144,7 @@ int main(int argc, char *argv[]) { /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "i:h:p:s:", long_options, &option_index); + c = getopt_long(argc, argv, "i:h:p:s:v", long_options, &option_index); /* Detect the end of the options. */ if (c == -1) break; @@ -145,6 +163,8 @@ int main(int argc, char *argv[]) { case 'h': opt_host= strdup(optarg); break; case 'p': opt_port= strdup(optarg); break; case 's': opt_snaplen= strdup(optarg); break; + case 'v': opt_verbose= 1; break; + case 'H': case '?': /* getopt_long already printed an error message. */ usage(basename(argv[0])); @@ -294,6 +314,7 @@ void start_capture_loop(char *pcap_filter) { fprintf(stderr, "ERROR : Couldn't make a socket to %s:%s\n", opt_host, opt_port); exit(10); } + if (opt_verbose) printf("Socket opened with the following destination : %s:%s\n", resolved_address, opt_port); /* pcap init */ if (opt_verbose) printf("Opening device %s for capturing\n", pcap_device); @@ -348,7 +369,6 @@ void start_capture_loop(char *pcap_filter) { pcap_close(pcap_handle); close(process_packet_args.socket); - //XXX freeaddrinfo(target_addrinfo); } |