Compare commits

..

3 Commits

Author SHA1 Message Date
3ebface620 clean: add ttl and max_retries in usage print 2025-06-12 07:17:40 -05:00
f91bc39762 fix: leak when -h 2025-06-12 07:13:36 -05:00
957bb06d97 clean: remove useless arg 2025-06-12 07:12:34 -05:00
4 changed files with 7 additions and 9 deletions

View File

@ -2,6 +2,5 @@
#include <netinet/in.h>
int dns_lookup(char *ip_addr, const char *hostname,
struct sockaddr_in *addr_con);
int dns_lookup(char *ip_addr, const char *hostname);
int reverse_dns_lookup(char *ip_addr, char *host);

View File

@ -6,8 +6,7 @@
#include <string.h>
#include <sys/socket.h>
int dns_lookup(char *ip_addr, const char *hostname,
struct sockaddr_in *addr_con)
int dns_lookup(char *ip_addr, const char *hostname)
{
struct hostent *host = gethostbyname2(hostname, AF_INET);
if (!host) {
@ -17,9 +16,6 @@ int dns_lookup(char *ip_addr, const char *hostname,
return -1;
}
strcpy(ip_addr, inet_ntoa(*(struct in_addr *)host->h_addr));
(*addr_con).sin_family = host->h_addrtype;
(*addr_con).sin_port = htons(0);
(*addr_con).sin_addr.s_addr = *(long *)host->h_addr;
return 0;
}

View File

@ -16,8 +16,7 @@
static int scan_host(struct scan *general, uint8_t nb_threads)
{
struct sockaddr_in addr_con;
if (dns_lookup(general->dest_addr, general->dest_addr, &addr_con)) {
if (dns_lookup(general->dest_addr, general->dest_addr)) {
return -1;
}
@ -52,6 +51,7 @@ int main(int ac, char **av)
}
if (option_isset(options, FL_HELP)) {
free_options(options);
print_usage();
return 0;
}

View File

@ -14,6 +14,9 @@ void print_usage(void)
printf("--file: File name containing IP addresses to scan\n");
printf("--speedup: [250 max] number of parallel threads to use\n");
printf("--scan: NULL/SYN/FIN/XMAS/ACK/UDP\n");
printf("--max_retries: number of retries when host doesn't reply\n");
printf("--ttl: precise the ttl\n");
}
void print_config(const struct scan *general, const char *hosts_path,