No project description provided
Project description
muddy
muddy is a python package and CLI tool for generating MUD files.
Usage
There are multiple ways to generate MUD objects, depending on the level of abstraction:
from muddy import maker
from muddy import models
mud = maker.make_mud(1,'https://lighting.example.com/lightbulb2000', 48, True, 'The BMS Example Light Bulb',
'https://lighting.example.com/lightbulb2000/documentation', [models.Direction.TO_DEVICE,models.Direction.FROM_DEVICE],
models.IPVersion.IPV4, 'test.example.com', models.Protocol.ANY, [88,443], [88,443], models.MatchType.IS_MYMFG)
or
from muddy import maker
from muddy import models
support_info = maker.make_support_info(1,'https://lighting.example.com/lightbulb2000', 48, True,
'The BMS Example Light Bulb', 'https://lighting.example.com/lightbulb2000/documentation')
mud = maker.make_mud(support_info , [models.Direction.TO_DEVICE,models.Direction.FROM_DEVICE],
models.IPVersion.IPV4, 'test.example.com', models.Protocol.ANY, [88,443], [88,443], models.MatchType.IS_MYMFG)
or
from muddy import maker
from muddy import models
import random
mud_name = f'mud-{random.randint(10000, 99999)}'
acl = []
policies = {}
for direction_initiated in [models.Direction.TO_DEVICE,models.Direction.FROM_DEVICE]:
acl_names = maker.make_acl_names(mud_name, models.IPVersion.IPV4, direction_initiated)
policies.update(maker.make_policy(direction_initiated, acl_names))
acl.append(
maker.make_acls([models.IPVersion.IPV4], 'test.example.com', models.Protocol.ANY, [88,443], [88,443], models.MatchType.IS_MYMFG, direction_initiated,
acl_names))
mud = maker.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 import maker
from muddy import models
import random
support_info = maker.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 [models.Direction.TO_DEVICE,models.Direction.FROM_DEVICE]:
acl_names = maker.make_acl_names(mud_name, models.IPVersion.IPV4, direction_initiated)
policies.update(maker.make_policy(direction_initiated, acl_names))
acl.append(
maker.make_acls([models.IPVersion.IPV4], 'test.example.com', models.Protocol.ANY, [88,443], [88,443], models.MatchType.IS_MYMFG, direction_initiated,
acl_names))
mud = maker.make_mud(support_info, policies, acl)
Example output
{
"ietf-mud:mud": {
"mud-version": 1,
"mud-url": "https://lighting.example.com/lightbulb2000",
"last-update": "2019-07-21T14:40:16",
"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": [
"mud-56908-v4to"
]
}
},
"from-device-policy": {
"access-lists": {
"access-list": [
"mud-56908-v4fr"
]
}
}
},
"ietf-access-control-list:acls": {
"acl": [
{
"name": "mud-56908-v4to",
"type": "ipv4",
"aces": {
"ace": [
{
"name": "myman0-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
}
}
]
}
},
{
"name": "mud-56908-v4fr",
"type": "ipv4",
"aces": {
"ace": [
{
"name": "myman0-todev",
"matches": {
"ietf-mud:mud": {
"same-manufacturer": []
}
}
}
]
}
}
]
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
muddy-2019.7.21.post2.tar.gz
(7.2 kB
view hashes)
Built Distribution
Close
Hashes for muddy-2019.7.21.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb45f4227657a8c8cadfec93a8b106f10a1d0070e3407a3cbdef7c5e663eec84 |
|
MD5 | 20b8bb6e52cc579be3e306061f556b9d |
|
BLAKE2b-256 | 5680ebac9abc48c2549ea0de4149d6233c92138124605c57c3b0f44e2dfaa5a9 |