ThreatExchange Deprecated

Deprecated. Use the ThreatExchange v2 integration instead.

Data Enrichment & Threat Intelligence · ThreatExchange

Details

IDThreatExchange
ProviderMeta
CategoryData Enrichment & Threat Intelligence
From Version5.0.0
Supported ModulesAgentix XSIAM

README

Receive threat intelligence about applications, IP addresses, URLs and hashes, a service by Facebook

Configure ThreatExchange in Cortex

Parameter Description Required
Server URL (e.g. https://192.168.0.1)   True
App ID   True
App Secret   True
Source Reliability Reliability of the source providing the intelligence data. True
Use system proxy settings   False
Trust any certificate (not secure)   False
Api version   True

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

file


Checks the file reputation of the given hash.

Base Command

file

Input

Argument Name Description Required
file Hash of the file to query. Supports MD5, SHA1 and SHA256 hashes. Required
limit The maximum number of results per page. The maximum is 1000. Default is 20. Default is 20. Optional
headers A comma-separated list of headers to display in human-readable format. For example: header1,header2,header3. Optional
since The start timestamp for collecting malware, format: 1391813489. Optional
until The end timestamp for collecting malware, format: 1391813489. Optional

Context Output

Path Type Description
File.MD5 unknown Bad MD5 hash found.
File.SHA1 unknown Bad SHA1 hash found.
File.SHA256 unknown Bad SHA256 hash found.
DBotScore.Indicator unknown The indicator that was tested.
DBotScore.Type unknown The indicator type.
DBotScore.Vendor unknown The vendor used to calculate the score.
DBotScore.Score unknown The actual score.
File.Malicious.Vendor unknown For malicious files, the vendor that made the decision
File.Malicious.Description unknown For malicious files, the reason that the vendor made the decision.
File.Malicious.Score unknown For malicious files, the score from the vendor.

Command Example

!file file=bf4692a98a658dd7fb3599a47b6b48188a12345

Context Example

{
    "DBotScore": [
        {
            "Indicator": "bf4692a98a658dd7fb3599a47b6b48188a12345",
            "Reliability": "C - Fairly reliable",
            "Score": 0,
            "Type": "hash",
            "Vendor": "ThreatExchange"
        },
        {
            "Indicator": "bf4692a98a658dd7fb3599a47b6b48188a12345",
            "Reliability": "C - Fairly reliable",
            "Score": 0,
            "Type": "file",
            "Vendor": "ThreatExchange"
        }
    ]
}

Human Readable Output

ThreatExchange does not have details about bf4692a98a658dd7fb3599a47b6b48188a12345

ip


Checks the reputation of the given IP address.

Base Command

ip

Input

Argument Name Description Required
ip IP address to check. Required
headers A comma-separated list of headers to display in human-readable format. For example: header1,header2,header3. Optional

Context Output

Path Type Description
IP.Address unknown Bad IP address found.
IP.Malicious.Vendor unknown For malicious IPs addresse, the vendor that made the decision.
IP.Malicious.Description unknown For malicious IP addresses, the reason that the vendor made the decision.
DBotScore.Indicator unknown The indicator that was tested.
DBotScore.Type unknown The indicator type.
DBotScore.Vendor unknown The vendor used to calculate the score.
DBotScore.Score unknown The actual score.
IP.Malicious.Score unknown For malicious IP addresses, the score from the vendor.

Command Example

!ip ip=8.8.8.8

Context Example

{
    "DBotScore": [
        {
            "Indicator": "8.8.8.8",
            "Reliability": "C - Fairly reliable",
            "Score": 1,
            "Type": "ip",
            "Vendor": "ThreatExchange"
        },
        {
            "Indicator": "8.8.8.8",
            "Reliability": "C - Fairly reliable",
            "Score": 0,
            "Type": "ip",
            "Vendor": "ThreatExchange"
        }
    ],
    "IP": null
}

Human Readable Output

ThreatExchange IP Reputation

added_on confidence description id indicator last_updated owner privacy_type raw_indicator review_status severity share_level status type
2015-07-07T22:36:04+0000 50 Known DNS server 881335228606937 {“id”:”501655576609539”,”indicator”:”8.8.8.8”,”type”:”IP_ADDRESS”} 2020-07-24T05:25:48+0000 {“id”:”588498724619612”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook CERT ThreatExchange”} VISIBLE 8.8.8.8 REVIEWED_AUTOMATICALLY INFO GREEN NON_MALICIOUS IP_ADDRESS
2018-04-09T23:00:40+0000 50   1521082241333529 {“id”:”501655576609539”,”indicator”:”8.8.8.8”,”type”:”IP_ADDRESS”} 2020-07-24T21:52:30+0000 {“id”:”1656584897716085”,”email”:”threatexchange@support.facebook.com”,”name”:”JoeSandbox Analysis”} HAS_PRIVACY_GROUP 8.8.8.8 REVIEWED_AUTOMATICALLY INFO RED UNKNOWN IP_ADDRESS

url


Check URL Reputation

Base Command

url

Input

Argument Name Description Required
url URL to be checked. Required
limit The maximum number of results per page. The maximum is 1000. Default is 20. Default is 20. Optional
headers Headers to display in Human readable format, comma separated format, for example: header1,header2,header3. Optional
since The start timestamp for collecting malware, format: 1391813489. Optional
until The end timestamp for collecting malware, format: 1391813489. Optional

Context Output

Path Type Description
URL.Data unknown Bad URLs found
DBotScore.Indicator unknown The indicator that was tested.
DBotScore.Type unknown The indicator type.
DBotScore.Vendor unknown The vendor used to calculate the score.
DBotScore.Score unknown The actual score.
URL.Malicious.Vendor unknown For malicious URLs, the vendor that made the decision
URL.Malicious.Description unknown For malicious URLs, the reason for the vendor to make the decision
URL.Malicious.Score unknown For malicious URLs, the score from the vendor

Command Example

!url url=https://www.test.com/

Context Example

{
    "DBotScore": [
        {
            "Indicator": "https://www.test.com/",
            "Reliability": "C - Fairly reliable",
            "Score": 0,
            "Type": "url",
            "Vendor": "ThreatExchange"
        }
    ],
    "URL": null
}

Human Readable Output

ThreatExchange URL Reputation

added_on confidence id indicator last_updated owner privacy_type raw_indicator review_status severity share_level status type
2018-07-11T09:50:34+0000 25 1904903709602326 {“id”:”838258172933557”,”indicator”:”https://www.test.com/”,”type”:”URI”} 2020-07-24T19:24:35+0000 {“id”:”210126779388350”,”email”:”threatexchange@support.facebook.com”,”name”:”URLQueryThreatData Feed”} VISIBLE https://www.test.com/ REVIEWED_AUTOMATICALLY WARNING WHITE UNKNOWN URI
2015-07-09T03:04:19+0000 1 835880593160550 {“id”:”838258172933557”,”indicator”:”https://www.test.com/”,”type”:”URI”} 2020-07-24T03:37:14+0000 {“id”:”820763734618599”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook Administrator”} HAS_PRIVACY_GROUP https://www.test.com/ REVIEWED_AUTOMATICALLY INFO RED UNKNOWN URI

domain


Check domain reputation

Base Command

domain

Input

Argument Name Description Required
domain Domain name to check reputation. Required
limit The maximum number of results per page. The maximum is 1000. Default is 20. Default is 20. Optional
headers Headers to display in Human readable format, comma separated format, for example: header1,header2,header3. Optional
since The start timestamp for collecting malware, format: 1391813489. Optional
until The end timestamp for collecting malware, format: 1391813489. Optional

Context Output

Path Type Description
Domain.Name unknown Bad domain found
DBotScore.Indicator unknown The indicator that was tested.
DBotScore.Type unknown The indicator type.
DBotScore.Vendor unknown The vendor used to calculate the score.
DBotScore.Score unknown The actual score.
Domain.Malicious.Vendor unknown For malicious domains, the vendor that made the decision
Domain.Malicious.Description unknown For malicious domains, the reason that the vendor made the decision.

Command Example

!domain domain=google.com

Context Example

{
    "DBotScore": [
        {
            "Indicator": "google.com",
            "Reliability": "C - Fairly reliable",
            "Score": 0,
            "Type": "domain",
            "Vendor": "ThreatExchange"
        },
        {
            "Indicator": "google.com",
            "Reliability": "C - Fairly reliable",
            "Score": 1,
            "Type": "domain",
            "Vendor": "ThreatExchange"
        }
    ],
    "Domain": null
}

Human Readable Output

ThreatExchange Domain Reputation

added_on confidence id indicator last_updated owner privacy_type raw_indicator review_status severity share_level status type
2018-05-02T18:05:33+0000 75 1688788781168786 {“id”:”826838047363868”,”indicator”:”google.com”,”type”:”DOMAIN”} 2020-07-24T21:13:36+0000 {“id”:”1656584897716085”,”email”:”threatexchange@support.facebook.com”,”name”:”JoeSandbox Analysis”} HAS_PRIVACY_GROUP google.com UNREVIEWED INFO RED UNKNOWN DOMAIN
2015-09-04T22:03:24+0000 50 955242124521797 {“id”:”826838047363868”,”indicator”:”google.com”,”type”:”DOMAIN”} 2020-07-24T01:04:11+0000 {“id”:”588498724619612”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook CERT ThreatExchange”} VISIBLE google.com REVIEWED_MANUALLY INFO WHITE NON_MALICIOUS DOMAIN

threatexchange-query


Searches for subjective opinions on indicators of compromise stored in ThreatExchange

Base Command

threatexchange-query

Input

Argument Name Description Required
text Free-form text field with a value to search for. This can be a file hash or a string found in other fields of the objects. Optional
type The type of descriptor to search for. For more information see: https://developers.facebook.com/docs/threat-exchange/reference/apis/indicator-type/v2.9. Optional
limit The maximum number of results per page. The maximum is 1000. Default is 20. Default is 20. Optional
headers Headers to display in Human readable format, comma separated format, for example: header1,header2,header3. Optional
since The start timestamp for collecting malware, format: 1391813489. Optional
until The end timestamp for collecting malware, format: 1391813489. Optional

Context Output

There is no context output for this command.

Command Example

!threatexchange-query text=geektime type=URI limit=3

Context Example

{
    "queryResult": [
        {
            "added_on": "2018-08-30T07:12:28+0000",
            "confidence": 50,
            "id": "2036544083043163",
            "indicator": {
                "id": "2036543926376512",
                "indicator": "http://www.geektime.co.il/wp-content/uploads/2016/09/",
                "type": "URI"
            },
            "last_updated": "2021-03-03T02:41:06+0000",
            "owner": {
                "email": "threatexchange@support.facebook.com",
                "id": "820763734618599",
                "name": "Facebook Administrator"
            },
            "privacy_type": "VISIBLE",
            "raw_indicator": "http://www.geektime.co.il/wp-content/uploads/2016/09/",
            "review_status": "REVIEWED_AUTOMATICALLY",
            "severity": "INFO",
            "share_level": "GREEN",
            "status": "UNKNOWN",
            "type": "URI"
        }
    ]
}

Human Readable Output

ThreatExchange Query Result

added_on confidence id indicator last_updated owner privacy_type raw_indicator review_status severity share_level status type
2018-08-30T07:12:28+0000 50 2036544083043163 {“id”:”2036543926376512”,”indicator”:”http://www.geektime.co.il/wp-content/uploads/2016/09/”,”type”:”URI”} 2021-03-03T02:41:06+0000 {“id”:”820763734618599”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook Administrator”} VISIBLE http://www.geektime.co.il/wp-content/uploads/2016/09/ REVIEWED_AUTOMATICALLY INFO GREEN UNKNOWN URI
2018-08-28T14:59:24+0000 50 1799344580151062 {“id”:”1799344400151080”,”indicator”:”http://www.geektime.co.il/wp-content/uploads/2016/05/”,”type”:”URI”} 2020-07-24T20:12:26+0000 {“id”:”820763734618599”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook Administrator”} VISIBLE http://www.geektime.co.il/wp-content/uploads/2016/05/ REVIEWED_AUTOMATICALLY INFO GREEN UNKNOWN URI
2018-08-24T20:16:16+0000 50 2265237266824665 {“id”:”2265236920158033”,”indicator”:”http://www.geektime.co.il/wp-content/uploads/2016/07/”,”type”:”URI”} 2020-07-24T18:45:09+0000 {“id”:”820763734618599”,”email”:”threatexchange@support.facebook.com”,”name”:”Facebook Administrator”} VISIBLE http://www.geektime.co.il/wp-content/uploads/2016/07/ REVIEWED_AUTOMATICALLY INFO GREEN UNKNOWN URI

threatexchange-members


Returns a list of current members of the ThreatExchange, alphabetized by application name. Each application may also include an optional contact email address. You can set this address, if desired, under the settings panel for your application

Base Command

threatexchange-members

Input

| Argument Name | Description | Required |
| — | — | — |

Context Output

There is no context output for this command.

Command Example

!threatexchange-members

Human Readable Output

ThreatExchange Members

email id name
example@example.com example_id_1 Example Name 1
example2@example.com example_id_2 Example Name 2
example3@example.com example_id_3 Example Name 3
example4@example.com example_id_4 Example Name4

Configuration parameters

  • Server — Server URL (e.g. https://192.168.0.1) (required)
  • appID — App ID (required)
  • appSecret — App Secret (required)
  • integrationReliability — Source Reliability (required)
  • useproxy — Use system proxy settings
  • insecure — Trust any certificate (not secure)
  • apiVersion — Api version (required)

Commands (6)

  • domain

    Check domain reputation

  • file

    Checks the file reputation of the given hash.

  • ip

    Checks the reputation of the given IP address.

  • threatexchange-members

    Returns a list of current members of the ThreatExchange, alphabetized by application name. Each application may also include an optional contact email address. You can set this address, if desired, under the settings panel for your application

  • threatexchange-query

    Searches for subjective opinions on indicators of compromise stored in ThreatExchange

  • url

    Check URL Reputation

var serverUrl = params.Server; if (serverUrl[serverUrl.length - 1] !== '/') {
    serverUrl += '/';
}
var defaultLimit = 20;
var doReq = function(method, path, parameters) {
    if (!parameters) {
        parameters = {};
    }
    parameters.access_token = params.appID + '|' + params.appSecret;
    var result = http(
        serverUrl + '/' + params.apiVersion + '/'+ path + (method === 'GET' ? encodeToURLQuery(parameters) : ''),
        {
            Headers: {'Content-Type': ['application/x-www-form-urlencoded'], 'Accept': ['application/json']},
            Method: method,
            Body: method == 'POST' ? encodeToURLQuery(parameters).substring(1) : ''
        },
        params.insecure,
        params.useproxy
    );
    if (result.StatusCode < 200 || result.StatusCode > 299) {
        throw 'Failed to perform request ' + path + ', request status code: ' + result.StatusCode + ' with Body: '+ result.Body;
    }
    if (result.Body === '') {
        throw 'No content recieved for ThreatExchange path: '+path;
    }
    var obj;
    try {
        obj = JSON.parse(result.Body);
    } catch (ex) {
        throw 'Error parsing reply - ' + result.Body + ' - ' + ex;
    }
    return {body: result.Body, obj: obj, statusCode: result.StatusCode};
};
var doFile = function(hash, reliability) {
    var limit = defaultLimit;
    if (args.limit) {
        limit = args.limit;
    }
    var argsForCall = {text: hash, limit: limit, strict_text: true};
    if (args.since) {
        argsForCall.since = args.since;
    }
    if (args.until) {
        argsForCall.until = args.until;
    }
    var res = doReq('GET', 'malware_analyses', argsForCall);
    var data = res.obj.data;
    var ec = {};
    ec.DBotScore = [];
    if (data.length === 0) {
        ec.DBotScore.push({
            Indicator: hash,
            Type: 'hash',
            Vendor: 'ThreatExchange',
            Score: 0,
            Reliability: reliability
        });
        ec.DBotScore.push({
            Indicator: hash,
            Type: 'file',
            Vendor: 'ThreatExchange',
            Score: 0,
            Reliability: reliability
        })

        return {Type: entryTypes.note, Contents: res.body, ContentsFormat: formats.json,
            HumanReadable: 'ThreatExchange does not have details about ' + hash + '\n',
            EntryContext: ec
        };
    }
    ec[outputPaths.file] = [];
    var md = tblToMd('ThreatExchange Hash Reputation', data, argToList(args.headers));
    for (var i=0; i<data.length; i++) {
        var dbotScore = 0;
        if (data[i].status == 'MALICIOUS') {
            dbotScore = 3;
            var malFile = {};
            addMalicious(malFile,outputPaths.file,{MD5: data[i].md5, SHA1: data[i].sha1, SHA256: data[i].sha256, Malicious: {Vendor: 'ThreatExchange', Description: data[i].description}});
            ec[outputPaths.file].push(malFile[outputPaths.file]);
        } else if (data[i].status == 'SUSPICIOUS') {
            dbotScore = 2;
        } else if (data[i].status == 'NON_MALICIOUS'){
            dbotScore = 1;
        }
        ec.DBotScore.push({
            Indicator: hash,
            Type: 'hash',
            Vendor: 'ThreatExchange',
            Score: dbotScore,
            Reliability: reliability
        });
        ec.DBotScore.push({
            Indicator: hash,
            Type: 'file',
            Vendor: 'ThreatExchange',
            Score: dbotScore,
            Reliability: reliability
        })
    }
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md,
        EntryContext: ec
    };
};
var dbotTypeHashList = function(hash, score) {
    return [{
            Indicator: hash,
            Type: 'hash',
            Vendor: 'ThreatExchange',
            Score: score,
            Reliability: reliability
        },
        {
            Indicator: hash,
            Type: 'file',
            Vendor: 'ThreatExchange',
            Score: score,
            Reliability: reliability
        }
        ]
}
var doIP = function(ip, reliability) {
    if (!isValidIP(ip)) {
        return {Type: entryTypes.error, Contents: 'IP - ' + ip + ' is not valid IP', ContentsFormat: formats.text};
    }
    var limit = defaultLimit;
    if (args.limit) {
        limit = args.limit;
    }
    var argsForCall = {text: ip, limit: limit, strict_text: true, type: 'IP_ADDRESS'};
    if (args.since) {
        argsForCall.since = args.since;
    }
    if (args.until) {
        argsForCall.until = args.until;
    }
    var res = doReq('GET', 'threat_descriptors', argsForCall);
    var data = res.obj.data;
    var ec = {};
    ec.DBotScore = [];
    if (data.length === 0) {
        ec.DBotScore.push({
            Indicator: ip,
            Type: 'ip',
            Vendor: 'ThreatExchange',
            Score: 0,
            Reliability: reliability
        });
        return {
            Type: entryTypes.note,
            Contents: res.body,
            ContentsFormat: formats.json,
            HumanReadable: 'ThreatExchange does not have details about ' + ip + '\n',
            EntryContext: ec
        };
    }
    ec[outputPaths.ip] = [];
    var md = tblToMd('ThreatExchange IP Reputation', data, argToList(args.headers));
    for (var i=0; i<data.length; i++) {
        var dbotScore = 0;
        if (data[i].status == 'MALICIOUS') {
            dbotScore = 3;
            // not really an array, so I can override
            addMalicious(ec, outputPaths.ip, {
                Address: ip,
                Malicious: {
                    Vendor: 'ThreatExchange',
                    Description: data[i].description
                }
            });
        } else if (data[i].status == 'SUSPICIOUS') {
            dbotScore = 2;
        } else if (data[i].status == 'NON_MALICIOUS'){
            dbotScore = 1;
        }
        ec.DBotScore.push({
            Indicator: ip,
            Type: 'ip',
            Vendor: 'ThreatExchange',
            Score: dbotScore,
            Reliability: reliability
        });
    }
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md,
        EntryContext: ec
    };
};
var doURL = function(url, reliability) {
    var limit = defaultLimit;
    if (args.limit) {
        limit = args.limit;
    }
    var argsForCall = {text: url, limit: limit, strict_text: true, type: 'URI'};
    if (args.since) {
        argsForCall.since = args.since;
    }
    if (args.until) {
        argsForCall.until = args.until;
    }
    var res = doReq('GET', 'threat_descriptors', argsForCall);
    var data = res.obj.data;
    var ec = {};
    ec.DBotScore = [];
    if (data.length === 0) {
        ec.DBotScore.push({
            Indicator: url,
            Type: 'url',
            Vendor: 'ThreatExchange',
            Score: 0,
            Reliability: reliability
        });
        return {
            Type: entryTypes.note,
            Contents: res.body,
            ContentsFormat: formats.json,
            HumanReadable: 'ThreatExchange does not have details about ' + url + '\n',
            EntryContext: ec
        };
    }
    ec[outputPaths.url] = [];
    var md = tblToMd('ThreatExchange URL Reputation', data, argToList(args.headers));
    for (var i=0; i<data.length; i++) {
        var dbotScore = 0;
        if (data[i].status == 'MALICIOUS') {
            dbotScore = 3;
            // not really an array, so I can override
            addMalicious(ec, outputPaths.url, {
                Data: url,
                Malicious: {
                    Vendor: 'ThreatExchange',
                    Description: data[i].description
                }
            });
        } else if (data[i].status == 'SUSPICIOUS'){
            dbotScore = 2;
        } else if (data[i].status == 'NON_MALICIOUS'){
            dbotScore = 1;
        }
        ec.DBotScore.push({
            Indicator: url,
            Type: 'url',
            Vendor: 'ThreatExchange',
            Score: dbotScore,
            Reliability: reliability
        });
    }
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md,
        EntryContext: ec
    };
};
var doDomain = function(domain, reliability) {
    var limit = defaultLimit;
    if (args.limit) {
        limit = args.limit;
    }
    var argsForCall = {
        text: domain,
        limit: limit,
        strict_text: true,
        type: 'DOMAIN'
    };

    if (args.since) {
        argsForCall.since = args.since;
    }
    if (args.until) {
        argsForCall.until = args.until;
    }
    var res = doReq('GET', 'threat_descriptors', argsForCall);
    var data = res.obj.data;
    var ec = {};
    ec.DBotScore = [];
    if (data.length === 0) {
        ec.DBotScore.push({
            Indicator: domain,
            Type: 'domain',
            Vendor: 'ThreatExchange',
            Score: 0,
            Reliability: reliability
        });
        return {
            Type: entryTypes.note,
            Contents: res.body,
            ContentsFormat: formats.json,
            HumanReadable: 'ThreatExchange does not have details about ' + domain + '\n',
            EntryContext: ec
        };
    }
    ec[outputPaths.domain] = [];
    var md = tblToMd('ThreatExchange Domain Reputation', data, argToList(args.headers));
    for (var i=0; i<data.length; i++) {
        var dbotScore = 0;
        if (data[i].status == 'MALICIOUS') {
            dbotScore = 3;
            addMalicious(ec, outputPaths.domain, {
                Name: domain,
                Malicious: {
                    Vendor: 'ThreatExchange',
                    Description: data[i].description
                }
            });
        } else if (data[i].status == 'SUSPICIOUS') {
            dbotScore = 2;
        } else if (data[i].status == 'NON_MALICIOUS'){
            dbotScore = 1;
        }
        ec.DBotScore.push({
            Indicator: domain,
            Type: 'domain',
            Vendor: 'ThreatExchange',
            Score: dbotScore,
            Reliability: reliability
        });
    }
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md,
        EntryContext: ec
    };
};
var doQuery = function(text) {
    var limit = defaultLimit;
    if (args.limit) {
        limit = args.limit;
    }
    var argsForCall = {
        limit: limit,
        strict_text: false
    };
    if (args.type) {
        argsForCall.type = args.type;
    }
    if (args.text) {
        argsForCall.text = args.text;
    }
    if (args.since) {
        argsForCall.since = args.since;
    }
    if (args.until) {
        argsForCall.until = args.until;
    }
    var res = doReq('GET', 'threat_descriptors', argsForCall);
    var data = res.obj.data;
    if (data.length === 0) {
        return {
            Type: entryTypes.note,
            Contents: res.body,
            ContentsFormat: formats.json,
            HumanReadable: 'ThreatExchange does not have details about ' + text + '\n'
        };
    }
    var ec = {};
    ec.queryResult = data;
    var md = tblToMd('ThreatExchange Query Result', data, argToList(args.headers));
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md,
        EntryContext: ec
    };
};
var doMembers = function() {
    var res = doReq('GET', 'threat_exchange_members', {});
    var data = res.obj.data;
    var md = tblToMd('ThreatExchange Members', data, argToList(args.headers));
    return {
        Type: entryTypes.note,
        Contents: res.body,
        ContentsFormat: formats.json,
        HumanReadable: md
    };
};
var isValidReliability = function(reliability) {
    var reliability_options = ['A+ - 3rd party enrichment', 'A - Completely reliable', 'B - Usually reliable', 'C - Fairly reliable', 'D - Not usually reliable', 'E - Unreliable', 'F - Reliability cannot be judged'];
    return reliability_options.indexOf(reliability) >= 0;
};
var reliability = params.integrationReliability; if(!reliability){
    reliability = 'C - Fairly reliable';
} if(!isValidReliability(reliability)) {
    return 'Error, Source Reliability value is invalid. Please choose from available reliability options.';
}
switch (command) {

    case 'test-module':
        doFile('d2b4a84e2b69856ba8e234f55b1fbc4b'); // Check File Hash d2b4a84e2b69856ba8e234f55b1fbc4b - it will throw an error if not successful
        return true;
    case 'file':
        return doFile(args.file, reliability);
    case 'ip':
        return doIP(args.ip, reliability);
    case 'url':
        return doURL(args.url, reliability);
    case 'domain':
        return doDomain(args.domain, reliability);
    case 'threatexchange-query':
        return doQuery(args.text);
    case 'threatexchange-members':
        return doMembers();
    default:
        throw 'Unknown command - ' + command;
}