Get started with signals using Python
In this tutorial for signals development using Python3 you'll create a sample signals and submit them to SAFE.
This tutorial will show you how to:
- Run sample application that generates signals and submits to SAFE.
- Check the results in SAFE.
- Create your own signal.
Pre-Requisites
- Python3 and PIP3
- Safe Url
- REST API creds to access SAFE API's
How to run sample application
- Check out the signals repository to your machine from Github.
- Navigate to
signal/pythonfolder. - Fill following properties in the config file
- SafeUrl-(Required) Base Url of the Safe Server.
- ApiUsername and ApiPassword (Required)- REST api credentials to access SAFE API's.
- Run
pip3 install -r requirements.txtwhich will install the required dependencies. - Run
python3 app/main.pyto run the program which will submit sample signals to Safe.
Check results on SAFE
- Login to SAFE and click on Technology->Assets from left navigation view.
- Search for asset
MyVirtualMachine.acme.comand click on the asset. - Scroll down to see list of controls that were sent using signal.
Create your own signal
See Signal specification
-
Follow Signal specification to add new signal jsons in the directory.
-
Run
python3 app/main.pyto submit the signals to Safe. -
Safe supports signals zip upload. Zip file can contain signal jsons and a config file named
config.json. -
Create
config.jsonwith following settings -{ "assetMatchingCriteria": [ "fqdn", "assetName", "ipAddress" ], "shouldImportAssets": true, "fullAssessmentForTypes": [ "va" ] }Only the above mentioned properties are accepted in SAFE from config.json
Description about the properties
assetMatchingCriteria- Is used to match existing asset in SAFE based on the priorityfqdn, assetName, ipAddress.shouldImportAssets- will inform SAFE whether to import this asset on SAFE portal.fullAssessmentForTypes- this will upload new set of security findings for a particular type of security context for an asset and old findings if present are discarded. It accepts array of strings containingSecurityTypeas mentioned in Enums