External Scanners And Post Actions

Under Inventory menu it is possible to configure custom External Scanners and custom Post Actions.

For both these options we must enter two fields:

  • a unique name (maximum 16 character ASCII only text)
  • a full path to your executable/interpreter, that will be called by the processing node

Note: Since MetaDefender Core 5.2.2, External Scanner and Post Action no longer apply to all the requests. It now binds to Workflow. Therefore, after creating either External Scanner or Post Action, we need to add them into our desired Workflow Rules or Workflow Templates.

External Scanners

External Scanners are handled as scan engines from product side but are not updatable through the product.

Specification for external scanner process

  • INPUT

    • On standard input it gets the currently available scan result JSON without the extracted_files field
    • As last argument on the command line it gets the absolute path for the file to scan
    • If the command path contains space character, then must nest the command path into double quote. For example: "C:\Test Space\Hello.exe"
  • OUTPUT

    • If everything goes well, the return value must be 0; otherwise, to indicate that the scanner has Failed, a value in the range of 1 to 255 on Linux and 1 to 2,147,483,647 on Windows should be returned.
    • Scan result must be put on standard output in JSON format with the following fields
      • def_time: the definition time of this scanner in milliseconds since epoch that will be displayed by Metadefender Core
      • scan_result_i: the scan verdict for the file, see the GET Fetch Analysis ResultAPI > scan_all_result_i
      • threat_found: the found threat's description if any
      • If any of the above fields is missing or invalid, the result will automatically be Failed for this scanner

Number of External Scanners is a separately licensed feature. If you plan to use this feature please contact your OPSWAT reseller.

Example for a Custom Scanner

Example input for a Custom Scanner

response.json
Copy

Example valid output of a Custom Scanner

JSON
Copy

Example scan result where External Scanner found the file to be clean

JSON
Copy

Post Actions

Post Actions run after the scan of the file for any post functionality such as copying the file etc...

Specification for post action process

  • INPUT

    • On standard input it gets the currently available scan result JSON without the extracted_files field
    • As last argument on the command line it gets the absolute path for the file
  • OUTPUT

    • If everything goes well, the return value must be 0; otherwise, to indicate that the action has Failed, a value in the range of 1 to 255 on Linux and 1 to 2,147,483,647 on Windows should be returned.

Adding a Post Action is the same as in case of an External Scanner. The only difference is in the result handling.

All executed Post Action's result will be on the process_info.post_processing object of the scan result JSON. If the return value of an action is zero it will be shown in the actions_ran field, if the return value of the action is non-zero then it will be listed in the actions_failed field.

Example of a Post Action

The scan result JSON if the Post Action returns 0

JSON
Copy

The scan result JSON if the Post Action returns non-zero

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard