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

Ftguess: more types and tests #716

Merged

Conversation

christian-intra2net
Copy link
Contributor

Created unittests for the latest module oletools.ftguess.

Doing that I realized that lots of types were missing from ftguess that we contain in our set of unittest samples. Extend ftguess to include at least those, so ftguess works correctly on all test samples. Also added a new test sample of type xps ("fixed page format") and fixed that one TODO about is_word()

Reallized as well that oleid was changed quite a lot when ftguess was created, so its unittests needed major changes. I re-created them from scratch to make them more easily extensible when oleid change again.

unittests work again now. In my opinion they should not ever fail on master to ensure that people relying on oletools are not unpleasantly suprised

Makes people think that we detected encryption, not that function
"is_encrypted" was started
File was created by myself, free to use
File type classes are all named FType_... but a few exceptions had
an upper-case Y: FTYpe_Excel . Makes no sense, I guess that was a
simple typo.

Also, some comments in classes were only marked with a single "'",
PEP requests three "'''"
Did this analogous to Word 2007+ template types, added a "content_type"
field with output from "file -i".

Is there a rule on how to select "name" and "long_name"? "file" does
not give the same results as those in the code
@decalage2 decalage2 self-requested a review October 5, 2021 10:15
@decalage2 decalage2 self-assigned this Oct 5, 2021
@decalage2 decalage2 added this to the oletools 0.60 milestone Oct 5, 2021
@christian-intra2net
Copy link
Contributor Author

Forgot to mention: this should solve issue #711 . I concur with jcmbs on to how to fix this

Return False if OpenXML type has no known main relationship part.
Otherwise recognize() will raise an error a few lines later at
splitext().

This should solve issue decalage2#711 (author had suggested exactly this)
This was a TODO which kept FileTypeGuesser.is_word from working properly.
With the creation of ftguess oleid has been changed a lot, the output
of its .check() method is very different. Instead of just adapting the
existing unittests, I re-created the complete test, trying to make it
easier to change/extend in the future.
@christian-intra2net
Copy link
Contributor Author

Fixed typo in a commit message ("pointpoint" --> "PowerPoint")

@decalage2 decalage2 linked an issue Nov 2, 2021 that may be closed by this pull request
@decalage2 decalage2 merged commit be16ef4 into decalage2:master Nov 2, 2021
@christian-intra2net christian-intra2net deleted the ftguess-more-types-and-tests branch February 16, 2022 12:55
@christian-intra2net
Copy link
Contributor Author

Thanks

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.

olevba : raises an error with an unknown docx
2 participants