Alterserv

ThunderCache 3.1.x => Plugins para ThunderCache 3.1.2 => Plugins de Antivirus => Mensaje publicado por: luistec en Marzo 01, 2013, 09:14:25 PM

Título: Plugin Avast
Publicado por: luistec en Marzo 01, 2013, 09:14:25 PM
Código (cpp) [Seleccionar]

#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 avast.com.so avast.com.cpp
// Regex
// http.*\.avast\.com.*(\.def|\.vpu|\.vpaa|\.stamp|\.vpx)

bool in_array(const string &needle, const vector< string > &haystack) {

       int max = haystack.size();
       if (max == 0) return false;
       for (int iii = 0; iii < max; iii++) {
                  if (regex_match(haystack[iii], needle) != "") {
                          return true;
               }
       }
       return false;
}

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;

       vector<string> black_list;
       black_list.push_back ("servers.def.vpx");
       black_list.push_back ("prod-ais.vpx");

       if ((url.find(".avast.com/") != string::npos) and (in_array(url, black_list) == false)
) {
               r.file = get_filename(url);
               if (!r.file.empty()) {
                       r.match = true;
                       r.domain = "avast";
               } else {
                       r.match = false;
               }
       } else {
               r.match = false;
       }
       return r;
}
Título: Re:Plugin Avast
Publicado por: tonyvzla en Marzo 01, 2013, 09:28:36 PM
Disculpen no lo habia visto, lo compilare, saludos
Título: Re:Plugin Avast
Publicado por: nqm74 en Marzo 01, 2013, 09:39:49 PM
gracias luistec, por el aporte.. saludos.
Título: Re:Plugin Avast
Publicado por: taurus7c0 en Marzo 18, 2013, 11:27:06 AM
Saludos amigos este plugin es para thunder 32 bits o 64 bits?
Título: Re:Plugin Avast
Publicado por: roxdng en Marzo 18, 2013, 11:48:14 AM
Cita de: taurus7c0 en Marzo 18, 2013, 11:27:06 AM
Saludos amigos este plugin es para thunder 32 bits o 64 bits?
Es para xp
Título: Re:Plugin Avast
Publicado por: david_domh en Octubre 18, 2013, 09:12:20 AM
Código (cpp) [Seleccionar]
#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 avast.com.so avast.com.cpp
// Regex
// http.*\.avast\.com.*(\.def|\.vpu|\.vpaa|\.stamp|\.vpx|\.exe)

bool in_array(const string &needle, const vector< string > &haystack) {

        int max = haystack.size();
        if (max == 0) return false;
        for (int iii = 0; iii < max; iii++) {
                   if (regex_match(haystack[iii], needle) != "") {
                           return true;
                }
        }
        return false;
}

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;
               
        vector<string> black_list;
        black_list.push_back ("servers.def.vpx");
        black_list.push_back ("prod-ais.vpx");
               
        if ((url.find(".avast.com/") != string::npos) and (in_array(url, black_list) == false)
                ) {
                r.file = get_filename(url);
                if (!r.file.empty()) {
                        r.match = true;
                        r.domain = "avast";
                } else {
                        r.match = false;
                }
        } else {
                r.match = false;
        }
        return r;
}


Le añadì solo al final del regex .exe para que cachee el instalador que ahora lo descarga del mismo servidor de avast


Saludos

David M
Título: Re:Plugin Avast
Publicado por: ingjaab en Octubre 18, 2013, 04:47:16 PM
 ??? gracias
Título: Re:Plugin Avast
Publicado por: alfiloro en Octubre 30, 2013, 07:20:37 AM
gracias por el aporte testeando