diff --git a/args.c b/args.c index dad7efe..5672fd5 100644 --- a/args.c +++ b/args.c @@ -99,7 +99,8 @@ static long parse_numeric_option(const char* value) { void print_version() { printf("youtubeUnblock\n"); - printf("Bypasses youtube detection systems that relies on SNI\n"); + printf("Bypasses deep packet inspection systems that relies on SNI\n"); + printf("\n"); } void print_usage(const char *argv0) { @@ -143,9 +144,10 @@ int parse_args(int argc, char *argv[]) { config.use_gso = 0; break; case OPT_SNI_DOMAINS: - if (strcmp(optarg, "all")) { + if (!strcmp(optarg, "all")) { config.all_domains = 1; } + config.domains_str = optarg; config.domains_strlen = strlen(config.domains_str); @@ -274,3 +276,57 @@ error: errno = EINVAL; return -1; } + +void print_welcome() { + switch (config.fragmentation_strategy) { + case FRAG_STRAT_TCP: + printf("Using TCP segmentation\n"); + break; + case FRAG_STRAT_IP: + printf("Using IP fragmentation\n"); + break; + default: + printf("SNI fragmentation is disabled\n"); + break; + } + + if (config.seg2_delay) { + printf("Some outgoing googlevideo request segments will be delayed for %d ms as of seg2_delay define\n", config.seg2_delay); + } + + if (config.fake_sni) { + printf("Fake SNI will be sent before each target client hello\n"); + } else { + printf("Fake SNI is disabled\n"); + } + + if (config.frag_sni_reverse) { + printf("Fragmentation Client Hello will be reversed\n"); + } + + if (config.frag_sni_faked) { + printf("Fooling packets will be sent near the original Client Hello\n"); + } + + if (config.fake_sni_seq_len > 1) { + printf("Faking sequence of length %d will be built as fake sni\n", config.fake_sni_seq_len); + } + + switch (config.faking_strategy) { + case FAKE_STRAT_TTL: + printf("TTL faking strategy will be used with TTL %d\n", config.faking_ttl); + break; + case FAKE_STRAT_ACK_SEQ: + printf("Ack-Seq faking strategy will be used\n"); + break; + } + + + if (config.use_gso) { + printf("GSO is enabled\n"); + } + + if (config.all_domains) { + printf("All Client Hello will be targetted by youtubeUnblock!\n"); + } +} diff --git a/args.h b/args.h index 44558df..98d65cf 100644 --- a/args.h +++ b/args.h @@ -5,4 +5,7 @@ void print_version(); void print_usage(const char *argv0); int parse_args(int argc, char *argv[]); +/* Prints starting messages */ +void print_welcome(); + #endif /* ARGS_H */ diff --git a/mangle.c b/mangle.c index 0abaa33..0a4d77f 100644 --- a/mangle.c +++ b/mangle.c @@ -183,7 +183,7 @@ int process_packet(const uint8_t *raw_payload, uint32_t raw_payload_len) { if (vrd.target_sni) { if (config.verbose) - printf("SNI target detected\n"); + printf("Target SNI detected: %.*s\n", vrd.sni_len, data + vrd.sni_offset); uint8_t payload[MAX_PACKET_SIZE]; uint32_t payload_len = raw_payload_len; @@ -559,6 +559,9 @@ int tcp4_frag(const __u8 *pkt, __u32 buflen, __u32 payload_offset, s2_hdr->tot_len = htons(s2_dlen); s2_tcph->seq = htonl(ntohl(s2_tcph->seq) + payload_offset); + + s1_tcph->window = htons(1); + s2_tcph->window = htons(1); if (config.verbose) printf("Packet split in portion %u %u\n", s1_plen, s2_plen); diff --git a/youtubeUnblock.c b/youtubeUnblock.c index 9316acb..17eb2e1 100644 --- a/youtubeUnblock.c +++ b/youtubeUnblock.c @@ -454,53 +454,8 @@ int main(int argc, char *argv[]) { exit(EXIT_SUCCESS); } - switch (config.fragmentation_strategy) { - case FRAG_STRAT_TCP: - printf("Using TCP segmentation\n"); - break; - case FRAG_STRAT_IP: - printf("Using IP fragmentation\n"); - break; - default: - printf("SNI fragmentation is disabled\n"); - break; - } - - if (config.seg2_delay) { - printf("Some outgoing googlevideo request segments will be delayed for %d ms as of seg2_delay define\n", config.seg2_delay); - } - - if (config.fake_sni) { - printf("Fake SNI will be sent before each target client hello\n"); - } else { - printf("Fake SNI is disabled\n"); - } - - if (config.frag_sni_reverse) { - printf("Fragmentation Client Hello will be reversed\n"); - } - - if (config.frag_sni_faked) { - printf("Fooling packets will be sent near the original Client Hello\n"); - } - - if (config.fake_sni_seq_len > 1) { - printf("Faking sequence of length %d will be built as fake sni\n", config.fake_sni_seq_len); - } - - switch (config.faking_strategy) { - case FAKE_STRAT_TTL: - printf("TTL faking strategy will be used with TTL %d\n", config.faking_ttl); - break; - case FAKE_STRAT_ACK_SEQ: - printf("Ack-Seq faking strategy will be used\n"); - break; - } - - - if (config.use_gso) { - printf("GSO is enabled\n"); - } + print_version(); + print_welcome(); if (open_raw_socket() < 0) { perror("Unable to open raw socket");