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

Is encrypted by msoffcrypto #436

Conversation

christian-intra2net
Copy link
Contributor

Encountered a sample for which msoffcrypto correctly detects encryption but "our" code does not (see first commit). Instead of fixing our code, duplicating stuff that works in msoffcrypto, use the msoffcrypto code to check for encryption. Keep our old implementation as backup (in case msoffcrypto fails or is not available).

Also added a try-catch around is_encrypted testing solving issue #427 . Add test code so this will not happen again.
And update some testcode to get rid of oleid-warnings.

This is an interesting one since "our" old implementation of is_encrypted
claims that the embedded file is still encrypted (which it is not), but
the msoffcrypto-is_encrypted gets it right.
@christian-intra2net
Copy link
Contributor Author

Running each of the new tests works, but running them together results in fails. Investigating...

Running main() within same interpreter capturing SystemExit and
sys.stdout/err always causes trouble (at least in unittest).
Fork another python process and capture from there, that is easier
and cleaner in my view.
@christian-intra2net
Copy link
Contributor Author

So, finally working. I keep making the mistake to try and capture the output of unittests by temporarily replacing sys.stdout with StringIO. Always seems like a nice idea but never works reliably (at least not in unittest)
I created a helper function in test_utils that forks a new python and runs the code whose output we want to capture there. That is more reliable in my experience

@christian-intra2net
Copy link
Contributor Author

Argh! Still failing for pypy, will have to investigate on thursday.

@christian-intra2net
Copy link
Contributor Author

Closing this for now, need to push a few more times to find problem with pypy

@christian-intra2net
Copy link
Contributor Author

Found the problem: pypy issued a warning about ssl that did not appear in CPython. Have travis now also included in my fork, so I should be able to determine beforehand whether PRs will fail.
Github won't let me re-open this pull-request, so I will create a new one

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.

1 participant