Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 17th, 2018 56 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #ifndef CLAMAV_SCANENGINE_HPP_
  2. #define CLAMAV_SCANENGINE_HPP_
  3.  
  4. #include "clamav.h"
  5.  
  6. #include "clamav_logger.hpp"
  7.  
  8. extern int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_engine *engine, unsigned int options);
  9.  
  10.  
  11.  
  12. extern "C"
  13. {
  14.     int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_engine *engine, unsigned int options);
  15. }
  16.  
  17. namespace clamav_services{
  18.         class clamav_scan
  19.         {
  20.         public:
  21.             clamav_scan(std::string _path_scan_file,struct cl_engine* _engine)
  22.                 : path_scan_file_(_path_scan_file), engine_(_engine)
  23.             {
  24.  
  25.             }
  26.             void engine_scan()
  27.                 {
  28.                     if((result_ = cl_scanfile(path_scan_file_.c_str(), &virname_, NULL, engine_,CL_SCAN_STDOPT)) == CL_VIRUS) {
  29.                         result_detected_ = cl_strerror(result_);
  30.                         result_detail_.append("Found virus name = ");
  31.                         result_detail_.append(virname_);
  32.                     } else {
  33.                         result_detected_ = cl_strerror(result_);
  34.                         result_detail_.append("Cannot found virus  ");
  35.                     if(result_ != CL_CLEAN)
  36.                     {
  37.                         result_detected_ = cl_strerror(result_);
  38.                         result_detail_ .append("Error!  Programs cannot scan virus ");
  39.                     }
  40.  
  41.                     }
  42.                     debug_init_engine(result_detail_,result_detected_);
  43.                 }
  44.  
  45.             std::string debug_init_engine(std::string str_detail,std::string  str_err)
  46.                 {
  47.                     CLLOG_TRACE("### "<<str_detail<<", "<<str_err);
  48.                 }
  49.             ~clamav_scan()
  50.             {
  51.                 cl_engine_free(engine_);
  52.                 CLLOG_TRACE("### Destory engine scanning...");
  53.             }
  54.         private:
  55.             int result_;
  56.             const char *virname_;
  57.             struct cl_engine *engine_;
  58.  
  59.             std::string path_scan_file_;
  60.             std::string result_detected_;
  61.             std::string result_detail_;
  62.  
  63.         };
  64. }
  65.  
  66. #endif /* CLAMAV_SCANENGINE_HPP_ */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top