muddy
muddy is a python package and CLI tool for generating MUD files (RFC8520).
Usage
There are multiple ways to generate MUD objects, depending on the level of abstraction:
from muddy.maker import make_mud
from muddy.models import Direction, IPVersion, Protocol, MatchType
mud = make_mud(1,'https://lighting.example.com/lightbulb2000', 48, True, 'The BMS Example Light Bulb',
'https://lighting.example.com/lightbulb2000/documentation', [Direction.TO_DEVICE,Direction.FROM_DEVICE],
IPVersion.IPV4, 'test.example.com', Protocol.ANY, MatchType.IS_MYMFG, [88,443], [88,443])
or
from muddy.maker import make_mud, make_support_info
from muddy.models import Direction, IPVersion, Protocol, MatchType
support_info = make_support_info(1,'https://lighting.example.com/lightbulb2000', 48, True,
'The BMS Example Light Bulb', 'https://lighting.example.com/lightbulb2000/documentation')
mud = make_mud(support_info , [Direction.TO_DEVICE,Direction.FROM_DEVICE],
IPVersion.IPV4, 'test.example.com', Protocol.ANY, [88,443], [88,443], MatchType.IS_MYMFG)
or
from muddy.maker import make_mud, make_acl_names, make_policy, make_acls
from muddy.models import Direction, IPVersion, Protocol, MatchType
import random
mud_name = f'mud-{random.randint(10000, 99999)}'
acl = []
policies = {}
for direction_initiated in [Direction.TO_DEVICE,Direction.FROM_DEVICE]:
acl_names = make_acl_names(mud_name, IPVersion.IPV4, direction_initiated)
policies.update(make_policy(direction_initiated, acl_names))
acl.append(make_acls([IPVersion.IPV4], 'test.example.com', Protocol.ANY, [88,443], [88,443], MatchType.IS_MYMFG,
direction_initiated, acl_names))
mud = make_mud(policies, acl, 1,'https://lighting.example.com/lightbulb2000', 48, True, 'The BMS Example Light Bulb',
'https://lighting.example.com/lightbulb2000/documentation')
or
from muddy.maker import make_mud, make_acl_names, make_policy, make_acls, make_support_info
from muddy.models import Direction, IPVersion, Protocol, MatchType
import random
support_info = make_support_info(1,'https://lighting.example.com/lightbulb2000', 48, True,
'The BMS Example Light Bulb', 'https://lighting.example.com/lightbulb2000/documentation')
mud_name = f'mud-{random.randint(10000, 99999)}'
acl = []
policies = {}
for direction_initiated in [Direction.TO_DEVICE,Direction.FROM_DEVICE]:
acl_names = make_acl_names(mud_name, IPVersion.IPV4, direction_initiated)
policies.update(make_policy(direction_initiated, acl_names))
acl.append(make_acls([IPVersion.IPV4], 'test.example.com', Protocol.ANY, [88,443], [88,443], MatchType.IS_MYMFG,
direction_initiated,acl_names))
mud = make_mud(support_info, policies, acl)
To obtain JSON for a MUD object, you may just json.dumps(mud).
Example output
{
"ietf-mud:mud": {
"mud-version": 1,
"mud-url": "https://lighting.example.com/lightbulb2000",
"last-update": "2019-07-23T19:54:24",
"cache-validity": 48,
"is-supported": true,
"systeminfo": "The BMS Example Light Bulb",
"documentation": "https://lighting.example.com/lightbulb2000/documentation",
"to-device-policy": {
"access-lists": {
"access-list": [
{
"name": "mud-52892-v4to"
}
]
}
},
"from-device-policy": {
"access-lists": {
"access-list": [
{
"name": "mud-52892-v4fr"
}
]
}
}
},
"ietf-access-control-list:acls": {
"acl": [
{
"name": "mud-52892-v4to",
"type": "ipv4",
"aces": {
"ace": [
{
"name": "myman0-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman1-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman1-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman2-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
}
]
}
},
{
"name": "mud-52892-v4fr",
"type": "ipv4",
"aces": {
"ace": [
{
"name": "myman0-frdev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman1-frdev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman1-frdev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
},
{
"name": "myman2-frdev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
},
"actions": {
"forwarding": "accept"
}
}
]
}
}
]
}
}
Metadata
Release files for muddy 2019.7.25.post2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| muddy-2019.7.25.post2.tar.gz | 8.9 kB | Without provenance | Details for muddy-2019.7.25.post2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| muddy-2019.7.25.post2-py3-none-any.whl | Python 3 | none | any | Details for muddy-2019.7.25.post2-py3-none-any.whl |
Total release size: 19.5 kB
Release files / muddy-2019.7.25.post2.tar.gz
| Download URL | muddy-2019.7.25.post2.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ea391e24469b5d820c0750e50c2a4efd4b572cf3106fb0285faf7b7cb9f83d0
|
|
BLAKE2b-256 checksum How to use checksums |
dce8ab14f192c4780240531b2999ca0231c54be2c1fe85122c6801ca2dd69c98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
|
Release files / muddy-2019.7.25.post2-py3-none-any.whl
| Download URL | muddy-2019.7.25.post2-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f360e1914ad97576c065eea9faed1a4911cf45b5d07278b7ea949cfbb5c6ce36
|
|
BLAKE2b-256 checksum How to use checksums |
62f59859acbe4405b8263903c20d04e0834df6f1923606b22260a4c1eaf5ab8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
|
Security for muddy 2019.7.25.post2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.