42-archive/nmap/includes/nmap.h
Jack Halford cc0bc24e90 mre stuff
2017-10-26 17:20:30 +02:00

97 lines
2.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_ping.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/22 14:10:24 by jhalford #+# #+# */
/* Updated: 2017/10/26 17:07:40 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_PING_H
# define FT_PING_H
# include "libft.h"
# include <fcntl.h>
# include <errno.h>
# include <sys/socket.h>
# include <sys/time.h>
# include <resolv.h>
# include <netdb.h>
# include <net/if.h>
# include <netinet/in.h>
# include <netinet/ip.h>
# include <netinet/tcp.h>
# include <netinet/ip_icmp.h>
# include <netinet/if_ether.h>
# include <pcap.h>
# include <sys/wait.h>
# include <ifaddrs.h>
# include "libmill.h"
typedef struct s_data t_data;
typedef struct s_host t_host;
typedef struct s_job t_job;
typedef struct s_result t_result;
typedef enum e_port_status t_port_status;
typedef enum e_scan_type t_scan_type;
enum e_scan_type
{
SCAN_TCP,
SCAN_SYN,
SCAN_ACK,
SCAN_FIN,
SCAN_XMAS,
SCAN_UDP,
SCAN_MAX
};
enum e_port_status
{
OPEN,
FILTERED,
CLOSED,
UNFILTERED,
OPEN_FILTERED,
};
struct s_data
{
t_flag flag;
char **av_data;
};
struct s_job
{
ipaddr dest;
void (*scan)();
};
struct s_result
{
ipaddr dest;
char scan[4];
t_port_status status;
};
extern t_cliopts g_opts[];
extern int g_njobs;
chan nmap_parse(int ac, char **av);
void nmap_format(chan results);
coroutine void nmap_scan_tcp(chan results, t_job job);
pcap_t *nmap_capture(ipaddr dst, ipaddr src);
/*
** IP helpers
*/
uint16_t ipport(ipaddr ip);
uint16_t ipmode(ipaddr ip);
uint16_t ipfamily(ipaddr ip);
ipaddr iplocal_randport(const char *name, int mode, int sock);
#endif