feature: flags -F, --max_retries and --ttl (wip)

This commit is contained in:
0x35c
2025-05-31 16:37:24 +02:00
parent ee2af274d9
commit dbed6dc7cd
6 changed files with 120 additions and 31 deletions

View File

@ -1,18 +1,22 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "scan.h"
#define NB_OPTIONS 6
typedef enum {
// long options
FL_HELP,
FL_PORTS,
FL_IP,
FL_FILE,
FL_SPEEDUP,
FL_SCAN,
FL_MAXRETRIES,
FL_TTL,
// short options
FL_FAST,
} e_flag;
struct option_lst {
@ -22,6 +26,7 @@ struct option_lst {
};
struct option_lst *parse_options(int ac, char *const *av);
bool option_isset(const struct option_lst *options, e_flag flag);
char *get_option_arg(const struct option_lst *options, e_flag flag);
int parse_ports(const char *arg, uint16_t *start, uint16_t *end);
e_scantype parse_type(const char *arg);

View File

@ -20,6 +20,8 @@ struct scan {
uint16_t port_start;
uint16_t port;
e_scantype type;
uint8_t ttl;
uint8_t max_retries;
struct response *response;
};

View File

@ -12,6 +12,8 @@ struct thread {
uint16_t port_end;
char *dest_addr;
e_scantype type;
uint8_t max_retries;
uint8_t ttl;
struct host host;
struct response *responses;
};