Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
scan_cli.cpp
Go to the documentation of this file.
1#include <Windows.h>
2#include <iostream>
3#include <string>
4#include "scanner_ipc.hpp"
5#include "absl/flags/flag.h"
6#include "absl/flags/parse.h"
7#include <nlohmann/json.hpp>
8
9ABSL_FLAG(std::string, file, "", "File for Panoptes To Scan");
10
11int main() {
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.
ABSL_FLAG(std::string, file, "", "File for Panoptes To Scan")
int main()
Definition scan_cli.cpp:11