-
Notifications
You must be signed in to change notification settings - Fork 115
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
Adding Google Magika Tastes #436
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following types output by Magika on the Strelka test fixtures but are missing from backend.yml include the following. We should look at each and consider including them by default in their scanners (even disabled ones like ScanElf)
- application/javascript
- application/octet-stream
- application/vnd.debian.binary-package
- application/vnd.tcpdump.pcap
- application/x-apple-diskimage
- application/x-executable-elf
- application/x-mach-o
- application/x-ms-shortcut
- application/x-pem-file
- application/x-plist
- application/x-powershell (likely a false-positive type)
- application/x-yaml
- image/bmp
- text/csv
- text/vbscript
- video/mp4 (likely a false-positive type)
@@ -206,6 +211,10 @@ def __init__( | |||
if not self.coordinator: | |||
logging.info("backend started without coordinator") | |||
|
|||
def taste_magika(self, data: bytes) -> list: | |||
"""Tastes file data with magika.""" | |||
return [self.magika.identify_bytes(data).output.ct_label] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using new types introduced by Magika, I'd suggest using MIME type output so that existing definitions can be used, but (hopefully) better covered by Magika analysis.
|
||
mimes.extend(self.taste_mime(data)) | ||
yaras.extend(self.taste_yara(data)) | ||
magika.extend(self.taste_magika(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, I'd make typing with libmime, yara, and Magika clearly and independently configurable so that users have more control over how files get typed.
@@ -206,6 +211,10 @@ def __init__( | |||
if not self.coordinator: | |||
logging.info("backend started without coordinator") | |||
|
|||
def taste_magika(self, data: bytes) -> list: | |||
"""Tastes file data with magika.""" | |||
return [self.magika.identify_bytes(data).output.ct_label] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magika offers extra features that we should probably expose. For example, the PredictionMode
should be user configurable (defaults to High). We could output the confidence score as well so analysts can get context for odd files.
Describe the change
This change is still in draft, but the idea was to add another form of file tasting: Google Magika
Describe testing procedures
Built and tested against files - no known issues with file tasting outside perhaps misattribution (no errors)
The only error comes with
import "magic"
insidetaste.yara
and any yara that usesmagic
. A conflict?Sample output
Checklist