Commit eb96ed15 authored by Adam Greene's avatar Adam Greene
Browse files

adds support for unicornscan compatible output

use '-oU' or '--output-format unicornscan'

Only supported for TCP SYN scanning. Other scans
will fall back to grep style output since unicornscan
has no support for non-TCP scanning.
parent b299d5c6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -175,10 +175,10 @@ print_nmap_help(void)
"  --ttl <val>: Set IP time-to-live field\n"
"  --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address\n"
"OUTPUT:\n"
"  --output-format <format>: Sets output to binary/list/json/grepable/xml\n"
"  --output-format <format>: Sets output to binary/list/unicornscan/json/grepable/xml\n"
"  --output-file <file>: Write scan results to file. If --output-format is\n"
"     not given default is xml\n"
"  -oL/-oJ/-oG/-oB/-oX <file>: Output scan in List/JSON/Grepable/Binary/XML format,\n"
"  -oL/-oJ/-oG/-oB/-oX/-oU <file>: Output scan in List/JSON/Grepable/Binary/XML/Unicornscan format,\n"
"     respectively, to the given filename. Shortcut for\n"
"     --output-format <format> --output-file <file>\n"
"  -v: Increase verbosity level (use -vv or more for greater effect)\n"
@@ -314,6 +314,7 @@ masscan_echo(struct Masscan *masscan, FILE *fp)
    switch (masscan->output.format) {
    case Output_Interactive:fprintf(fp, "output-format = interactive\n"); break;
    case Output_List:       fprintf(fp, "output-format = list\n"); break;
    case Output_Unicornscan:fprintf(fp, "output-format = unicornscan\n"); break;
    case Output_XML:        fprintf(fp, "output-format = xml\n"); break;
    case Output_Binary:     fprintf(fp, "output-format = binary\n"); break;
    case Output_Grepable:   fprintf(fp, "output-format = grepable\n"); break;
@@ -1382,6 +1383,7 @@ masscan_set_parameter(struct Masscan *masscan,
        if (EQUALS("interactive", value))
            masscan->output.format = Output_Interactive;
        else if (EQUALS("list", value))         x = Output_List;
        else if (EQUALS("unicornscan", value))         x = Output_Unicornscan;
        else if (EQUALS("xml", value))          x = Output_XML;
        else if (EQUALS("binary", value))       x = Output_Binary;
        else if (EQUALS("greppable", value))    x = Output_Grepable;
@@ -1867,6 +1869,9 @@ masscan_command_line(struct Masscan *masscan, int argc, char *argv[])
                case 'L':
                    masscan_set_parameter(masscan, "output-format", "list");
                    break;
                case 'U':
                    masscan_set_parameter(masscan, "output-format", "unicornscan");
                    break;
                default:
                    fprintf(stderr, "nmap(%s): unknown output format\n", argv[i]);
                    exit(1);
+3 −2
Original line number Diff line number Diff line
@@ -51,8 +51,9 @@ enum OutputFormat {
    Output_ScriptKiddie = 0x0040,
    Output_Grepable     = 0x0080,   /* -oG, "grepable" */
    Output_Redis        = 0x0100, 
    Output_None         = 0x0200,
    Output_Certs        = 0x0400,
    Output_Unicornscan  = 0x0200,   /* -oU, "unicornscan" */
    Output_None         = 0x0400,
    Output_Certs        = 0x0800,
    Output_All          = 0xFFBF,   /* not supported */
};

+3 −0
Original line number Diff line number Diff line
@@ -407,6 +407,9 @@ output_create(const struct Masscan *masscan, unsigned thread_index)
    case Output_List:
        out->funcs = &text_output;
        break;
    case Output_Unicornscan:
        out->funcs = &unicornscan_output;
        break;
    case Output_XML:
        out->funcs = &xml_output;
        break;
+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ const char *normalize_string(const unsigned char *px, size_t length,


extern const struct OutputType text_output;
extern const struct OutputType unicornscan_output;
extern const struct OutputType xml_output;
extern const struct OutputType json_output;
extern const struct OutputType certs_output;