1#include <grpcpp/grpcpp.h>
2#include "panoptes.grpc.pb.h"
3#include "scanner_ipc.hpp"
6using grpc::ClientContext;
9std::unique_ptr<PanoptesService::Stub>
stub_;
16 DWORD dwType = REG_DWORD;
20 LONG lResult = RegOpenKeyExA(
28 if (lResult != ERROR_SUCCESS) {
29 std::cerr <<
"Error opening registry key. Error code: " << lResult << std::endl;
34 lResult = RegQueryValueExA(
39 reinterpret_cast<LPBYTE
>(&portValue),
45 if (lResult != ERROR_SUCCESS) {
46 std::cerr <<
"Error reading registry value. Error code: " << lResult << std::endl;
50 if (dwType != REG_DWORD) {
51 std::cerr <<
"Unexpected value type in registry." << std::endl;
62 std::string server_url =
"localhost:0" + std::to_string(
SERVICE_PORT);
63 std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel(server_url, grpc::InsecureChannelCredentials());
64 stub_ = PanoptesService::NewStub(channel);
74 ClientContext g_context;
77 request.set_file_hash(FileHash);
78 request.set_portable_executable_path(PePath);
80 Status status =
stub_->QueuePeScan(&g_context, request, &reply);
83 message = status.error_message();
87 message = reply.message();
std::unique_ptr< PanoptesService::Stub > stub_
bool GetRegistryPortValue(DWORD &portValue)
Get the Panoptes Service port value from the registry.
PanoptesServiceClient()
The PanoptesServiceClient class is a class that implements the PanoptesServiceClient class.
bool QueuePeScan(std::string PePath, std::string FileHash, std::string &message)
Send a request to the Panoptes Service to scan a PE file.
bool GetRegistryPortValue(DWORD &portValue)
Get the gRPC port value from the registry.
std::unique_ptr< PanoptesService::Stub > stub_