diff --git a/binaries/aarch64/nfqws b/binaries/aarch64/nfqws index a2d0ba1..f78cc6c 100755 Binary files a/binaries/aarch64/nfqws and b/binaries/aarch64/nfqws differ diff --git a/binaries/armhf/nfqws b/binaries/armhf/nfqws index 6ae84c5..33c8e3c 100755 Binary files a/binaries/armhf/nfqws and b/binaries/armhf/nfqws differ diff --git a/binaries/mips32r1-lsb/nfqws b/binaries/mips32r1-lsb/nfqws index 8b1b750..ec9fc05 100755 Binary files a/binaries/mips32r1-lsb/nfqws and b/binaries/mips32r1-lsb/nfqws differ diff --git a/binaries/mips32r1-msb/nfqws b/binaries/mips32r1-msb/nfqws index 75f357c..9fb2270 100755 Binary files a/binaries/mips32r1-msb/nfqws and b/binaries/mips32r1-msb/nfqws differ diff --git a/binaries/mips64r2-msb/nfqws b/binaries/mips64r2-msb/nfqws index ad43487..6ccfc8b 100755 Binary files a/binaries/mips64r2-msb/nfqws and b/binaries/mips64r2-msb/nfqws differ diff --git a/binaries/ppc/nfqws b/binaries/ppc/nfqws index b22c8c7..a648515 100755 Binary files a/binaries/ppc/nfqws and b/binaries/ppc/nfqws differ diff --git a/binaries/x86/nfqws b/binaries/x86/nfqws index 64f49f4..0d05d6e 100755 Binary files a/binaries/x86/nfqws and b/binaries/x86/nfqws differ diff --git a/binaries/x86_64/nfqws b/binaries/x86_64/nfqws index e70e4d6..34829c2 100755 Binary files a/binaries/x86_64/nfqws and b/binaries/x86_64/nfqws differ diff --git a/nfq/desync.c b/nfq/desync.c index 5cbf755..71f4326 100644 --- a/nfq/desync.c +++ b/nfq/desync.c @@ -83,6 +83,7 @@ packet_process_result dpi_desync_packet(uint8_t *data_pkt, size_t len_pkt, struc char host[256]; bool bHaveHost=false; bool bIsHttp; + uint8_t *phost; if (bIsHttp = IsHttp(data_payload,len_payload)) { @@ -127,34 +128,33 @@ packet_process_result dpi_desync_packet(uint8_t *data_pkt, size_t len_pkt, struc DLOG("not applying tampering to this request\n") return res; } + } - uint8_t *phost; - if (bIsHttp && (params.hostcase || params.hostnospace) && (phost = (uint8_t*)memmem(data_payload, len_payload, "\r\nHost: ", 8))) + if (bIsHttp && (params.hostcase || params.hostnospace) && (phost = (uint8_t*)memmem(data_payload, len_payload, "\r\nHost: ", 8))) + { + if (params.hostcase) { - if (params.hostcase) + DLOG("modifying Host: => %c%c%c%c:\n", params.hostspell[0], params.hostspell[1], params.hostspell[2], params.hostspell[3]) + memcpy(phost + 2, params.hostspell, 4); + res=modify; + } + uint8_t *pua; + if (params.hostnospace && + (pua = (uint8_t*)memmem(data_payload, len_payload, "\r\nUser-Agent: ", 14)) && + (pua = (uint8_t*)memmem(pua + 1, len_payload - (pua - data_payload) - 1, "\r\n", 2))) + { + DLOG("removing space after Host: and adding it to User-Agent:\n") + if (pua > phost) { - DLOG("modifying Host: => %c%c%c%c:\n", params.hostspell[0], params.hostspell[1], params.hostspell[2], params.hostspell[3]) - memcpy(phost + 2, params.hostspell, 4); - res=modify; + memmove(phost + 7, phost + 8, pua - phost - 8); + phost[pua - phost - 1] = ' '; } - uint8_t *pua; - if (params.hostnospace && - (pua = (uint8_t*)memmem(data_payload, len_payload, "\r\nUser-Agent: ", 14)) && - (pua = (uint8_t*)memmem(pua + 1, len_payload - (pua - data_payload) - 1, "\r\n", 2))) + else { - DLOG("removing space after Host: and adding it to User-Agent:\n") - if (pua > phost) - { - memmove(phost + 7, phost + 8, pua - phost - 8); - phost[pua - phost - 1] = ' '; - } - else - { - memmove(pua + 1, pua, phost - pua + 7); - *pua = ' '; - } - res=modify; + memmove(pua + 1, pua, phost - pua + 7); + *pua = ' '; } + res=modify; } }