redcanaryco / surveyor

A cross-platform baselining, threat hunting, and attack surface analysis tool for security teams.
MIT License
170 stars 59 forks source link

Add Ability to Parse YAML files #35

Closed rc-abodkins closed 2 years ago

rc-abodkins commented 4 years ago

Which category is the feature part of?

Use Cases Added a check and ability to load YAML files as an alternative to using JSON definition files. The test.json file should be deleted as it was a file created to test certain circumstances that show it works as expected.

Proposal @tvjust i fixed the code for this, but i dont have permissions. :( This should go at line 206 just below setting the file_type variable. I also ported the critical_processes.json to yaml and would like to get that pushed up too.



      with open(definition_file, 'r') as fh:
        contents = fh.read()
        try:
          programs = json.loads(contents)
        except:
          try:
            programs = yaml.safe_load(contents)
          except:
            log("Unable to load config file as either JSON or YAML")
            sys.exit(1)```

**Additional context**
Add any other context or screenshots about the feature request here.