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

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 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 14 of file service_client_yara.cpp.

Function Documentation

◆ GetRegistryPortValue()

bool GetRegistryPortValue ( DWORD & portValue)

Get the Panoptes Service port from the registry.

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

Definition at line 20 of file service_client_yara.cpp.

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

References PANOPTES_REG_ROOT.

Variable Documentation

◆ stub_

std::unique_ptr<PanoptesService::Stub> stub_

Definition at line 8 of file service_client_yara.cpp.