From a92676647812cb72c791e4ea12a2674569bf9b3e Mon Sep 17 00:00:00 2001 From: Ruslan Kuchumov Date: Sun, 27 Jul 2014 23:24:19 +0000 Subject: [PATCH] merge conflict --- src/params.c | 102 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 19 deletions(-) diff --git a/src/params.c b/src/params.c index 4e8d7dda..085d9a7f 100644 --- a/src/params.c +++ b/src/params.c @@ -256,6 +256,13 @@ void set_output_format (const char *format) { while (*format=='-') format++; + + if (ccx_options.send_to_srv && strcmp(format, "bin")!=0) + { + mprint("Output format is changed to bin\n"); + format = "bin"; + } + if (strcmp (format,"srt")==0) ccx_options.write_format=CCX_OF_SRT; else if (strcmp (format,"sami")==0 || strcmp (format,"smi")==0) @@ -300,6 +307,12 @@ void set_output_format (const char *format) void set_input_format (const char *format) { + if (ccx_options.input_source == CCX_DS_TCP && strcmp(format, "bin")!=0) + { + mprint("Intput format is changed to bin\n"); + format = "bin"; + } + while (*format=='-') format++; if (strcmp (format,"es")==0) // Does this actually do anything? @@ -367,6 +380,12 @@ void usage (void) mprint (" port) instead of reading a file. Host can be a\n"); mprint (" hostname or IPv4 address. If host is not specified\n"); mprint (" then listens on the local host.\n\n"); + mprint (" -sendto host[:port]: Sends data in BIN format to the server according\n"); + mprint (" to the CCExtractor's protocol over TCP. For IPv6\n"); + mprint (" use [addres]:port\n"); + mprint (" -tcp port: Reads the input data in BIN format according to CCExtractor's\n"); + mprint (" protocol, listening specified port on the local host\n"); + mprint (" -tcppassword password: Sets server password for new connections to tcp server\n"); mprint ("Options that affect what will be processed:\n"); mprint (" -1, -2, -12: Output Field 1 data, Field 2 data, or both\n"); mprint (" (DEFAULT is -1)\n"); @@ -1529,37 +1548,82 @@ void parse_parameters (int argc, char *argv[]) /* Network stuff */ if (strcmp (argv[i],"-udp")==0 && ih_addrtype != AF_INET) - { - fatal(EXIT_MALFORMED_PARAMETER, "No support for non-IPv4 network addresses: %s\n", - argv[i+1]); - } - ccx_options.udpaddr = ntohl(((struct in_addr *)host->h_addr_list[0])->s_addr); + ccx_options.udpaddr = argv[i + 1]; ccx_options.udpport = atoi_hex(colon + 1); } else { - ccx_options.udpaddr = INADDR_ANY; - ccx_options.udpport = atoi_hex(argv[i+1]); + ccx_options.udpaddr = NULL; + ccx_options.udpport = atoi_hex(argv[i + 1]); } + ccx_options.input_source=CCX_DS_NETWORK; i++; continue; } + + if (strcmp (argv[i],"-sendto")==0 && i