Skip to content

Add dependency graph functionality#1

Open
teodutu wants to merge 4 commits into
malus-security:masterfrom
teodutu:refactor-sandscout-compiler
Open

Add dependency graph functionality#1
teodutu wants to merge 4 commits into
malus-security:masterfrom
teodutu:refactor-sandscout-compiler

Conversation

@teodutu

@teodutu teodutu commented Apr 27, 2021

Copy link
Copy Markdown
Member

Changes:

  • SandScout Compiler can now return the rules it discovers as a dictionary of lists.
  • When the script is imported, only the dictionary output is supported.
  • When called directly, the script uses argparse to be more verbose about its parameters.
  • Converted the script to Python3.
  • Improved coding style consistency.
  • Increased tab size to 4 spaces.
  • TODOs still present from before.

Changes:
- SandScout Compiler can now return the rules it discovers as a dictionary of lists.
- When the script is imported, only the dictionary output is supported.
- When called directly, the script uses argparse to be more verbose about its parameters.
- Converted the script to Python3
- Improved coding style consistency.
- Increased tab size to 4 spaces.
- TODOs still present from before.
@razvand
razvand self-requested a review May 2, 2021 13:49
@razvand razvand self-assigned this May 2, 2021

@razvand razvand left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. Please address my comments that mostly deal with the old version of the code. But, as long as you worked on it, it makes sense to improve it further.

Comment thread profile_compilation/sandscout_compiler.py
Comment thread profile_compilation/sandscout_compiler.py
Comment thread profile_compilation/sandscout_compiler.py
Comment thread profile_compilation/sandscout_compiler.py
_GRAPH = {}
_CMD_ARGS = None

# Regular expression rules for simple tokens

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These expressions are not used in the program.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are. ply requires a set of tokens that it tries to match against the input file. They are declared in the tokens list above

Comment thread profile_compilation/sandscout_compiler.py Outdated
Comment thread profile_compilation/sandscout_compiler.py Outdated
Comment thread profile_compilation/sandscout_compiler.py Outdated


def main():
_get_args()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this using and underscore prefix? Is there a Python naming convention for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. They're somewhat similar to static functions in C. If someone were to from sandscout_compiler import * [1], symbols starting with _ would not be visible. However, when importing the file like this import sandscout_compiler, all symbols, regardless of names, would be imported.

[1] https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles

Changes:
- Fix all pycodestyle errors and those pylint errors that don't affect the
functionality of the code
- Add docstrings to all functions and to the script itself
- Replace camelCase with snake_case
teodutu added 2 commits May 15, 2021 23:36
The output of the SandScout compiler differed in certain aspects from
that of SandBlaster. Now those differences have been eliminated.
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

Successfully merging this pull request may close these issues.

2 participants