Utility functions for TCEX.
This package is an abstraction on the TCEX package. There are two, major types of items in this package:
- Elements - Basic functions that perform a single operation.
- Molecules - Functions that perform multiple operations often using multiple elements.
git clone https://gitlab.com/fhightower-tc/democritus.git
cd democritus
pip3 install . --user
To use an element:
from democritus import Elements
e = Elements(<OWNER_NAME>)
To use a molecule:
from democritus import Molecules
m = Molecules(<OWNER_NAME>)
This example will create the following objects 10 times:
A signature, document, incident, and file. The signature will be associated with the document and the incident. The document will be associated with the incident and the file. The incident will be associated with the file.
from democritus import Molecules
m = Molecules('testing-lab')
m.create_from_symbolic_pattern('sig=doc=inc-file', 10)
m.process()
from democritus import Elements
e = Elements('testing-lab')
a = e.get_items_by_type('Address')
print(len(a))
from democritus import Molecules
m = Molecules('testing-lab')
a = m.get_items_by_attribute({"type": "Description", "value": "this is just a test"}, 'Address')
from democritus import Molecules
m = Molecules('testing-lab')
a = m.add_attributes_to_items_by_attribute([{"type": "Description", "value": "New attribute"}], 'Address', {"type": "Description", "value": "this is just a test"})
from democritus import Molecules
m = Molecules('testing-lab')
a = m.add_attributes_to_items_by_tag([{"type": "Description", "value": "this is just a test"}], 'Address', 'Test Tag')
from democritus.molecules import Molecules
m = Molecules('testing-lab')
inds = m.get_items_by_type('incident')
len(inds) # 10
sigs = m.get_items_by_type('signature')
len(sigs) # 10
m.create_associations_between_two_lists(inds, sigs)
from democritus.elements import Molecules
m = Molecules('testing-lab')
m.add_default_metadata('Signature', {
'attributes': [{
'type': 'Rule Confidence',
'value': 'High'
}, {
'type': 'Rule Priority',
'value': 'Medium'
}]
})
m.create_from_symbolic_pattern('doc=inc=file-sig', 10)
m.process()
For more examples, refer to the tests/
directory.
- Add entry for new indicator type to
utility.py:ITEM_TYPE_TO_API_BRANCH
- Add entry for new indicator type to
utility.py:INDICATOR_TYPE_TO_ID_KEY
This package was created with Cookiecutter and fhightower's Python project template.