Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Functions | Variables
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.

Functions

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

Variables

std::unique_ptr< PanoptesService::Stub > stub_
 

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

13 {
14 HKEY hKey;
15 DWORD dwType = REG_DWORD;
16 DWORD dwSize = sizeof(DWORD);
17
18 // Open the key
19 LONG lResult = RegOpenKeyExA(
20 HKEY_LOCAL_MACHINE,
21 "SOFTWARE\\Panoptes",
22 0,
23 KEY_READ,
24 &hKey
25 );
26
27 if (lResult != ERROR_SUCCESS) {
28 std::cerr << "Error opening registry key. Error code: " << lResult << std::endl;
29 return false;
30 }
31
32 // Read the SRV_PORT value
33 lResult = RegQueryValueExA(
34 hKey,
35 "SRV_PORT",
36 NULL,
37 &dwType,
38 reinterpret_cast<LPBYTE>(&portValue),
39 &dwSize
40 );
41
42 RegCloseKey(hKey);
43
44 if (lResult != ERROR_SUCCESS) {
45 std::cerr << "Error reading registry value. Error code: " << lResult << std::endl;
46 return false;
47 }
48
49 if (dwType != REG_DWORD) {
50 std::cerr << "Unexpected value type in registry." << std::endl;
51 return false;
52 }
53
54 return true;
55}
unsigned long DWORD
Definition inject.h:2

Variable Documentation

◆ stub_

std::unique_ptr<PanoptesService::Stub> stub_

Definition at line 8 of file service_client_yara.cpp.