add: multi scan
This commit is contained in:
23
src/print.c
23
src/print.c
@ -31,20 +31,18 @@ void print_config(const struct scan *general, const char *hosts_path,
|
||||
printf("Number of scans to be performed: %d\n",
|
||||
general->port_end - general->port_start + 1);
|
||||
printf("Scans to be performed: ");
|
||||
if (general->type == SCAN_ALL)
|
||||
for (e_scantype type = SCAN_NULL; type < SCAN_ALL; type++)
|
||||
for (uint8_t type = 0; type < NB_SCAN; type++)
|
||||
if (general->type & (1 << type))
|
||||
printf("%s ", types_str[type]);
|
||||
else
|
||||
printf("%s", types_str[general->type]);
|
||||
printf("\n");
|
||||
if (nb_threads > 1)
|
||||
printf("No of threads: %d\n", nb_threads);
|
||||
}
|
||||
|
||||
bool is_port_opened(const e_state states[6], e_scantype type)
|
||||
bool is_port_opened(const e_state states[6], uint8_t type)
|
||||
{
|
||||
if (type == SCAN_ALL) {
|
||||
for (e_scantype i = SCAN_NULL; i < SCAN_ALL; i++)
|
||||
for (uint8_t i = 0; i < NB_SCAN; i++)
|
||||
if (states[i] == OPENED)
|
||||
return true;
|
||||
return false;
|
||||
@ -52,20 +50,19 @@ bool is_port_opened(const e_state states[6], e_scantype type)
|
||||
return states[type] == OPENED;
|
||||
}
|
||||
|
||||
static void print_port_state(uint16_t port, e_scantype type,
|
||||
static void print_port_state(uint16_t port, uint8_t type,
|
||||
const struct response *response)
|
||||
{
|
||||
printf("%-5d %-12s ", port,
|
||||
response->service ? response->service : "Unassigned");
|
||||
if (response->service)
|
||||
free(response->service);
|
||||
if (type == SCAN_ALL)
|
||||
for (e_scantype i = SCAN_NULL; i < SCAN_ALL; i++)
|
||||
for (uint8_t i = 0; i < NB_SCAN; i++)
|
||||
{
|
||||
if ((1 << i) & type)
|
||||
printf("%s(%s) ", types_str[i],
|
||||
states_str[response->states[i]]);
|
||||
else
|
||||
printf("%s(%s) ", types_str[type],
|
||||
states_str[response->states[type]]);
|
||||
states_str[response->states[i]]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user