// Packet to match 6 rules: Personal Document, Birth Date, Email, Address, Full Name and PhoneNumber
char packet_match_6rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr"
- "=p%d02/02/1972%2emailtest@test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
- "1237123461234567890"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec6";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr"
+ "=p%d02/02/1972%2emailtest@test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
+ "1237123461234567890"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec6";
// Packet to match 5 rules: Personal Document, Email, Address, Full Name and PhoneNumber
char packet_match_5rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
- "1237123461234567890"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec5";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.445544552AUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
+ "1237123461234567890"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec5";
// Packet to match 4 rules: Email, Address, Full Name and PhoneNumber
char packet_match_4rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
- "123712346"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec4";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2John Doe%220 Sunny Street%3vo"
+ "123712346"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec4";
// Packet to match 3 rules: Email, Full Name and PhoneNumber
char packet_match_3rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2John Doe%25858655sf234546%3vo"
- "123712346"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec3";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2John Doe%25858655sf234546%3vo"
+ "123712346"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec3";
// Packet to match 2 rules: Email and PhoneNumber
char packet_match_2rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
- "123712346"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec2";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest@test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
+ "123712346"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec2";
// Packet to match 1 rules: PhoneNumber
char packet_match_1rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
- "123712346"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec1";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
+ "123712346"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec1";
// Packet to match 0 rules
char packet_match_0rules[] = "GET /sync/pubmatic/csrc/7/44D1C4FE-60A-4 HTTP/1.1" \
- "Host: pr-bh.ybp.yahoo.com" \
- "Connection: keep-alive"
- "Accept: image/webp,image/*,*/*;q=0.8"
- "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
- "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
- "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
- "Referer: https://br.news.search.yahoo.com/search;"
- "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
- "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo"
- "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
- "123715346"
- "Accept-Encoding: gzip, deflate"
- "Accept-Language: en-US"
- "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec0";
+ "Host: pr-bh.ybp.yahoo.com" \
+ "Connection: keep-alive"
+ "Accept: image/webp,image/*,*/*;q=0.8"
+ "User-Agent: Mozilla/5.0 (Linux; Tizen 3.0;SAMSUNG"
+ "TM1) AppleWebKit/537.36 (KHTML, like Gecko) Samsu"
+ "ngBrowser/1.0 Chrome/47.0.2526.6 Mobile safari/53"
+ "Referer: https://br.news.search.yahoo.com/search;"
+ "ylt=A2KLj.sdfvcbytuAUAj16Qt.?p=353418070114639&fr"
+ "=p%dfdjghskjdf%2emailtest-test.orgasdasdCm%3Apivo"
+ "Chjsad%3As%2Cv%3Ai%2dfr32r35%25858655sf234546%3vo"
+ "123715346"
+ "Accept-Encoding: gzip, deflate"
+ "Accept-Language: en-US"
+ "Cookie: B=b74b8llci8lhm&b=3&s=nn; ypcdb=00d340ec0";
///////////////////////////////////////////////////////////////////////////////
// test utilities
__start_test_executions(__FUNCTION__, number_of_executions);
- switch (n_rules) {
- case 0:
- packet = packet_match_0rules;
- break;
- case 1:
- packet = packet_match_1rules;
- break;
- case 2:
- packet = packet_match_2rules;
- break;
- case 3:
- packet = packet_match_3rules;
- break;
- case 4:
- packet = packet_match_4rules;
- break;
- case 5:
- packet = packet_match_5rules;
- break;
- case 6:
- packet = packet_match_6rules;
- break;
- default:
- packet = packet_match_1rules;
- break;
- }
+ switch (n_rules) {
+ case 0:
+ packet = packet_match_0rules;
+ break;
+ case 1:
+ packet = packet_match_1rules;
+ break;
+ case 2:
+ packet = packet_match_2rules;
+ break;
+ case 3:
+ packet = packet_match_3rules;
+ break;
+ case 4:
+ packet = packet_match_4rules;
+ break;
+ case 5:
+ packet = packet_match_5rules;
+ break;
+ case 6:
+ packet = packet_match_6rules;
+ break;
+ default:
+ packet = packet_match_1rules;
+ break;
+ }
- packet_to_send = strdup(packet);
+ packet_to_send = strdup(packet);
// If needs to increase payload size...
- for (count = 1; count < payload_multiply; count++) {
- // ...just duplicate the payload content
- char* new_packet_to_send = malloc(strlen(packet_to_send)+strlen(packet_to_send)+1);
+ for (count = 1; count < payload_multiply; count++) {
+ // ...just duplicate the payload content
+ char* new_packet_to_send = malloc(strlen(packet_to_send)+strlen(packet_to_send)+1);
- if (new_packet_to_send != NULL) {
- pg_strlcpy(new_packet_to_send, packet_to_send, strlen(packet_to_send));
- strncat(new_packet_to_send, packet_to_send, sizeof(new_packet_to_send) - strlen(new_packet_to_send) - 1);
+ if (new_packet_to_send != NULL) {
+ pg_strlcpy(new_packet_to_send, packet_to_send, strlen(packet_to_send));
+ strncat(new_packet_to_send, packet_to_send, sizeof(new_packet_to_send) - strlen(new_packet_to_send) - 1);
packet_to_send = strdup(new_packet_to_send);
free(new_packet_to_send);
- }
- }
+ }
+ }
- printf("Sending %d bytes\n", strlen(packet_to_send));
+ printf("Sending %d bytes\n", strlen(packet_to_send));
for (count = 0; count < number_of_executions; count++) {
- if(show_clock) clock_gettime(CLOCK_REALTIME, &tp_before);
+ if (show_clock)
+ clock_gettime(CLOCK_REALTIME, &tp_before);
privacy_guard_dlp_check_leak("fakehost.net", packet_to_send, strlen(packet_to_send));
- if(show_clock) clock_gettime(CLOCK_REALTIME, &tp_after);
- if(show_clock) interval[count] = (tp_after.tv_sec - tp_before.tv_sec) * 1000000000 + tp_after.tv_nsec - tp_before.tv_nsec;
+ if (show_clock) clock_gettime(CLOCK_REALTIME, &tp_after);
+ if (show_clock) interval[count] = (tp_after.tv_sec - tp_before.tv_sec) * 1000000000 + tp_after.tv_nsec - tp_before.tv_nsec;
}
+ free(packet_to_send);
+
__finish_test();
}
char *p;
n_iterations = strtol(argv[idx+1], &p, 10);
- if(n_iterations > 5000) {
+ if (n_iterations > 5000) {
printf("Not allow to execute more than 5000 tests\n");
return -1;
}
char *p;
payload_multiply = strtol(argv[idx+1], &p, 10);
- if(payload_multiply > 10) {
+ if (payload_multiply > 10) {
printf("Invalid value for -m parameter\n");
return -1;
}
char *p;
n_rules = strtol(argv[idx+1], &p, 10);
- if(n_rules > 6) {
+ if (n_rules > 6) {
printf("Not allow to execute more than 6 rules\n");
return -1;
}
__change_color_to_origin();
if (show_clock)
- for (idx=0; idx < n_iterations; idx++)
+ for (idx = 0; idx < n_iterations; idx++)
printf("req %03d:\t%ld\tns\n", idx, interval[idx]);
return 0;