Commit 32dfd866 authored by Francisco Blas Izquierdo Riera's avatar Francisco Blas Izquierdo Riera
Browse files

Allow for removing status updates

We introduce the --nostatus parameter which allows disabling the printing of status updates.
Aside, we allow for reenabling them using the --status parameter
parent 0cac0452
Loading
Loading
Loading
Loading
+5 −1
Changes for src/main-conf.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1280,6 +1280,10 @@ masscan_set_parameter(struct Masscan *masscan,
        masscan->output.is_interactive = 1;
    } else if (EQUALS("nointeractive", name)) {
        masscan->output.is_interactive = 0;
    } else if (EQUALS("status", name)) {
        masscan->output.status_updates = 1;
    } else if (EQUALS("nostatus", name)) {
        masscan->output.status_updates = 0;
    } else if (EQUALS("ip-options", name)) {
        fprintf(stderr, "nmap(%s): unsupported: maybe soon\n", name);
        exit(1);
@@ -1649,7 +1653,7 @@ is_singleton(const char *name)
        "nmap", "trace-packet", "pfring", "sendq",
        "banners", "banner", "nobanners", "nobanner",
        "offline", "ping", "ping-sweep",
        "arp",  "infinite", "interactive",
        "arp",  "infinite", "nointeractive", "interactive", "status", "nostatus",
        "read-range", "read-ranges", "readrange", "read-ranges",
        0};
    size_t i;
+3
Changes for src/main.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1291,6 +1291,7 @@ main_scan(struct Masscan *masscan)
         * update screen about once per second with statistics,
         * namely packets/second.
         */
        if (masscan->output.status_updates)
            status_print(&status, min_index, range, rate,
                total_tcbs, total_synacks, total_syns,
                0);
@@ -1345,6 +1346,7 @@ main_scan(struct Masscan *masscan)
        }


        if (masscan->output.status_updates)
            status_print(&status, min_index, range, rate,
                total_tcbs, total_synacks, total_syns,
                masscan->wait - (time(0) - now));
@@ -1407,6 +1409,7 @@ int main(int argc, char *argv[])
    memset(masscan, 0, sizeof(*masscan));
    masscan->blackrock_rounds = 4;
    masscan->output.is_show_open = 1; /* default: show syn-ack, not rst */
    masscan->output.status_updates = 1; /* default: show status updates */
    masscan->seed = get_entropy(); /* entropy for randomness */
    masscan->wait = 10; /* how long to wait for responses when done */
    masscan->max_rate = 100.0; /* max rate = hundred packets-per-second */
+5 −1
Changes for src/masscan.h: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -177,7 +177,6 @@ struct Masscan
    unsigned is_heartbleed:1;   /* --heartbleed, scan for this vuln */
    unsigned is_poodle_sslv3:1; /* --script poodle, scan for this vuln */
        

    /**
     * Wait forever for responses, instead of the default 10 seconds
     */
@@ -295,6 +294,11 @@ struct Masscan
         */
        unsigned is_interactive:1;
        
        /**
        * Print state updates
        */
        unsigned status_updates:1;

        struct {
            /**
             * When we should rotate output into the target directory