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

Module tests #56

Merged
merged 7 commits into from
May 5, 2016
Merged

Module tests #56

merged 7 commits into from
May 5, 2016

Conversation

allonhadaya
Copy link
Contributor

#34

@allonhadaya
Copy link
Contributor Author

@fwkz How about that?

…e test case is provided with the two correctly typed attributes. Rename ModuleTestBase to ModuleTest because it is the one most programmers should interact with.
@allonhadaya allonhadaya mentioned this pull request Apr 28, 2016
@fwkz
Copy link
Collaborator

fwkz commented May 3, 2016

@allonhadaya Please check out new module indexing mechanism in new_loading_mechanism branch. There are few utils function:

  • utils.index_modules
  • utils.import_exploit
  • utils.iter_modules

…les instead of interpreter internals to load module tests. Flatten the load_tests code to use fewer language features/utilities. Grab module metadata in the same way the interpreter was doing it, but locally in the test case.
@allonhadaya
Copy link
Contributor Author

@fwkz looks good! I'll point out a couple of things.

  1. I copied code from RoutersploitInterpreter.module_metadata to grab the __info__ dict. So there's an extra line of duplication now. I'm open to suggestions for improvement.
  2. This was true before new_loading_mechanism, but I figure now's a good a time as any to point out that modules that fail the import_exploit call in iter_modules will silently not be tested. If we want to catch those as a module_test failure, we may want a version of iter_modules that just let's the function fail.

@fwkz fwkz self-assigned this May 4, 2016
@fwkz fwkz merged commit 4b3231a into threat9:master May 5, 2016
@fwkz
Copy link
Collaborator

fwkz commented May 5, 2016

@allonhadaya Thanks for all the hard work. Really appreciate the contribution.

  1. We want prevent accidental leakage of exploit's metadata, which contains sensitive information like author name, during the exploit's development process.
    In the sake of keeping the open nature of Python. I have introduced name-mingling mechanism that change name info to ExploitClassName__info_ allowing user to conscious accessing the attribute. Exact same mechanism is already implemented within Python making attribute __foo "private" by changing its name to __ClassName__foo
  2. You are right. Definitely we don't want miss something. I will think how to approach that.

@allonhadaya
Copy link
Contributor Author

@fwkz I'm happy I got to contribute. Feel free to reach out for code reviews / taking a crack at bugs or design issues.

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

Successfully merging this pull request may close these issues.

2 participants