openc2lib.types.targets.email_addr

 1import email_validator
 2
 3from openc2lib.types.base import Record
 4from openc2lib.core.target import target
 5
 6@target('email_addr')
 7class EmailAddr:
 8	""" OpenC2 Email Address
 9
10		Implements the `email_addr` target (Section 3.4.1.4). 
11		Email address, [RFC5322], Section 3.4.1.
12	"""
13
14	def __init__(self, email):
15		self.set(email)
16
17	def set(self, email):
18		""" Doesn't allow IDN email (RFC6531): there is a dedicated class for this (`IDNEmailAddr`). """
19		emailinfo = email_validator.validate_email(email, check_deliverability=False,allow_smtputf8=False)
20		self._emailaddr = emailinfo.normalized
21
22	def get(self):
23		return self._emailaddr
24
25	def __str__(self):
26		return self._emailaddr
@target('email_addr')
class EmailAddr:
 7@target('email_addr')
 8class EmailAddr:
 9	""" OpenC2 Email Address
10
11		Implements the `email_addr` target (Section 3.4.1.4). 
12		Email address, [RFC5322], Section 3.4.1.
13	"""
14
15	def __init__(self, email):
16		self.set(email)
17
18	def set(self, email):
19		""" Doesn't allow IDN email (RFC6531): there is a dedicated class for this (`IDNEmailAddr`). """
20		emailinfo = email_validator.validate_email(email, check_deliverability=False,allow_smtputf8=False)
21		self._emailaddr = emailinfo.normalized
22
23	def get(self):
24		return self._emailaddr
25
26	def __str__(self):
27		return self._emailaddr

OpenC2 Email Address

Implements the email_addr target (Section 3.4.1.4). Email address, [RFC5322], Section 3.4.1.

EmailAddr(email)
15	def __init__(self, email):
16		self.set(email)
def set(self, email):
18	def set(self, email):
19		""" Doesn't allow IDN email (RFC6531): there is a dedicated class for this (`IDNEmailAddr`). """
20		emailinfo = email_validator.validate_email(email, check_deliverability=False,allow_smtputf8=False)
21		self._emailaddr = emailinfo.normalized

Doesn't allow IDN email (RFC6531): there is a dedicated class for this (IDNEmailAddr).

def get(self):
23	def get(self):
24		return self._emailaddr