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