feature: start to implement responses
This commit is contained in:
11
include/host.h
Normal file
11
include/host.h
Normal file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <limits.h>
|
||||
#include <linux/if.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
struct host {
|
||||
char name[HOST_NAME_MAX];
|
||||
char ip[INET_ADDRSTRLEN];
|
||||
char interface[IFNAMSIZ];
|
||||
};
|
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
char *get_interface_name(void);
|
||||
#include "host.h"
|
||||
|
||||
int get_interface_name(struct host *host);
|
||||
|
23
include/response.h
Normal file
23
include/response.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "scan.h"
|
||||
|
||||
typedef enum {
|
||||
OPEN,
|
||||
CLOSE,
|
||||
FILTERED,
|
||||
UNFILTERED,
|
||||
} e_state;
|
||||
|
||||
struct response {
|
||||
uint16_t port;
|
||||
e_state state;
|
||||
char *service;
|
||||
};
|
||||
|
||||
void tcp_response(struct tcphdr *tcp, const struct scan *data);
|
||||
void udp_response(struct udphdr *udp, const struct scan *data);
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "response.h"
|
||||
|
||||
typedef enum {
|
||||
SCAN_SYN,
|
||||
SCAN_NULL,
|
||||
@ -12,5 +15,13 @@ typedef enum {
|
||||
SCAN_TCP,
|
||||
} e_scantype;
|
||||
|
||||
int routine(const char *ip_addr, e_scantype type, uint16_t min_port,
|
||||
uint16_t max_port);
|
||||
struct scan {
|
||||
const struct host *host;
|
||||
const char *dest_addr;
|
||||
uint16_t port_start;
|
||||
uint16_t port;
|
||||
e_scantype type;
|
||||
struct response *response;
|
||||
};
|
||||
|
||||
int scan(const struct scan *data);
|
||||
|
18
include/thread.h
Normal file
18
include/thread.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "host.h"
|
||||
#include "response.h"
|
||||
#include "scan.h"
|
||||
|
||||
struct thread {
|
||||
uint16_t port_start;
|
||||
uint16_t port_end;
|
||||
char *dest_addr;
|
||||
e_scantype type;
|
||||
struct host host;
|
||||
struct response *responses;
|
||||
};
|
||||
|
||||
void *routine(void *p_data);
|
Reference in New Issue
Block a user