Compare commits

...

8 Commits

Author SHA1 Message Date
SashaXser ae40d1a433
Update goodbyedpi.c 2023-11-27 22:21:30 +04:00
SashaXser bcfa72dbac
Update goodbyedpi.c 2023-11-27 22:12:13 +04:00
SashaXser e3937e4188
Update goodbyedpi.c 2023-11-27 21:40:10 +04:00
SashaXser bcc78bdf7a
Update goodbyedpi.c 2023-11-27 21:38:21 +04:00
SashaXser 069a4d3e30
Update goodbyedpi.c 2023-11-27 21:35:47 +04:00
SashaXser e98f20bfdc
Update goodbyedpi.c 2023-11-27 21:33:36 +04:00
SashaXser b259a82144
Update goodbyedpi.c 2023-11-27 21:22:22 +04:00
SashaXser 3dff8c4841
Update goodbyedpi.c 2023-11-27 21:19:00 +04:00
1 changed files with 14 additions and 6 deletions

View File

@ -428,22 +428,27 @@ static inline void change_window_size(const PWINDIVERT_TCPHDR ppTcpHdr, unsigned
/* HTTP method end without trailing space */
static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *is_fragmented) {
unsigned int i;
unsigned int pkt_length = strlen(pkt);
for (i = 0; i<(sizeof(http_methods) / sizeof(*http_methods)); i++) {
unsigned int method_length = strlen(http_methods[i]);
if (memcmp(pkt, http_methods[i], method_length) == 0) {
if (is_fragmented)
*is_fragmented = 0;
return (char*)pkt + method_length - 1;
char *end = strchr(pkt + method_length, ' ');
if (end != NULL && end - pkt <= pkt_length)
return end;
}
/* Try to find HTTP method in a second part of fragmented packet */
if ((http_frag == 1 || http_frag == 2) &&
memcmp(pkt, http_methods[i] + http_frag,
method_length - http_frag) == 0
method_length - http_frag) == 0
)
{
if (is_fragmented)
*is_fragmented = 1;
return (char*)pkt + method_length - http_frag - 1;
char *end = strchr(pkt + method_length - http_frag, ' ');
if (end != NULL && end - pkt <= pkt_length)
return end;
}
}
return NULL;
@ -451,6 +456,7 @@ static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *
/** Fragment and send the packet.
*
* This function cuts off the end of the packet (step=0) or
@ -807,15 +813,17 @@ int main(int argc, char *argv[]) {
char *autottl_copy = strdup(optarg);
if (strchr(autottl_copy, '-')) {
// token "-" found, start X-Y parser
char *autottl_current = strtok(autottl_copy, "-");
char *autottl_current;
char *saveptr; // declare a pointer to store the state of strtok_r
autottl_current = strtok_r(autottl_copy, "-", &saveptr);
auto_ttl_1 = atoub(autottl_current, "Set Auto TTL parameter error!");
autottl_current = strtok(NULL, "-");
autottl_current = strtok_r(NULL, "-", &saveptr);
if (!autottl_current) {
puts("Set Auto TTL parameter error!");
exit(EXIT_FAILURE);
}
auto_ttl_2 = atoub(autottl_current, "Set Auto TTL parameter error!");
autottl_current = strtok(NULL, "-");
autottl_current = strtok_r(NULL, "-", &saveptr);
if (!autottl_current) {
puts("Set Auto TTL parameter error!");
exit(EXIT_FAILURE);