Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions
scan_cli.cpp File Reference
#include <Windows.h>
#include <iostream>
#include <string>
#include "scanner_ipc.hpp"
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include <nlohmann/json.hpp>

Go to the source code of this file.

Functions

 ABSL_FLAG (std::string, file, "", "File for Panoptes To Scan")
 
int main ()
 

Function Documentation

◆ ABSL_FLAG()

ABSL_FLAG ( std::string  ,
file  ,
""  ,
"File for Panoptes To Scan"   
)

◆ main()

int main ( )

Definition at line 11 of file scan_cli.cpp.

11 {
12 absl::ParseCommandLine(__argc, __argv);
13 if (absl::GetFlag(FLAGS_file).empty()) {
14 printf("ERROR: No file specified\n");
15 printf("Usage: PanoptesScanCLI.exe -file <FILE_TO_SCAN> \n");
16 return 1;
17 }
18
19 std::string fileToScan = absl::GetFlag(FLAGS_file);
21
22 std::string results;
23 if (!client.QueuePeScan(fileToScan, "", results)) {
24 std::cout << "An Error Occured:" << "\n" << results << std::endl;
25 return 1;
26 }
27
28 //Assuming the file hasnt been scanned before the return will be empty
29 if (results.empty()) {
30 Sleep(2000);
31 //Scan the file again to get the results from the database
32 if (!client.QueuePeScan(fileToScan, "", results)) {
33 std::cout << "An Error Occured:" << "\n" << results << std::endl;
34 return 1;
35 }
36
37 if (results.empty()) {
38 std::cout << "Failed to get scan results\n" << std::endl;
39 return 1;
40 }
41 }
42
43 //If the file has been scanned before the return will be the results of the scan
44 nlohmann::json j = nlohmann::json::parse(results);
45 std::string prettyJson = j.dump(4, ' ', true);
46 std::cout << "Scan Results:" << "\n" << prettyJson << std::endl;
47
48
49 return 0;
50}
Panoptes Service Client that is used to communicate with the Panoptes Service via.
bool QueuePeScan(std::string PePath, std::string FileHash, std::string &message)
Send a request to the Panoptes Service to scan a PE file.

References PanoptesServiceClient::QueuePeScan().