Skip to content

Commit bc95b6f

Browse files
committed
--fake-resend option: repeat sending each fake packet number of times
1 parent 985a09c commit bc95b6f

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Usage: goodbyedpi.exe [OPTION...]
6969
would be sent on every request in the command line argument order.
7070
--fake-gen <value> Generate random-filled fake packets for Fake Request Mode, value of them
7171
(up to 30).
72+
--fake-resend <value> Send each fake packet value number of times.
73+
Default: 1 (send each packet once).
7274
--max-payload [value] packets with TCP payload data more than [value] won't be processed.
7375
Use this option to reduce CPU usage by skipping huge amount of data
7476
(like file transfers) in already established sessions.

src/fakepackets.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct fake_t {
1616

1717
static struct fake_t *fakes[30] = {0};
1818
int fakes_count = 0;
19+
int fakes_resend = 1;
1920

2021
static const unsigned char fake_http_request[] = "GET / HTTP/1.1\r\nHost: www.w3.org\r\n"
2122
"User-Agent: curl/7.65.3\r\nAccept: */*\r\n"
@@ -198,7 +199,8 @@ int send_fake_http_request(const HANDLE w_filter,
198199
) {
199200
int ret = 0;
200201
for (int i=0; i<fakes_count || i == 0; i++) {
201-
if (send_fake_request(w_filter, addr, pkt, packetLen,
202+
for (int j=0; j<fakes_resend; j++)
203+
if (send_fake_request(w_filter, addr, pkt, packetLen,
202204
is_ipv6, FALSE,
203205
set_ttl, set_checksum, set_seq,
204206
fakes[i]))
@@ -220,7 +222,8 @@ int send_fake_https_request(const HANDLE w_filter,
220222
) {
221223
int ret = 0;
222224
for (int i=0; i<fakes_count || i == 0; i++) {
223-
if (send_fake_request(w_filter, addr, pkt, packetLen,
225+
for (int j=0; j<fakes_resend; j++)
226+
if (send_fake_request(w_filter, addr, pkt, packetLen,
224227
is_ipv6, TRUE,
225228
set_ttl, set_checksum, set_seq,
226229
fakes[i]))

src/fakepackets.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
extern int fakes_count;
2+
extern int fakes_resend;
23
int send_fake_http_request(const HANDLE w_filter,
34
const PWINDIVERT_ADDRESS addr,
45
const char *pkt,

src/goodbyedpi.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static struct option long_options[] = {
190190
{"max-payload", optional_argument, 0, '|' },
191191
{"fake-from-hex", required_argument, 0, 'u' },
192192
{"fake-gen", required_argument, 0, 'j' },
193+
{"fake-resend", required_argument, 0, 't' },
193194
{"debug-exit", optional_argument, 0, 'x' },
194195
{0, 0, 0, 0 }
195196
};
@@ -952,6 +953,15 @@ int main(int argc, char *argv[]) {
952953
puts("WARNING: fake generator has failed!");
953954
}
954955
break;
956+
case 't': // --fake-resend
957+
fakes_resend = atoub(optarg, "Fake resend parameter error!");
958+
if (fakes_resend == 1)
959+
puts("WARNING: fake-resend is 1, no resending is in place!");
960+
else if (!fakes_resend)
961+
puts("WARNING: fake-resend is 0, fake packet mode is disabled!");
962+
else if (fakes_resend > 100)
963+
puts("WARNING: fake-resend value is a little too high, don't you think?");
964+
break;
955965
case 'x': // --debug-exit
956966
debug_exit = true;
957967
break;
@@ -1005,6 +1015,8 @@ int main(int argc, char *argv[]) {
10051015
" would be sent on every request in the command line argument order.\n"
10061016
" --fake-gen <value> Generate random-filled fake packets for Fake Request Mode, value of them\n"
10071017
" (up to 30).\n"
1018+
" --fake-resend <value> Send each fake packet value number of times.\n"
1019+
" Default: 1 (send each packet once).\n"
10081020
" --max-payload [value] packets with TCP payload data more than [value] won't be processed.\n"
10091021
" Use this option to reduce CPU usage by skipping huge amount of data\n"
10101022
" (like file transfers) in already established sessions.\n"
@@ -1065,7 +1077,8 @@ int main(int argc, char *argv[]) {
10651077
"Fake requests, wrong checksum: %d\n" /* 18 */
10661078
"Fake requests, wrong SEQ/ACK: %d\n" /* 19 */
10671079
"Fake requests, custom payloads: %d\n" /* 20 */
1068-
"Max payload size: %hu\n", /* 21 */
1080+
"Fake requests, resend: %d\n" /* 21 */
1081+
"Max payload size: %hu\n", /* 22 */
10691082
do_passivedpi, do_block_quic, /* 1 */
10701083
(do_fragment_http ? http_fragment_size : 0), /* 2 */
10711084
(do_fragment_http_persistent ? http_fragment_size : 0),/* 3 */
@@ -1087,8 +1100,9 @@ int main(int argc, char *argv[]) {
10871100
do_auto_ttl ? auto_ttl_max : 0, ttl_min_nhops,
10881101
do_wrong_chksum, /* 18 */
10891102
do_wrong_seq, /* 19 */
1090-
fakes_count, /* 20 */
1091-
max_payload_size /* 21 */
1103+
fakes_count, /* 20 */
1104+
fakes_resend, /* 21 */
1105+
max_payload_size /* 22 */
10921106
);
10931107

10941108
if (do_fragment_http && http_fragment_size > 2 && !do_native_frag) {

0 commit comments

Comments
 (0)