Bitdefender Hypervisor Memory Introspection
deployer.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #include "deployer.h"
6 #include "guests.h"
7 #include "windeployer.h"
8 #include "lixdeployer.h"
9 
10 
13  _In_ DWORD AgentTag,
14  _In_opt_ BYTE *AgentContent,
15  _In_opt_ DWORD AgentSize,
16  _In_ const CHAR *Name,
17  _In_opt_ const CHAR *Args
18  )
37 {
38  LOG("[DEPLOYER] Injecting agent process '%s' command line '%s'\n", Name, Args);
39 
41  {
42  return IntWinDepInjectProcess(AgentTag, AgentContent, AgentSize, Name, Args);
43  }
44  else if (gGuest.OSType == introGuestLinux)
45  {
46  return IntLixDepInjectProcess(AgentTag, AgentContent, AgentSize, Name, Args);
47  }
48  else
49  {
51  }
52 }
53 
54 
57  _In_ BYTE *FileContent,
58  _In_ DWORD FileSize,
59  _In_ const CHAR *Name
60  )
75 {
76  LOG("[DEPLOYER] Injecting agent file '%s'\n", Name);
77 
79  {
80  return IntWinDepInjectFile(FileContent, FileSize, Name);
81  }
82  else if (gGuest.OSType == introGuestLinux)
83  {
84  return IntLixDepInjectFile(FileContent, FileSize, Name);
85  }
86  else
87  {
89  }
90 }
91 
92 
95  _In_ const CHAR *CommandLine
96  )
107 {
109  {
111  }
112  else if (gGuest.OSType == introGuestLinux)
113  {
114  return IntLixDepRunCommand(CommandLine);
115  }
116  else
117  {
119  }
120 }
#define _In_opt_
Definition: intro_sal.h:16
INTSTATUS IntWinDepInjectFile(PBYTE FileContent, DWORD FileSize, const CHAR *Name)
Inject a file inside the Windows guest.
Definition: windeployer.c:294
uint8_t BYTE
Definition: intro_types.h:47
#define _In_
Definition: intro_sal.h:21
int INTSTATUS
The status data type.
Definition: introstatus.h:24
INTRO_GUEST_TYPE OSType
The type of the guest.
Definition: guests.h:278
INTSTATUS IntDepInjectProcess(DWORD AgentTag, BYTE *AgentContent, DWORD AgentSize, const CHAR *Name, const CHAR *Args)
Injects a process inside the guest.
Definition: deployer.c:12
#define LOG(fmt,...)
Definition: glue.h:61
INTSTATUS IntWinDepInjectProcess(DWORD AgentTag, PBYTE AgentContent, DWORD AgentSize, const CHAR *Name, const CHAR *Args)
Inject a process inside a Windows guest.
Definition: windeployer.c:137
INTSTATUS IntLixDepInjectFile(BYTE *Content, DWORD Size, const CHAR *Name)
Injects an agent that deploy a file with the provided content and name on the disk.
Definition: lixdeployer.c:174
uint32_t DWORD
Definition: intro_types.h:49
GUEST_STATE gGuest
The current guest state.
Definition: guests.c:50
#define INT_STATUS_NOT_SUPPORTED
Definition: introstatus.h:287
INTSTATUS IntDepRunCommand(const CHAR *CommandLine)
Run a command inside the guest.
Definition: deployer.c:94
INTSTATUS IntLixDepInjectProcess(DWORD AgentTag, BYTE *Content, DWORD Size, const char *Name, const char *Args)
Injects an agent that deploy a file to the disk and creates a process that execute the deployed file...
Definition: lixdeployer.c:337
char CHAR
Definition: intro_types.h:56
INTSTATUS IntLixDepRunCommand(const CHAR *CommandLine)
Injects an agent that creates a process that will execute the provided command line.
Definition: lixdeployer.c:266
INTSTATUS IntDepInjectFile(BYTE *FileContent, DWORD FileSize, const CHAR *Name)
Inject a file inside the guest.
Definition: deployer.c:56