Skip to content
API Documentation
BastionGuard™
ArchiveInspector Class Reference

#include <ArchiveInspector.hpp>

Public Member Functions

 ArchiveInspector (std::string worker_path, int sandbox_timeout_seconds=10)
ArchiveInspectionResult inspect (const std::string &input_path) const

Static Public Member Functions

static bool looks_like_zip_path (const std::string &path)

Private Attributes

std::string worker_path_
int timeout_seconds_ = 10

Detailed Description

Definition at line 26 of file ArchiveInspector.hpp.

Constructor & Destructor Documentation

◆ ArchiveInspector()

ArchiveInspector::ArchiveInspector ( std::string worker_path,
int sandbox_timeout_seconds = 10 )
explicit

Definition at line 27 of file ArchiveInspector.cpp.

28 : worker_path_(std::move(worker_path)),
29 timeout_seconds_(sandbox_timeout_seconds) {}

References timeout_seconds_, and worker_path_.

Member Function Documentation

◆ inspect()

ArchiveInspectionResult ArchiveInspector::inspect ( const std::string & input_path) const

Definition at line 43 of file ArchiveInspector.cpp.

43 {
45}
ArchiveInspectionResult analyze_archive_in_sandbox(const std::string &worker_path, const std::string &input_path, int timeout_seconds)

References analyze_archive_in_sandbox(), timeout_seconds_, and worker_path_.

Referenced by InotifyEngine::maybe_inspect_archive().

◆ looks_like_zip_path()

bool ArchiveInspector::looks_like_zip_path ( const std::string & path)
static

Definition at line 31 of file ArchiveInspector.cpp.

31 {
32 if (path.size() < 4) {
33 return false;
34 }
35
36 std::string lower = path;
37 std::transform(lower.begin(), lower.end(), lower.begin(),
38 [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
39
40 return lower.size() >= 4 && lower.substr(lower.size() - 4) == ".zip";
41}

Member Data Documentation

◆ timeout_seconds_

int ArchiveInspector::timeout_seconds_ = 10
private

Definition at line 36 of file ArchiveInspector.hpp.

Referenced by ArchiveInspector(), and inspect().

◆ worker_path_

std::string ArchiveInspector::worker_path_
private

Definition at line 35 of file ArchiveInspector.hpp.

Referenced by ArchiveInspector(), and inspect().


The documentation for this class was generated from the following files: