openc2lib.types.targets.process
1from typing import Self 2 3from openc2lib.types.base import Map 4from openc2lib.types.targets import File 5from openc2lib.core.target import target 6 7@target('process') 8class Process(Map): 9 """ OpenC2 Process 10 11 Implements the `process` target (Section 3.4.1.15). 12 Common properties of an instance of a computer program as executed on an operating system. 13 14 """ 15 fields = {'pid': int, 'name': str, 'cwd': str, 'executable': File, 'parent': Self, 'command_line': str} 16 """ 17 Internal class members are just provided as reference for valid fields and to map their name 18 to the expected type. They shall not be instantiated or used directly. 19 `pid`: Process ID of the process 20 `name`: Name of the process 21 `cwd`: Current working directory of the process 22 `executable`: Executable that was executed to start the process 23 `parent`: Process that spawned this one 24 `command_line`: The full command line invocation used to start this process, including all arguments 25 """ 26 27 def __init__(self, process: dict): 28 super().__init__(process) 29 # Explicit control on each field is carried out to manage the possibility of wrong 30 # inputs or inputs defined by extensions 31 for x in self.keys(): 32 if x in self.fields: 33 return 34 raise ValueError("A 'Process' Target MUST contain at least one property.")
8@target('process') 9class Process(Map): 10 """ OpenC2 Process 11 12 Implements the `process` target (Section 3.4.1.15). 13 Common properties of an instance of a computer program as executed on an operating system. 14 15 """ 16 fields = {'pid': int, 'name': str, 'cwd': str, 'executable': File, 'parent': Self, 'command_line': str} 17 """ 18 Internal class members are just provided as reference for valid fields and to map their name 19 to the expected type. They shall not be instantiated or used directly. 20 `pid`: Process ID of the process 21 `name`: Name of the process 22 `cwd`: Current working directory of the process 23 `executable`: Executable that was executed to start the process 24 `parent`: Process that spawned this one 25 `command_line`: The full command line invocation used to start this process, including all arguments 26 """ 27 28 def __init__(self, process: dict): 29 super().__init__(process) 30 # Explicit control on each field is carried out to manage the possibility of wrong 31 # inputs or inputs defined by extensions 32 for x in self.keys(): 33 if x in self.fields: 34 return 35 raise ValueError("A 'Process' Target MUST contain at least one property.")
OpenC2 Process
Implements the process target (Section 3.4.1.15).
Common properties of an instance of a computer program as executed on an operating system.
fields =
{'pid': <class 'int'>, 'name': <class 'str'>, 'cwd': <class 'str'>, 'executable': <class 'openc2lib.types.targets.file.File'>, 'parent': typing.Self, 'command_line': <class 'str'>}
Internal class members are just provided as reference for valid fields and to map their name
to the expected type. They shall not be instantiated or used directly.
pid: Process ID of the process
name: Name of the process
cwd: Current working directory of the process
executable: Executable that was executed to start the process
parent: Process that spawned this one
command_line: The full command line invocation used to start this process, including all arguments
Inherited Members
- builtins.dict
- get
- setdefault
- pop
- popitem
- keys
- items
- values
- update
- fromkeys
- clear
- copy