CERT-Polska / karton-archive-extractor

Extractor of various archive formats for Karton framework
https://github.com/CERT-Polska/karton
GNU General Public License v3.0
5 stars 6 forks source link

Add reading password from attributes #18

Closed 74wny0wl closed 3 years ago

74wny0wl commented 3 years ago

Allows uploading encrypted archives (ex. zip file encrypted with ZipCrypto) via MWDB with password set as attribute

Note: 7z encrypted archives with AES (filenames encryption enabled) are not supported

nazywam commented 3 years ago

Hey, thanks for the PR!

What do you thinkg about doing it this way?

attributes = task.get_payload("attributes", default={})
if not task_password and attributes.get("password"):
    self.log.info("Accepting password from attributes")
    task_password = attributes.get("password")[0]

It would allow us to get rid of that nasty (attributes_password["password"] or [None])[0]

74wny0wl commented 3 years ago

Hey, thanks for the PR!

What do you thinkg about doing it this way?

attributes = task.get_payload("attributes", default={})
if not task_password and attributes.get("password"):
    self.log.info("Accepting password from attributes")
    task_password = attributes.get("password")[0]

It would allow us to get rid of that nasty (attributes_password["password"] or [None])[0]

Yes, it is much better :)