otupy.types.targets.ipv4_net.IPv4Net
- class IPv4Net(ipv4_net=None, prefix=None)
Bases:
objectOpenC2 IPv4 Address Range
IPv4 Address Range as defined in Sec. 3.4.1.9.
The Standard is not clear on this part. The IPv4Net Target is defined as “Array /ipv4-net” (where ipv4-net –lowercase!– is never defined!) However, the json serialization requirements explicitely define:
Array /ipv4-net: JSON string containing the text representation of an IPv4 address range as specified in [RFC4632], Section 3.1.
According to this definition, I assume a single network address should be managed. Extension to an array of IP network addresses is rather straightforward by using a list for ipv4_net attribute. Note that I have to keep both the string representation of the network address as well as the
IPv4Networkobject to easily manage the code and to automate the creation of the dictionary.Methods
Returns address part only (no prefix)
Returns prefix only
- __init__(ipv4_net=None, prefix=None)
Initialize IPv4 Address Range
Initialize
IPv4Netwith IPv4 address and prefix. If no IPv4 address is given, initialize to null address. If no prefix is given, assume /32 (iPv4 address only).- Parameters:
ipv4_net – IPv4 Network Address.
prefix – IPv4 Network Adress Prefix.
- addr()
Returns address part only (no prefix)
- prefix()
Returns prefix only