add: multi scan

This commit is contained in:
2025-07-02 07:09:54 -05:00
parent a5d663fa9a
commit afde93c7cf
8 changed files with 133 additions and 104 deletions

View File

@ -28,6 +28,6 @@ struct option_lst {
struct option_lst *parse_options(int ac, char *const *av);
char *get_option_arg(const struct option_lst *options, e_flag flag);
bool option_isset(const struct option_lst *options, e_flag flag);
e_scantype parse_type(const char *arg);
uint8_t parse_type(char *arg);
void free_options(struct option_lst *options);
int parsing(struct scan *general, const struct option_lst *options);

View File

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

View File

@ -4,26 +4,26 @@
#include "host.h"
typedef enum {
SCAN_NULL,
SCAN_SYN,
SCAN_ACK,
SCAN_FIN,
SCAN_XMAS,
SCAN_UDP,
SCAN_ALL,
} e_scantype;
#define SCAN_NULL (1 << 0)
#define SCAN_SYN (1 << 1)
#define SCAN_ACK (1 << 2)
#define SCAN_FIN (1 << 3)
#define SCAN_XMAS (1 << 4)
#define SCAN_UDP (1 << 5)
#define SCAN_ALL (SCAN_NULL | SCAN_SYN | SCAN_ACK | SCAN_FIN | SCAN_XMAS | SCAN_UDP)
[[__maybe_unused__]] static const char *types_str[] = {
"NULL", "SYN", "ACK", "FIN", "XMAS", "UDP",
};
#define NB_SCAN (sizeof(types_str) / sizeof(*types_str))
struct scan {
struct host host;
char *dest_addr;
uint16_t port_start;
uint16_t port_end;
e_scantype type;
uint8_t type;
uint8_t ttl;
uint8_t max_retries;
struct response *responses;