Tengo este código de este plugin, pero es defectuoso. Yo quería compilar el código por BFW, gracias de antemano.
/*
*plugin partial content google pack
*created by grage95
*example http://dl.google.com/chrome/install/1025.168_1025.162/chrome_updater.exe
*http://o-o.preferred.pttelkom-bth1.v10.lscache6.c.pack.google.com/edgedl/chrome/install/1025.168/chrome_installer.exe?
* Use ^http.*\.google\.com.*\.(exe|msi|msp|cab) no bfwcache.acl
* Vida longa ao BFW!
*/
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include "../utils.cpp"
using namespace std;
// use this line to compile
// g++ -I. -fPIC -shared -g -o google.com.so google.com.cpp
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 getmatch(const string url) {
resposta r;
if ( (url.find(".google.com/") != string::npos) and
( (url.find(".exe") != string::npos) || (url.find(".msp") != string::npos) || (url.find(".msi") != string::npos) || (url.find(".cab") != string::npos) )
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "googlepack";
} else {
r.match = false;
}
} else {
r.match = false;
}
return r;
}
Ahí pongo el código que posteo hace tiempo joemg en peruhardware, y que viene en la instalación.
#include <iostream>
#include <cstring>
#include <vector>
#include "../utils.cpp"
// use this line to compile
// g++ -I. -fPIC -shared -g -o google.com.so google.com.cpp
// regex
// http.*\.google\.com.*(\.kmz|\.exe|\.msi|\.msp|\.cab)
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 getmatch(const string url) {
resposta r;
if ( (url.find(".google.com/") != string::npos) and (url.find(".kmz") != string::npos)
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "google-earth";
} else {
r.match = false;
}
}
else if ( (url.find(".google.com/") != string::npos) and
((url.find(".exe") != string::npos) or (url.find(".msi") != string::npos) or
(url.find(".cab") != string::npos) or (url.find(".msp") != string::npos))
) {
r.file = get_filename(url);
if (!r.file.empty()) {
r.match = true;
r.domain = "google_updates";
} else {
r.match = false;
}
}
else
{
r.match = false;
}
return r;
}
Saludos.
¡Gracias!