Skip to content

Commit

Permalink
Allow for removing status updates
Browse files Browse the repository at this point in the history
We introduce the --nostatus parameter which allows disabling the printing of status updates.
Aside, we allow for reenabling them using the --status parameter
  • Loading branch information
klondi committed Feb 16, 2016
1 parent 0cac045 commit 32dfd86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/main-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 9 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,10 @@ main_scan(struct Masscan *masscan)
* update screen about once per second with statistics,
* namely packets/second.
*/
status_print(&status, min_index, range, rate,
total_tcbs, total_synacks, total_syns,
0);
if (masscan->output.status_updates)
status_print(&status, min_index, range, rate,
total_tcbs, total_synacks, total_syns,
0);

/* Sleep for almost a second */
pixie_mssleep(750);
Expand Down Expand Up @@ -1345,9 +1346,10 @@ main_scan(struct Masscan *masscan)
}


status_print(&status, min_index, range, rate,
total_tcbs, total_synacks, total_syns,
masscan->wait - (time(0) - now));
if (masscan->output.status_updates)
status_print(&status, min_index, range, rate,
total_tcbs, total_synacks, total_syns,
masscan->wait - (time(0) - now));

if (time(0) - now >= masscan->wait)
control_c_pressed_again = 1;
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 5 additions & 1 deletion src/masscan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 32dfd86

Please sign in to comment.