Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <vector>
- #include "../utils.cpp"
- // use this line to compile
- // g++ -I. -fPIC -shared -g -o speedtest.net.so speedtest.net.cpp
- // regex
- // http.*\.movistar\.com\.pe.*\.jpg
- // http.*\.claro\.com\.pe.*\.jpg
- // http.*\.olo\.com\.pe.*\.jpg
- string get_filename(string url) {
- vector<string> resultado;
- if (url.find("?") != string::npos) {
- stringexplode(url, "?", &resultado);
- stringexplode(resultado.at(resultado.size()-2), "/", &resultado);
- return resultado.at(resultado.size()-1);
- } else {
- stringexplode(url, "/", &resultado);
- return resultado.at(resultado.size()-1);
- }
- }
- extern "C" resposta hgetmatch2(const string url) {
- resposta r;
- r.range_min = 0;
- r.range_max = 0;
- if ( (url.find(".movistar.com.pe/") != string::npos) and
- ( (url.find(".jpg") != string::npos) or (url.find(".swf") != string::npos) ) and
- (url.find("claro.com.pe") == string::npos) and
- (url.find("olo.com.pe") == string::npos)
- ) {
- r.file = get_filename(url);
- if (!r.file.empty()) {
- r.match = true;
- r.domain = "speedtest";
- } else {
- r.match = false;
- }
- } else {
- r.match = false;
- }
- return r;
- }
- //HEADERS
- Request URL:http://speedtest4.claro.com.pe/speedtest/upload.php?x=0.7752903765067458
- Request URL:http://speedtest.movistar.com.pe/speedtest/latency.txt?x=1365780932390
- Request URL:http://o.speedtest.olo.com.pe/speedtest/latency.txt?x=1365781928671
- Request URL:http://c.speedtest.net/flash/standard-wide-long.swf?v=326308
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement