![]() |
Panoptes 1.0.0
Endpoint Detection and Response
|
#include "process_images.h"#include "utils.h"#include <algorithm>#include <deque>#include <mutex>#include <unordered_map>#include <vector>Go to the source code of this file.
Classes | |
| struct | ProcessImageEntry |
| struct | _PANO_SYSTEM_PROCESS_ID_INFORMATION |
Macros | |
| #define | PANO_IMAGE_KEEP_MS 60000 |
| #define | PANO_IMAGES_PER_PID 2 |
| #define | PANO_IMAGE_TIME_SLACK (10000000ULL) |
| #define | PANO_SYSTEM_PROCESS_ID 4 |
| #define | PANO_SYSTEM_PROCESS_ID_INFORMATION_CLASS 0x58 |
Typedefs | |
| typedef struct _PANO_SYSTEM_PROCESS_ID_INFORMATION | PANO_SYSTEM_PROCESS_ID_INFORMATION |
| typedef LONG(NTAPI * | PanoNtQuerySystemInformation) (ULONG, PVOID, ULONG, PULONG) |
Functions | |
| void | RecordProcessStart (DWORD processId, const std::string &image, const FILETIME &time) |
| Records a process start (ProcessCreated). | |
| void | RecordProcessExit (DWORD processId) |
| Records a process exit (ProcessTerminated). Its entry is forgotten a minute later. | |
| std::string | LookupProcessImage (DWORD processId, const FILETIME &time) |
| The image of the process that had processId at the given time, from the recorded starts. Empty if the service did not see that process start (e.g. it started before the service). | |
| std::string | ResolveProcessImage (DWORD processId, const FILETIME &time) |
| LookupProcessImage, falling back to asking Windows (QueryFullProcessImageName) for processes the service did not see start. Empty if both fail. | |
| #define PANO_IMAGE_KEEP_MS 60000 |
Definition at line 11 of file process_images.cpp.
| #define PANO_IMAGE_TIME_SLACK (10000000ULL) |
Definition at line 19 of file process_images.cpp.
Referenced by LookupProcessImage().
| #define PANO_IMAGES_PER_PID 2 |
Definition at line 15 of file process_images.cpp.
Referenced by RecordProcessStart().
| #define PANO_SYSTEM_PROCESS_ID 4 |
Definition at line 133 of file process_images.cpp.
| #define PANO_SYSTEM_PROCESS_ID_INFORMATION_CLASS 0x58 |
Definition at line 137 of file process_images.cpp.
| typedef LONG(NTAPI * PanoNtQuerySystemInformation) (ULONG, PVOID, ULONG, PULONG) |
Definition at line 146 of file process_images.cpp.
| std::string LookupProcessImage | ( | DWORD | processId, |
| const FILETIME & | time ) |
The image of the process that had processId at the given time, from the recorded starts. Empty if the service did not see that process start (e.g. it started before the service).
Definition at line 113 of file process_images.cpp.
References ProcessImageEntry::Image, PANO_IMAGE_TIME_SLACK, and ProcessImageEntry::Start.
Referenced by ResolveProcessImage(), TEST(), TEST(), TEST(), TEST(), and TEST().
| void RecordProcessExit | ( | DWORD | processId | ) |
Records a process exit (ProcessTerminated). Its entry is forgotten a minute later.
Definition at line 95 of file process_images.cpp.
| void RecordProcessStart | ( | DWORD | processId, |
| const std::string & | image, | ||
| const FILETIME & | time ) |
Records a process start (ProcessCreated).
| image | The image path as the driver reports it. "\??\C:\..." and "\SystemRoot\..." are converted to "C:\..." paths |
| time | When the process was created |
Definition at line 80 of file process_images.cpp.
References ProcessImageEntry::Image, PANO_IMAGES_PER_PID, and ProcessImageEntry::Start.
| std::string ResolveProcessImage | ( | DWORD | processId, |
| const FILETIME & | time ) |
LookupProcessImage, falling back to asking Windows (QueryFullProcessImageName) for processes the service did not see start. Empty if both fail.
Definition at line 173 of file process_images.cpp.
References LookupProcessImage(), MAX_PATH, and ToString().