openc2lib.types.targets.command_id
1import re 2 3from openc2lib.types.base import Record 4from openc2lib.core.target import target 5 6@target('command') 7class CommandID: 8 """ OpenC2 Command-ID 9 10 Implements the `command` target (Section 3.4.2.16). 11 A reference to a previously issued Command. 12 A valid Command-ID shall not contain spaces. 13 """ 14 15 def __init__(self, cmdid): 16 self.set(cmdid) 17 18 def set(self, cmdid): 19 """ Sets the value """ 20 if re.search("^\S{0,36}$",cmdid) is None: 21 raise ValueError("Invalid Command-ID") 22 self._cmdid = cmdid 23 24 def get(cmdid): 25 """ Returns the value """ 26 return self._cmdid 27 28 def __str__(self): 29 return self._cmdid
@target('command')
class
CommandID:
7@target('command') 8class CommandID: 9 """ OpenC2 Command-ID 10 11 Implements the `command` target (Section 3.4.2.16). 12 A reference to a previously issued Command. 13 A valid Command-ID shall not contain spaces. 14 """ 15 16 def __init__(self, cmdid): 17 self.set(cmdid) 18 19 def set(self, cmdid): 20 """ Sets the value """ 21 if re.search("^\S{0,36}$",cmdid) is None: 22 raise ValueError("Invalid Command-ID") 23 self._cmdid = cmdid 24 25 def get(cmdid): 26 """ Returns the value """ 27 return self._cmdid 28 29 def __str__(self): 30 return self._cmdid
OpenC2 Command-ID
Implements the command target (Section 3.4.2.16).
A reference to a previously issued Command.
A valid Command-ID shall not contain spaces.