Skip to content

ScanTnef

Collects metadata and extract files from TNEF files.

Source code in strelka/src/python/strelka/scanners/scan_tnef.py
class ScanTnef(strelka.Scanner):
    """Collects metadata and extract files from TNEF files."""

    def scan(self, data, file, options, expire_at):
        self.event["total"] = {"attachments": 0, "extracted": 0}
        self.event.setdefault("object_names", [])

        tnef = tnefparse.TNEF(data)
        tnef_objects = getattr(tnef, "objects", [])
        for tnef_object in tnef_objects:
            descriptive_name = tnefparse.TNEF.codes.get(tnef_object.name)
            if descriptive_name not in self.event["object_names"]:
                self.event["object_names"].append(descriptive_name)

            try:
                object_data = tnef_object.data.strip(b"\0") or None
            except strelka.ScannerTimeout:
                raise
            except Exception:
                object_data = tnef_object.data

            if object_data is not None:
                if descriptive_name == "Subject":
                    self.event["subject"] = object_data
                elif descriptive_name == "Message ID":
                    self.event["message_id"] = object_data
                elif descriptive_name == "Message Class":
                    self.event["message_class"] = object_data

        tnef_attachments = getattr(tnef, "attachments", [])
        self.event["total"]["attachments"] = len(tnef_attachments)
        for attachment in tnef_attachments:
            # Send extracted file back to Strelka
            self.emit_file(attachment.data, name=attachment.name.decode())

            self.event["total"]["extracted"] += 1

        tnef_html = getattr(tnef, "htmlbody", None)
        if tnef_html:
            # Send extracted file back to Strelka
            self.emit_file(tnef_html, name="htmlbody")

Features

The features of this scanner are detailed below. These features represent the capabilities and the type of analysis the scanner can perform. This may include support for Indicators of Compromise (IOC), the ability to emit files for further analysis, and the presence of extended documentation for complex analysis techniques.

Feature
Support
IOC Support
Emit Files
Extended Docs
Malware Scanner
Image Thumbnails

Tastes

Strelka's file distribution system assigns scanners to files based on 'flavors' and 'tastes'. Flavors describe the type of file, typically determined by MIME types from libmagic, matches from YARA rules, or characteristics of parent files. Tastes are the criteria used within Strelka to determine which scanners are applied to which files, with positive and negative tastes defining files to be included or excluded respectively.

Source Filetype
Include / Exclude
application/vnd.ms-tnef
tnef_file

Scanner Fields

This section provides a list of fields that are extracted from the files processed by this scanner. These fields include the data elements that the scanner extracts from each file, representing the analytical results produced by the scanner. If the test file is missing or cannot be parsed, this section will not contain any data.

Failure

No fields to display. The test file may not exist or could not be processed.

Sample Event

Below is a sample event generated by this scanner, demonstrating the kind of output that can be expected when it processes a file. This sample is derived from a mock scan event configured in the scanner's test file. If no test file is available, this section will not display a sample event.

Failure

Test file not found for scanner tnef