Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
scanner_ipc.cpp File Reference
#include <grpcpp/grpcpp.h>
#include "panoptes.grpc.pb.h"
#include "scanner_ipc.hpp"

Go to the source code of this file.

Macros

#define PANOPTES_REG_ROOT   HKEY_LOCAL_MACHINE

Functions

bool GetRegistryPortValue (DWORD &portValue)
 Get the Panoptes Service port value from the registry.

Variables

std::unique_ptr< PanoptesService::Stub > stub_

Macro Definition Documentation

◆ PANOPTES_REG_ROOT

#define PANOPTES_REG_ROOT   HKEY_LOCAL_MACHINE

Definition at line 15 of file scanner_ipc.cpp.

Function Documentation

◆ GetRegistryPortValue()

bool GetRegistryPortValue ( DWORD & portValue)

Get the Panoptes Service port value from the registry.

Parameters
portValueThe port value from the registry
Returns
True if the port value was retrieved successfully, false otherwise

Definition at line 21 of file scanner_ipc.cpp.

21 {
22 HKEY hKey;
23 DWORD dwType = REG_DWORD;
24 DWORD dwSize = sizeof(DWORD);
25
26 // Open the key
27 LONG lResult = RegOpenKeyExA(
29 "SOFTWARE\\Panoptes",
30 0,
31 KEY_READ,
32 &hKey
33 );
34
35 if (lResult != ERROR_SUCCESS) {
36 std::cerr << "Error opening registry key. Error code: " << lResult << std::endl;
37 return false;
38 }
39
40 // Read the SRV_PORT value
41 lResult = RegQueryValueExA(
42 hKey,
43 "SRV_PORT",
44 NULL,
45 &dwType,
46 reinterpret_cast<LPBYTE>(&portValue),
47 &dwSize
48 );
49
50 RegCloseKey(hKey);
51
52 if (lResult != ERROR_SUCCESS) {
53 std::cerr << "Error reading registry value. Error code: " << lResult << std::endl;
54 return false;
55 }
56
57 if (dwType != REG_DWORD) {
58 std::cerr << "Unexpected value type in registry." << std::endl;
59 return false;
60 }
61
62 return true;
63}
#define PANOPTES_REG_ROOT
Definition container.cpp:24

References PANOPTES_REG_ROOT.

Variable Documentation

◆ stub_

std::unique_ptr<PanoptesService::Stub> stub_

Definition at line 9 of file scanner_ipc.cpp.