Apply each Fake Packet method to each packet separately

Before: --set-ttl and --wrong-chksum generated single Fake Packet with both low TTL and incorrect checksum.
Now:    --set-ttl and --wrong-chksum generate two packets: one with low TTL, another with incorrect checksum.
This commit is contained in:
ValdikSS 2021-12-25 10:49:26 +03:00
parent 5b79d8e8ba
commit b57a204d96

View File

@ -127,6 +127,28 @@ static int send_fake_data(const HANDLE w_filter,
return 0; return 0;
} }
static int send_fake_request(const HANDLE w_filter,
const PWINDIVERT_ADDRESS addr,
const char *pkt,
const UINT packetLen,
const BOOL is_ipv6,
const BOOL is_https,
const BYTE set_ttl,
const BYTE set_checksum
) {
if (set_ttl) {
send_fake_data(w_filter, addr, pkt, packetLen,
is_ipv6, is_https,
set_ttl, FALSE);
}
if (set_checksum) {
send_fake_data(w_filter, addr, pkt, packetLen,
is_ipv6, is_https,
FALSE, set_checksum);
}
return 0;
}
int send_fake_http_request(const HANDLE w_filter, int send_fake_http_request(const HANDLE w_filter,
const PWINDIVERT_ADDRESS addr, const PWINDIVERT_ADDRESS addr,
const char *pkt, const char *pkt,
@ -135,15 +157,9 @@ int send_fake_http_request(const HANDLE w_filter,
const BYTE set_ttl, const BYTE set_ttl,
const BYTE set_checksum const BYTE set_checksum
) { ) {
return send_fake_data(w_filter, return send_fake_request(w_filter, addr, pkt, packetLen,
addr, is_ipv6, FALSE,
pkt, set_ttl, set_checksum);
packetLen,
is_ipv6,
FALSE,
set_ttl,
set_checksum
);
} }
int send_fake_https_request(const HANDLE w_filter, int send_fake_https_request(const HANDLE w_filter,
@ -154,13 +170,7 @@ int send_fake_https_request(const HANDLE w_filter,
const BYTE set_ttl, const BYTE set_ttl,
const BYTE set_checksum const BYTE set_checksum
) { ) {
return send_fake_data(w_filter, return send_fake_request(w_filter, addr, pkt, packetLen,
addr, is_ipv6, TRUE,
pkt, set_ttl, set_checksum);
packetLen,
is_ipv6,
TRUE,
set_ttl,
set_checksum
);
} }