Telepath API
- class synmods.fileparser.service.FileParserApi
Bases:
CellApi
,StormSvc
A Telepath API for the FileParser service.
File parser APIs return a stream of “tufo” events.
- async cancel(iden)
Send a cancel request to active parsing task.
- Parameters:
iden (str) – The iden of the channel
- Returns:
Whether the cancel request was successfully sent and a message.
- Return type:
bool, str
- async getParserDocDef()
Retrieve documentation strings for the fields returned by getParsers.
- Returns:
Mapping of fields to doc strings.
- Return type:
dict
- async getParsers(mime=None)
Retrieve information about the available parsers.
- Parameters:
mime (str) – The alias, name, or mime to get (return will be a list of 1).
- Returns:
Packed representations of the parsers containing the name, aliases, and mimes.
- Return type:
list
- Raises:
s_exc.SynErr – If mime is specified and a parser does not exist for it.
- async hexdump(sha256, size=1024)
- async htmlToJson(sha256, template)
Use a JSON definition to extract fields from HTML.
- Parameters:
sha256 (str) – The SHA256 hash of the bytes to be parsed from the axon.
template (dict) – A template which defines how to extract fields
- Returns:
An object whose structure is determined by the template.
- Return type:
object
- async iterStrings(sha256, size=1024)
- async iterText(sha256, conf=None)
Parse a field and yield text.
- Yields:
[bool, str, str] – Tuple of ok, sha256, text
- async parse(sha256, conf=None)
Parse a file retrieved from the Axon, represented by a SHA256 hash.
- Yields:
[str, obj, dict] – File parser events.
- async parseYaraRules(text, timeout=60)
Extract individual YARA rules out of text.
- Parameters:
text (str) – The text containing yara rules.
- Returns:
- Where retn is a mapping of YARA rule names to their rule text
on success or error message on failure.
- Return type:
tuple (ok, retn)
- async status()
Status of active parsing tasks.
- Returns:
List of info dictionaries
- Return type:
list
- async strings(sha256, size=1024, scrape=False, filters=None)
- async text(sha256, size, conf=None)
Returns all yielded text (including subfiles) as a string.
- async tx(iden, mesg)