2021-03-04 11:30:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "darkmagic.h"
|
|
|
|
#include "nfqws.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/ip6.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
|
|
|
#ifdef __linux__
|
|
|
|
#define DPI_DESYNC_FWMARK_DEFAULT 0x40000000
|
|
|
|
#else
|
|
|
|
#define DPI_DESYNC_FWMARK_DEFAULT 512
|
|
|
|
#endif
|
|
|
|
|
2021-03-19 12:47:28 +00:00
|
|
|
#define DPI_DESYNC_MAX_FAKE_LEN 9216
|
2021-03-04 11:30:38 +00:00
|
|
|
|
|
|
|
enum dpi_desync_mode {
|
|
|
|
DESYNC_NONE=0,
|
|
|
|
DESYNC_INVALID,
|
|
|
|
DESYNC_FAKE,
|
|
|
|
DESYNC_RST,
|
|
|
|
DESYNC_RSTACK,
|
2021-04-07 09:13:46 +00:00
|
|
|
DESYNC_SYNACK,
|
2021-03-04 11:30:38 +00:00
|
|
|
DESYNC_DISORDER,
|
|
|
|
DESYNC_DISORDER2,
|
|
|
|
DESYNC_SPLIT,
|
2022-01-03 09:38:18 +00:00
|
|
|
DESYNC_SPLIT2,
|
2022-02-01 17:35:52 +00:00
|
|
|
DESYNC_IPFRAG2,
|
2022-02-05 10:36:03 +00:00
|
|
|
DESYNC_HOPBYHOP,
|
|
|
|
DESYNC_DESTOPT
|
2021-03-04 11:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const char *fake_http_request_default;
|
|
|
|
extern const uint8_t fake_tls_clienthello_default[517];
|
|
|
|
|
|
|
|
enum dpi_desync_mode desync_mode_from_string(const char *s);
|
2021-04-07 09:13:46 +00:00
|
|
|
bool desync_valid_zero_stage(enum dpi_desync_mode mode);
|
2021-03-04 11:30:38 +00:00
|
|
|
bool desync_valid_first_stage(enum dpi_desync_mode mode);
|
2022-02-01 17:35:52 +00:00
|
|
|
bool desync_only_first_stage(enum dpi_desync_mode mode);
|
2021-03-04 11:30:38 +00:00
|
|
|
bool desync_valid_second_stage(enum dpi_desync_mode mode);
|
|
|
|
|
|
|
|
void desync_init();
|
2022-01-01 17:22:04 +00:00
|
|
|
packet_process_result dpi_desync_tcp_packet(uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct tcphdr *tcphdr, size_t len_tcp, uint8_t *data_payload, size_t len_payload);
|
|
|
|
packet_process_result dpi_desync_udp_packet(uint8_t *data_pkt, size_t len_pkt, struct ip *ip, struct ip6_hdr *ip6hdr, struct udphdr *udphdr, uint8_t *data_payload, size_t len_payload);
|