stix2patterns package


stix2patterns.inspector module

exception stix2patterns.inspector.InspectionException[source]

Bases: Exception

Represents a error that occurred during inspection.

stix2patterns.pattern module

stix2patterns.validator module

Validates a user entered pattern against STIXPattern grammar.


Continues to validate patterns until it encounters EOF within a pattern file or Ctrl-C is pressed by the user.

stix2patterns.validator.run_validator(pattern, stix_version='2.1')[source]

Validates a pattern against the STIX Pattern grammar. Error messages are returned in a list. The test passed if the returned list is empty.

stix2patterns.validator.validate(user_input, stix_version='2.1', ret_errs=False, print_errs=False)[source]

Wrapper for run_validator function that returns True if the user_input contains a valid STIX pattern or False otherwise. The error messages may also be returned or printed based upon the ret_errs and print_errs arg values.

Module contents