fix: better response handling for prints

This commit is contained in:
0x35c
2025-05-31 17:10:03 +02:00
parent 0f8d184aee
commit 6164363cce
3 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,7 @@ typedef enum {
};
struct response {
uint16_t port;
e_state states[SCAN_ALL];
char *service;
};

View File

@ -25,6 +25,7 @@ static int scan_host(char *host, const struct option_lst *options)
return 1;
}
printf("%s\n", ip_addr);
struct response responses[1024] = {0};
if (create_threads(options, ip_addr, responses) < 0)
return 1;
@ -35,7 +36,7 @@ static int scan_host(char *host, const struct option_lst *options)
const e_scantype type = SCAN_SYN;
if (responses[i].states[type] == CLOSED)
continue;
printf("%d (%s): ", i + 1,
printf("%d (%s): ", responses[i].port,
responses[i].service ? responses[i].service
: "undefined");
if (responses[i].service)

View File

@ -41,6 +41,7 @@ void *routine(void *p_data)
port <= thread_data->port_end; port++) {
scan_data.port = port;
scan_data.response = &thread_data->responses[port - 1];
scan_data.response->port = port;
if (scan(&scan_data)) {
free(p_data);
return NULL;