openc2lib.profiles.dumb.actuator
StateLess Packet Filter profile
This modules contains the definition of the slpf profile. It is mostly used as a container
for the namespace identifier.
1""" StateLess Packet Filter profile 2 3 This modules contains the definition of the `slpf` profile. It is mostly used as a container 4 for the namespace identifier. 5""" 6from openc2lib import Profile, Map, actuator 7 8from openc2lib.profiles.dumb.profile import Profile 9 10""" SLPF profile 11 12 Creates the `slpf` profile. This structure follows the definition of the Actuator in 13 the Command message. 14""" 15@actuator(nsid=Profile.nsid) 16class dumb(Map): 17 fieldtypes = dict(hostname=str, named_group=str, asset_id=str, asset_tuple = [str]) 18 """ Selectors for Actuator 19 20 Fields that may be specified to select the specific Actuator implementation. 21 Usage of these fields is described by the SLPF Specification (Sec. 2.1.4), but their actual 22 meaning and usage is up the the `Actuator` implementation. 23 24 The extension mechanism is described in the 25 [Developing extensions](https://github.com/mattereppe/openc2lib/blob/main/docs/developingextensions.md#developing-extensions) Section of the main documentation. 26 27 :param hostname: [RFC1123] hostname (can be a domain name or IP address) 28 for a particular device with SLPF functionality. 29 :param named_group: User defined collection of devices with SLPF functionality. 30 :param asset_id: Unique identifier for a particular SLPF. 31 :param asset_tuple: Unique tuple identifier for a particular SLPF consisting 32 of a list of up to 10 strings. 33 """ 34 35 def __init__(self, dic): 36 """ Initialize the profile 37 38 The profile can be initialized by passing the internal fields explicitely 39 (i.e., by giving them as ***key=value*** pair. 40 :param dic: A list of ***key=value*** pair which allowed values are given 41 by `fieldtype`. 42 """ 43 self.nsid=Profile.nsid 44 Map.__init__(self, dic) 45 46 def __str__(self): 47 id = self.nsid + '(' 48 for k,v in self.items(): 49 id += str(k) + ':' + str(v) + ',' 50 id = id.strip(',') 51 id += ')' 52 return id
16@actuator(nsid=Profile.nsid) 17class dumb(Map): 18 fieldtypes = dict(hostname=str, named_group=str, asset_id=str, asset_tuple = [str]) 19 """ Selectors for Actuator 20 21 Fields that may be specified to select the specific Actuator implementation. 22 Usage of these fields is described by the SLPF Specification (Sec. 2.1.4), but their actual 23 meaning and usage is up the the `Actuator` implementation. 24 25 The extension mechanism is described in the 26 [Developing extensions](https://github.com/mattereppe/openc2lib/blob/main/docs/developingextensions.md#developing-extensions) Section of the main documentation. 27 28 :param hostname: [RFC1123] hostname (can be a domain name or IP address) 29 for a particular device with SLPF functionality. 30 :param named_group: User defined collection of devices with SLPF functionality. 31 :param asset_id: Unique identifier for a particular SLPF. 32 :param asset_tuple: Unique tuple identifier for a particular SLPF consisting 33 of a list of up to 10 strings. 34 """ 35 36 def __init__(self, dic): 37 """ Initialize the profile 38 39 The profile can be initialized by passing the internal fields explicitely 40 (i.e., by giving them as ***key=value*** pair. 41 :param dic: A list of ***key=value*** pair which allowed values are given 42 by `fieldtype`. 43 """ 44 self.nsid=Profile.nsid 45 Map.__init__(self, dic) 46 47 def __str__(self): 48 id = self.nsid + '(' 49 for k,v in self.items(): 50 id += str(k) + ':' + str(v) + ',' 51 id = id.strip(',') 52 id += ')' 53 return id
OpenC2 Map
Implements OpenC2 Map:
An unordered map from a set of specified keys to values with semantics bound to each key. Each field has an id, name and type.
However, the id is not considered in this implementation.
The implementation follows a similar logic than Array. Each derived class
is expected to provide a fieldtypes class attribute that associate field names
with their class definition.
Additionally, according to the Language Specification, Maps may be extended by
Profiles. Such extensions must use the base and register class attributes to
bind to the base element they extend and the Profile in which they are defined.
36 def __init__(self, dic): 37 """ Initialize the profile 38 39 The profile can be initialized by passing the internal fields explicitely 40 (i.e., by giving them as ***key=value*** pair. 41 :param dic: A list of ***key=value*** pair which allowed values are given 42 by `fieldtype`. 43 """ 44 self.nsid=Profile.nsid 45 Map.__init__(self, dic)
Initialize the profile
The profile can be initialized by passing the internal fields explicitely (i.e., by giving them as key=value pair.
Parameters
- dic: A list of key=value pair which allowed values are given
by
fieldtype.
Selectors for Actuator
Fields that may be specified to select the specific Actuator implementation.
Usage of these fields is described by the SLPF Specification (Sec. 2.1.4), but their actual
meaning and usage is up the the Actuator implementation.
The extension mechanism is described in the Developing extensions Section of the main documentation.
Parameters
- hostname: [RFC1123] hostname (can be a domain name or IP address) for a particular device with SLPF functionality.
- named_group: User defined collection of devices with SLPF functionality.
- asset_id: Unique identifier for a particular SLPF.
- asset_tuple: Unique tuple identifier for a particular SLPF consisting of a list of up to 10 strings.
Inherited Members
- builtins.dict
- get
- setdefault
- pop
- popitem
- keys
- items
- values
- update
- fromkeys
- clear
- copy