Fix bug with pastseq and frag-sni-faked

This commit is contained in:
Vadim Vetrov 2024-08-21 12:25:13 +03:00
parent e62d76e1d6
commit c10393983a
No known key found for this signature in database
GPG Key ID: E8A308689D7A73A5
2 changed files with 14 additions and 2 deletions

View File

@ -24,8 +24,11 @@
#define lgdebugmsg(msg, ...) \
(LOG_LEVEL >= VERBOSE_DEBUG ? printf(msg "\n", ##__VA_ARGS__) : 0)
#define lgtracemsg(msg, ...) \
(LOG_LEVEL >= VERBOSE_TRACE ? printf(msg "\n", ##__VA_ARGS__) : 0)
#define lgtrace(msg, ...) \
(LOG_LEVEL >= VERBOSE_TRACE ? printf(msg, ##__VA_ARGS__) : 0)
#define lgtracemsg(msg, ...) lgtrace(msg "\n", __VA_ARGS__)
#define lgtrace_start(msg, ...) \
(LOG_LEVEL >= VERBOSE_TRACE ? printf("[TRACE] " msg " ( ", ##__VA_ARGS__) : 0)

View File

@ -382,6 +382,12 @@ send_fake:
}
memcpy(fake_pad, frag2, iphfl + tcphfl);
memset(fake_pad + iphfl + tcphfl, 0, f2len - iphfl - tcphfl);
struct tcphdr *fakethdr = (void *)(fake_pad + iphfl);
if (config.faking_strategy == FAKE_STRAT_PAST_SEQ) {
lgtrace("frag fake sent with %d -> ", ntohl(fakethdr->seq));
fakethdr->seq = htonl(ntohl(fakethdr->seq) - dvs);
lgtrace("%d\n", ntohl(fakethdr->seq));
}
ret = fail4_packet(fake_pad, f2len);
if (ret < 0) {
lgerror("Failed to fail packet", ret);
@ -752,7 +758,10 @@ int fail4_packet(uint8_t *payload, uint32_t plen) {
tcph->ack_seq = random();
#endif
} else if (config.faking_strategy == FAKE_STRAT_PAST_SEQ) {
lgtrace("fake sent with %d -> ", ntohl(tcph->seq));
tcph->seq = htonl(ntohl(tcph->seq) - dlen);
lgtrace("%d\n", ntohl(tcph->seq));
} else if (config.faking_strategy == FAKE_STRAT_TTL) {
iph->ttl = config.faking_ttl;
}