openc2lib.types.targets.domain_name
1import fqdn 2 3from openc2lib.core.target import target 4 5@target('domain_name') 6class DomainName: 7 """ A hostname that can be used to connect to this device over a network 8 9 Same implementation as `Hostname`, but requires dotted-separated names. 10 """ 11 12 def __init__(self, domainname): 13 self.set(domainname) 14 15 def set(self, domainname): 16 """ Check hostname fullfils RFC 1123 requirements """ 17 if fqdn.FQDN(domainname).is_valid: 18 self._domainname = str(domainname) 19 else: 20 raise ValueError("Invalid hostname -- not compliant to RFC 1034") 21 22 def get(self): 23 """ Returns the hostname as string """ 24 return self._domainname 25 26 def __str__(self): 27 return self._domainname
@target('domain_name')
class
DomainName:
6@target('domain_name') 7class DomainName: 8 """ A hostname that can be used to connect to this device over a network 9 10 Same implementation as `Hostname`, but requires dotted-separated names. 11 """ 12 13 def __init__(self, domainname): 14 self.set(domainname) 15 16 def set(self, domainname): 17 """ Check hostname fullfils RFC 1123 requirements """ 18 if fqdn.FQDN(domainname).is_valid: 19 self._domainname = str(domainname) 20 else: 21 raise ValueError("Invalid hostname -- not compliant to RFC 1034") 22 23 def get(self): 24 """ Returns the hostname as string """ 25 return self._domainname 26 27 def __str__(self): 28 return self._domainname
A hostname that can be used to connect to this device over a network
Same implementation as Hostname, but requires dotted-separated names.
def
set(self, domainname):
16 def set(self, domainname): 17 """ Check hostname fullfils RFC 1123 requirements """ 18 if fqdn.FQDN(domainname).is_valid: 19 self._domainname = str(domainname) 20 else: 21 raise ValueError("Invalid hostname -- not compliant to RFC 1034")
Check hostname fullfils RFC 1123 requirements