Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parse a pattern? #62

Open
ybdesire opened this issue Jun 26, 2019 · 2 comments
Open

How to parse a pattern? #62

ybdesire opened this issue Jun 26, 2019 · 2 comments

Comments

@ybdesire
Copy link

I want to parse a STIX pattern to get the key-value pairs and "AND OR" logic.

Would you give some suggestions to parse a STIX pattern ? Which APIs to choose?

@delliott90
Copy link

If I'm reading this correctly, part of what you are describing has been done in the stix-shifter project. The pattern is first parsed with an ANTLR grammar. That gets run through a method that builds up a python list of objects containing the STIX object:attribute, comparison operator, and value. What's missing from this is the AND/OR logic getting returned. Here's the link to the relevant method:
https://github.com/IBM/stix-shifter/blob/master/stix_shifter/stix_translation/src/utils/stix_pattern_parser.py

@ybdesire
Copy link
Author

@delliott90 thanks for the update. It helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants