Skip to content
API Documentation
BastionGuard™
MalwareBazaar.hpp File Reference

Go to the source code of this file.

Classes

struct  MBResult
class  MalwareBazaar

Functions

void loadCloudApiKeys ()

Variables

std::string globalMalwareBazaarApiKey

Function Documentation

◆ loadCloudApiKeys()

void loadCloudApiKeys ( )

Definition at line 38 of file MalwareBazaar.cpp.

39{
40 std::string path = Glib::get_home_dir() + "/.config/BastionGuard/cloud.conf";
41
42 std::ifstream f(path);
43 if (!f) {
44 std::cerr << _("[Cloud] Nessun file ") << path << _(" trovato.\n");
45 return;
46 }
47
48 std::string line;
49 while (std::getline(f, line)) {
50 line.erase(std::remove_if(line.begin(), line.end(), ::isspace), line.end());
51 if (line.rfind(_("malware_bazaar_api_key="), 0) == 0) {
52
54 line.substr(strlen(_("malware_bazaar_api_key=")));
55
56 if (!globalMalwareBazaarApiKey.empty())
57 std::cout << _("[Cloud] API key caricata correttamente.\n");
58 else
59 std::cerr << _("[Cloud] API key vuota.\n");
60 }
61 }
62}
#define _(s)
std::string globalMalwareBazaarApiKey

References _, globalMalwareBazaarApiKey, and loadCloudApiKeys().

Referenced by loadCloudApiKeys(), and ScanPage::ScanPage().

Variable Documentation

◆ globalMalwareBazaarApiKey

std::string globalMalwareBazaarApiKey
extern

Definition at line 35 of file MalwareBazaar.cpp.

Referenced by MalwareBazaar::lookupHash().