[Autosec-devel] sonar/src popts.c,1.8,1.9 popts.h,1.3,1.4 sonar.c,1.42,1.43
Brought to you by:
red0x
From: Jacob F. <ph...@us...> - 2004-04-11 02:34:30
|
Update of /cvsroot/autosec/sonar/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5776 Modified Files: popts.c popts.h sonar.c Log Message: Added plugin listing to the command line options Index: popts.h =================================================================== RCS file: /cvsroot/autosec/sonar/src/popts.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** popts.h 29 Jan 2004 23:43:52 -0000 1.3 --- popts.h 11 Apr 2004 02:20:48 -0000 1.4 *************** *** 34,37 **** --- 34,39 ---- #endif + #include "plugin.h" + #define PLUGIN_SELECT 2 #define INPUT_SELECT 3 *************** *** 39,45 **** --- 41,49 ---- #define PLUGIN_OPTION 5 + void sonar_opt_header(); void sonar_opt_usage(int exitcode, char *error, char *addl); void sonar_opt_help(int exitcode); + void sonar_opt_pluginlist(); Index: popts.c =================================================================== RCS file: /cvsroot/autosec/sonar/src/popts.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** popts.c 28 Feb 2004 12:43:40 -0000 1.8 --- popts.c 11 Apr 2004 02:20:47 -0000 1.9 *************** *** 34,60 **** "\100$ autosec/sonar: $Id$"; ! void sonar_opt_usage(int exitcode, char *error, ! char *addl) ! { #ifndef DEBUG ! fprintf(stderr, ! "%s - red0x <re...@us...>\nBugs: <%s>\n", ! PACKAGE_STRING, PACKAGE_BUGREPORT); #else ! fprintf(stderr, ! "%s debug - red0x <re...@us...>\nBugs: <%s>\n", ! PACKAGE_STRING, PACKAGE_BUGREPORT); #endif ! fprintf(stderr, "FREE for NON-COMMERCIAL USE\n"); ! fprintf(stderr, "Usage: %s [options] <scan-type> <target(s)>\n", ! PACKAGE_NAME); fprintf(stderr, " options: [-f|--fork] [-v|--verbose] [-q|--quiet] " "[-r|--randomize]\n"); fprintf(stderr, "\t[--scan_delay=seconds] [-c|--count cycles] " "[-s|--scan_type plugin]\n"); ! fprintf(stderr, "\t[-i|--input plugin] [-o|--output plugin] " ! "[-p|--plugin_opt option_string]\n"); ! fprintf(stderr, "\t[--post_delay=mseconds] [--timeout=mseconds]\n"); ! fprintf(stderr, "\t[-?|--help] [--usage]\n"); if(error) fprintf(stderr, "%s: %s\n", error, addl); --- 34,67 ---- "\100$ autosec/sonar: $Id$"; ! extern plugin_list_t network_list[]; ! extern plugin_list_t input_list[]; ! extern plugin_list_t output_list[]; ! extern int num_net, num_inp, num_out; ! ! void sonar_opt_header() { #ifndef DEBUG ! fprintf(stderr, "%s - red0x <re...@us...>\nBugs: <%s>\n", ! PACKAGE_STRING, PACKAGE_BUGREPORT); #else ! fprintf(stderr, "%s debug - red0x <re...@us...>\nBugs: <%s>" ! "\n", PACKAGE_STRING, PACKAGE_BUGREPORT); #endif ! fprintf(stderr, "FREE for NON-COMMERCIAL USE\n"); ! ! } ! ! void sonar_opt_usage(int exitcode, char *error, ! char *addl) ! { ! sonar_opt_header(); fprintf(stderr, " options: [-f|--fork] [-v|--verbose] [-q|--quiet] " "[-r|--randomize]\n"); fprintf(stderr, "\t[--scan_delay=seconds] [-c|--count cycles] " "[-s|--scan_type plugin]\n"); ! fprintf(stderr, "\t[-i|--input plugin] [-l|--plugin_list] " ! "[-o|--output plugin]\n"); ! fprintf(stderr, "\t[-p|--plugin_opt option_string] [--post_delay=mseconds]" ! "\n"); ! fprintf(stderr, "\t[--timeout=mseconds] [-?|--help] [--usage]\n"); if(error) fprintf(stderr, "%s: %s\n", error, addl); *************** *** 64,77 **** void sonar_opt_help(int exitcode) { ! #ifndef DEBUG ! fprintf(stderr, ! "%s - red0x <re...@us...>\nBugs: <%s>\n", ! PACKAGE_STRING, PACKAGE_BUGREPORT); ! #else ! fprintf(stderr, ! "%s debug - red0x <re...@us...>\nBugs: <%s>\n", ! PACKAGE_STRING, PACKAGE_BUGREPORT); ! #endif ! fprintf(stderr, "FREE for NON-COMMERCIAL USE\n"); fprintf(stderr, "Usage: sonar [options] <scan-type> <target(s)>\n"); fprintf(stderr, " -f, --fork fork into background " --- 71,75 ---- void sonar_opt_help(int exitcode) { ! sonar_opt_header(); fprintf(stderr, "Usage: sonar [options] <scan-type> <target(s)>\n"); fprintf(stderr, " -f, --fork fork into background " *************** *** 91,94 **** --- 89,93 ---- fprintf(stderr, " -i, --input=plugin input plugin to " "use\n"); + fprintf(stderr, " -l, --plugin_list list loaded plugins\n"); fprintf(stderr, " -o, --output=plugin output plugin to " "use\n"); *************** *** 104,105 **** --- 103,144 ---- exit(exitcode); } + + void sonar_opt_pluginlist() { + int i; + plugin_t *plug; + + sonar_opt_header(); + + fprintf(stderr, "\nInput Plugins\n"); + fprintf(stderr, "Char Name Description\n"); + fprintf(stderr, "---- ---------------- --------------------------\n"); + for(i=0;i<num_inp;i++) + { + plug=input_list[i].plug; + fprintf(stderr, " %c %15s %25s\n",plug->plugin_char,plug->shortname, + plug->longname); + } + fprintf(stderr, "\n"); + + fprintf(stderr, "Output Plugins\n"); + fprintf(stderr, "Char Name Description\n"); + fprintf(stderr, "---- ---------------- --------------------------\n"); + for(i=0;i<num_out;i++) + { + plug=output_list[i].plug; + fprintf(stderr, " %c %15s %25s\n",plug->plugin_char,plug->shortname, + plug->longname); + } + fprintf(stderr, "\n"); + + fprintf(stderr, "Network Plugins\n"); + fprintf(stderr, "Char Name Description\n"); + fprintf(stderr, "---- ---------------- --------------------------\n"); + for(i=0;i<num_net;i++) + { + plug=network_list[i].plug; + fprintf(stderr, " %c %15s %25s\n",plug->plugin_char,plug->shortname, + plug->longname); + } + fprintf(stderr, "\n"); + } Index: sonar.c =================================================================== RCS file: /cvsroot/autosec/sonar/src/sonar.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** sonar.c 8 Apr 2004 19:11:03 -0000 1.42 --- sonar.c 11 Apr 2004 02:20:48 -0000 1.43 *************** *** 60,73 **** { char *temp, *pv; ! sonar_t *mthis; assert(in != NULL); ! mthis = (sonar_t *) in; ! memset((void *) mthis, 0, sizeof(sonar_t)); ! mthis->ver_major = 0; ! mthis->ver_minor = 0; ! mthis->revision = 0; pv = (char *) Malloc(strlen(PACKAGE_VERSION)); strncpy(pv, PACKAGE_VERSION, strlen(PACKAGE_VERSION)); --- 60,73 ---- { char *temp, *pv; ! sonar_t *mthat; assert(in != NULL); ! mthat = (sonar_t *) in; ! memset((void *) mthat, 0, sizeof(sonar_t)); ! mthat->ver_major = 0; ! mthat->ver_minor = 0; ! mthat->revision = 0; pv = (char *) Malloc(strlen(PACKAGE_VERSION)); strncpy(pv, PACKAGE_VERSION, strlen(PACKAGE_VERSION)); *************** *** 75,108 **** while(pv != NULL) { ! if(temp) ! *temp++ = 0x00; ! if(mthis->ver_major == 0) ! mthis->ver_major = atoi(pv); ! else if(mthis->ver_minor == 0) ! mthis->ver_minor = atoi(pv); ! else if(mthis->revision == 0) ! mthis->revision = atoi(pv); ! else ! pv = NULL; ! pv = temp; ! if(!pv) ! break; ! temp = strpbrk(pv, "."); } free(pv); // plugin API number ! mthis->api = API_VER; ! mthis->memput = &bput; ! mthis->message = &sonar_msg; ! mthis->resolve = &Host_serv; ! mthis->output = &sonar_rawoutput; ! mthis->usage = &sonar_usage; ! mthis->getprivs = &sonar_getprivs; ! mthis->dropprivs = &sonar_dropprivs; ! mthis->find_target = &sonar_find_target; // no targets yet ;) ! mthis->vectors = NULL; ! mthis->num_targets = 0; ! mthis->num_ports = 0; } --- 75,108 ---- while(pv != NULL) { ! if(temp) ! *temp++ = 0x00; ! if(mthat->ver_major == 0) ! mthat->ver_major = atoi(pv); ! else if(mthat->ver_minor == 0) ! mthat->ver_minor = atoi(pv); ! else if(mthat->revision == 0) ! mthat->revision = atoi(pv); ! else ! pv = NULL; ! pv = temp; ! if(!pv) ! break; ! temp = strpbrk(pv, "."); } free(pv); // plugin API number ! mthat->api = API_VER; ! mthat->memput = &bput; ! mthat->message = &sonar_msg; ! mthat->resolve = &Host_serv; ! mthat->output = &sonar_rawoutput; ! mthat->usage = &sonar_usage; ! mthat->getprivs = &sonar_getprivs; ! mthat->dropprivs = &sonar_dropprivs; ! mthat->find_target = &sonar_find_target; // no targets yet ;) ! mthat->vectors = NULL; ! mthat->num_targets = 0; ! mthat->num_ports = 0; } *************** *** 158,162 **** } ! while((opt = getopt_long(argc, argv, "v::qrfd:c:s:i:o:p:w:t:h:be:?", optionsTable, &opt_ind)) >= 0) { --- 158,162 ---- } ! while((opt = getopt_long(argc, argv, "v::qrfld:c:s:i:o:p:w:t:h:be:?", optionsTable, &opt_ind)) >= 0) { *************** *** 164,167 **** --- 164,168 ---- switch (opt) { + /* select a plugin */ case 's': plugin = (char *) optarg; *************** *** 338,341 **** --- 339,346 ---- mthis.opts.iVerbose); break; + case 'l': + sonar_opt_pluginlist(); + exit(0); + break; case 'q': mthis.opts.iVerbose = -1; |