VxStream Deprecated

Deprecated. Use CrowdStrike Falcon Sandbox V2 instead.

Forensics & Malware Analysis · CrowdStrike Falcon Sandbox

Details

IDVxStream
ProviderCrowdStrike
CategoryForensics & Malware Analysis
From Version5.0.0

README

Use the CrowdStrike Falcon Sandbox integration to submit and analyze files and URLs.

The maximum file upload size is 100 MB.

Supported File Types:

  • PE (.exe, .scr, .pif, .dll, .com, .cpl, and so on)
  • Microsoft Word (.doc, .docx, .ppt, .pps, .pptx, .ppsx, .xls, .xlsx, .rtf, .pub)
  • PDF
  • APK
  • JAR executables
  • Windows Script Component (.sct)
  • Windows Shortcut (.lnk)
  • Windows Help (.chm)
  • HTML Application (.hta)
  • Windows Script File (*.wsf)
  • Javascript (.js)
  • Visual Basic (*.vbs, *.vbe)
  • Shockwave Flash (.swf)
  • Perl (.pl)
  • PowerShell (.ps1, .psd1, .psm1)
  • Scalable Vector Graphics (.svg)
  • Python scripts (.py)
  • Perl scripts (.pl)
  • Linux ELF executables
  • MIME RFC 822 (*.eml)
  • Outlook (*.msg files)

Prerequisites

Make sure you have the following CrowdStrike Falcon Sandbox information.

  • API key
  • Secret key (applicable for v1)
  • API version (v1 or v2)

Each API key has an associated authorization level, which determines the available endpoints. By default, all free, non-vetted accounts can issue restricted keys. You can upgrade to full default keys, enabling file submissions and downloads.

Authorization levels:

  • Restricted
  • Default
  • Elevated
  • Super

 

Configure CrowdStrike Falcon Sandbox on Cortex XSOAR

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for VxStream.
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance.
    • Server URL (e.g., https://216.3.128.82)
    • API Key
    • Secret Key (applicable only for v1)
    • API Version (v1,v2)
    • Trust any certificate (not secure)
    • Use system proxy settings
  4. Click Test to validate the URLs, token, and connection.

Commands

You can execute these commands from the Cortex XSOAR 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.

1. (Deprecated) Get summary information for a file hash


Get summary information for a given MD5 hash, SHA-1 hash, or SHA-256 hash, and all the reports generated for any environment ID.

Base Command

vx-scan

Input
Argument Name Description Required
file The file hash (MD5, SHA-1, or SHA-256). Required

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
File.SHA1 string SHA1 of the file.
File.MD5 string The MD5 hash of the file.
File.environmentId number The environment ID of the file.
File.analysis_start_time string The analysis start time of the file.
File.submitname string The submission name of the file.
File.classification_tags unknown The list of classification tags of the file.
File.vxfamily string The family classification of the file.
File.total_network_connections number The total network connections of the file.
File.total_processes number The total processes count of the file.
File.total_signatures number The total signatures count of the file.
File.hosts unknown The list of the file’s hosts.
File.isinteresting boolean Whether the server found this file interesting.
File.domains unknown A list of the file’s related domains.
File.isurlanalysis boolean If file analyzed by url.
File.Malicious.Vendor string For malicious files, the vendor that made the decision.
File.Malicious.Description string For malicious files, the reason that the vendor made the decision.

 

2. Get hash scan results


Returns summary information for a given MD5 hash, SHA-1 hash, or SHA-256 hash, and all the reports generated for any environment ID.

Base Command

crowdstrike-scan

Input
Argument Name Description Required
file The file hash (MD5, SHA-1, or SHA-256). Required

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
File.SHA1 string The SHA-1 hash of the file.
File.MD5 string The MD5 hash of the file.
File.environmentId string The environment ID of the file.
File.analysis_start_time string The analysis start time of the file.
File.submitname string The submission name of the file.
File.classification_tags unknown A list of classification tags of the file.
File.vxfamily string The family classification of the file.
File.total_network_connections number The total network connections of the file.
File.total_processes number The total processes count of the file.
File.total_signatures number The total signatures count if the file.
File.hosts unknown A list of the file’s hosts.
File.isinteresting boolean If the server found this file interesting.
File.domains unknown A list of the file’s related domains.
File.isurlanalysis boolean Whether the file was analyzed by URL.
File.Malicious.Vendor string or malicious files, the vendor that made the decision.
File.Malicious.Description string For malicious files, the reason for the vendor to make the decision.
DBotScore.Indicator string The indicator that was tested.
DBotScore.Type string The indicator type.
DBotScore.Vendor string The vendor used to calculate the score.
DBotScore.Score number The actual score.
File.hash string The hash used to query the file.
File.state string The state of the file test.

 

Command Example
crowdstrike-scan file=59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355
Context Example
{
    "DBotScore": {
        "Vendor": "CrowdStrike Falcon Sandbox",
        "Indicator": "59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355",
        "Score": 3,
        "Type": "hash"
    },
    "File": [
        {
            "compromised_hosts": [],
            "vxfamily": "Trojan.Generic",
            "environmentId": 100,
            "JobID": "5ae5ae527ca3e1156459b9f3",
            "classification_tags": [],
            "total_processes": 1,
            "SHA256": "59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355",
            "size": 38400,
            "submitname": "Keygen.exe",
            "threat_level": 2,
            "target_url": null,
            "error_type": null,
            "state": "SUCCESS",
            "mitre_attcks": [],
            "certificates": [],
            "verdict": "malicious",
            "sha512": "d771eb56097a771b9faab47b3d32007a8a5c2c06c3fa2c590d48d7000bf120f69d41340490d61564cab7f2e9135e3f9465a62b69f8e922602f946cff4a76fc13",
            "extracted_files": [],
            "isurlanalysis": false,
            "environmentDescription": "Windows 7 32 bit",
            "SHA1": "f0fe4ae74cfb7be57c99551b75f00d66915e6900",
            "hash": "59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355",
            "analysis_start_time": "2018-04-29T13:42:28+00:00",
            "tags": [],
            "imphash": "610be5e05d19476fe9370d6dd1347f2a",
            "total_network_connections": 0,
            "av_detect": 48,
            "threatscore": 100,
            "total_signatures": 18,
            "error_origin": null,
            "ssdeep": "768:IXD4nBg7xSUrIzAx9BNVk3aEKmICkm2oxAlGrPbKjol0qcDg2p9LjLJvN:I6W8yIzAx9r+UkzaG6Y0qcz9nVvN",
            "MD5": "6ba83f1bf6617dab7990c495cd67dcf6",
            "processes": [],
            "type": "PE32 executable (GUI) Intel 80386, for MS Windows, UPX compressed",
            "file_metadata": null,
            "hosts": [],
            "isinteresting": false,
            "domains": [],
            "type_short": [
                "peexe",
                "executable"
            ]
        }
    ]
}
Human Readable Output

Scan Results:

Analysis start time AvDetect Certificates Classification tags CompromisedHosts Domains EnvironmentDescription EnvironmentId ErrorOrigin ErrorType ExtractedFiles FileMetadata Hosts Imphash Interesting JobId Md5 MitreAttcks Processes Sha1 Sha256 Sha512 Size Ssdeep State SubmitName Tags TargetUrl ThreatLevel ThreatScore Total network connections Total processes Total signatures Type TypeShort UrlAnalysis Verdict VxFamily
2018-04-29T13:42:28+00:00 48         Windows 7 32 bit 100           610be5e05d19476fe9370d6dd1347f2a false 5ae5ae527ca3e1156459b9f3 6ba83f1bf6617dab7990c495cd67dcf6     f0fe4ae74cfb7be57c99551b75f00d66915e6900 59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355 d771eb56097a771b9faab47b3d32007a8a5c2c06c3fa2c590d48d7000bf120f69d41340490d61564cab7f2e9135e3f9465a62b69f8e922602f946cff4a76fc13 38400 768:IXD4nBg7xSUrIzAx9BNVk3aEKmICkm2oxAlGrPbKjol0qcDg2p9LjLJvN:I6W8yIzAx9r+UkzaG6Y0qcz9nVvN SUCCESS Keygen.exe     2 100 0 1 18 PE32 executable (GUI) Intel 80386, for MS Windows, UPX compressed peexe,executable false malicious Trojan.Generic

 

3. (Deprecated) Get a list of all environments


Returns a list of all available environments. Deprecated, use the crowdstrike-get-environments command instead.

Base Command

vx-get-environments

Input

There are no input arguments for this command.

Context Output
Path Type Description
VX.Environment.ID unknown Environment ID.
VX.Environment.description unknown The environment description.
VX.Environment.architecture unknown Environment architecture.
VX.Environment.VMs_total unknown Total virtual machines in the environment.
VX.Environment.VMs_busy unknown Busy virtual machines in the environment.
VX.Environment.analysisMode unknown Analysis mode of environment.
VX.Environment.groupicon unknown Icon of environment.

 

4. Get a list of all environments


Returns a list of all available environments.

Base Command

crowdstrike-get-environments

Input

There are no input arguments for this command.

Context Output
Path Type Description
CrowdStrike.Environment.ID number The environment ID.
CrowdStrike.Environment.description string The environment description.
CrowdStrike.Environment.architecture string The environment architecture.
CrowdStrike.Environment.VMs_total number The total virtual machines in the environment.
CrowdStrike.Environment.VMs_busy number The busy virtual machines in the environment.
CrowdStrike.Environment.analysisMode string The analysis mode of the environment.
CrowdStrike.Environment.groupicon string The icon of the environment.

 

Command Example
crowdstrike-get-environments
Context Example
{
    "VX.Environment": [
        {
            "VMs_total": 78,
            "description": "Windows 7 32 bit",
            "VMs_invalid": 3,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 100,
            "VMs_busy": 3,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 77,
            "description": "Windows 7 32 bit (HWP Support)",
            "VMs_invalid": 3,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 110,
            "VMs_busy": 3,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 86,
            "description": "Windows 7 64 bit",
            "VMs_invalid": 0,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 120,
            "VMs_busy": 4,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 18,
            "description": "Linux (Ubuntu 16.04, 64 bit)",
            "VMs_invalid": 0,
            "groupicon": "linux",
            "architecture": "WINDOWS",
            "ID": 300,
            "VMs_busy": 0,
            "analysisMode": "USERMODE"
        },
        {
            "VMs_total": 0,
            "description": "Android Static Analysis",
            "VMs_invalid": 0,
            "groupicon": "android",
            "architecture": "ANDROID",
            "ID": 200,
            "VMs_busy": 0,
            "analysisMode": "USERMODE"
        }
    ],
    "CrowdStrike.Environment": [
        {
            "VMs_total": 78,
            "description": "Windows 7 32 bit",
            "VMs_invalid": 3,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 100,
            "VMs_busy": 3,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 77,
            "description": "Windows 7 32 bit (HWP Support)",
            "VMs_invalid": 3,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 110,
            "VMs_busy": 3,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 86,
            "description": "Windows 7 64 bit",
            "VMs_invalid": 0,
            "groupicon": "windows",
            "architecture": "WINDOWS",
            "ID": 120,
            "VMs_busy": 4,
            "analysisMode": "KERNELMODE"
        },
        {
            "VMs_total": 18,
            "description": "Linux (Ubuntu 16.04, 64 bit)",
            "VMs_invalid": 0,
            "groupicon": "linux",
            "architecture": "WINDOWS",
            "ID": 300,
            "VMs_busy": 0,
            "analysisMode": "USERMODE"
        },
        {
            "VMs_total": 0,
            "description": "Android Static Analysis",
            "VMs_invalid": 0,
            "groupicon": "android",
            "architecture": "ANDROID",
            "ID": 200,
            "VMs_busy": 0,
            "analysisMode": "USERMODE"
        }
    ]
}
Human Readable Output

All Environments:

_ID Description Architecture Total VMS Busy VMS Analysis mode Group icon
100 Windows 7 32 bit WINDOWS 78 3 KERNELMODE windows
110 Windows 7 32 bit (HWP Support) WINDOWS 77 3 KERNELMODE windows
120 Windows 7 64 bit WINDOWS 86 4 KERNELMODE windows
300 Linux (Ubuntu 16.04, 64 bit) WINDOWS 18 0 USERMODE linux
200 Android Static Analysis ANDROID 0 0 USERMODE android

 

5. (Deprecated) Submit a file sample for analysis


Submits a file from the investigation for analysis. Deprecated, use the crowdstrike-submit-sample command instead.

Base Command

vx-submit-sample

Input
Argument Name Description Required
entryId The War Room entry ID of the sample file. Required
environmentId The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Optional

 

Context Output

There is no context output for this command.

6. Submit a file sample for analysis


Submits a file from the investigation for analysis.

Base Command

crowdstrike-submit-sample

Input
Argument Name Description Required
entryId The War Room entry ID of the sample file. Required
environmentID The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Required

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
File.MD5 string The MD5 hash of the file.
File.SHA1 string The SHA-1 hash of the file.
CrowdStrike.JobID string The job ID of the sample.
CrowdStrike.EnvironmentID number The environment ID of the sample.

 

Command Example
crowdstrike-submit-sample entryId=1043@2
Context Example
{
    "CrowdStrike": {
        "EnvironmentID": 100,
        "JobID": "5c98a5860388384f701662c1"
    },
    "File": {
        "SHA256": "955017fdfeb29962d42f2273c4c9535a0da5bd4b4a430b7c9f7ad03e5a42b7a0"
    }
}
Human Readable Output

File submitted successfully
SHA256 - 955017fdfeb29962d42f2273c4c9535a0da5bd4b4a430b7c9f7ad03e5a42b7a0
Job ID - 5c98a5860388384f701662c1
Environment ID - 100

7. (Deprecated) Query the database


Searches the database using Falcon Sandbox search syntax. Deprecated, use the crowdstrike-search command instead.

Base Command

vx-search

Input
Argument Name Description Required
query Falcon Sandbox query syntax (see <server url>/faq#advanced-search-optionsfor more details). examples - url:google, host:95.181.53.78 Required

 

Context Output
Path Type Description
VX.Search.SHA256 unknown The SHA-256 hash of the search result.
VX.Search.SHA1 unknown The SHA-1 hash of the search result.
VX.Search.MD5 unknown The MD5 hash of the search result.
VX.Search.environmentId unknown The environment ID of the search result.
VX.Search.start_time unknown The start time of the search result.
VX.Search.threatscore unknown The threat score of the search result (by server).
VX.Search.verdict unknown Verdict of search result
VX.Search.environmentDescription unknown The environment description of the search result.
VX.Search.submitname unknown The submission name of the search result.
VX.Search.vxfamily unknown The family of the search result
VX.Search.threatscore unknown The threat score of the search result.
VX.Search.type_short unknown The type of search result, for example: url or host.
VX.Search.size unknown The size of the search result.
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.

 

8. Query the database


Searches the database using Falcon Sandbox search syntax.

Base Command

crowdstrike-search

Input
Argument Name Description Required
query Falcon Sandbox query syntax, for example: url:google,host:95.181.53.78. This argument integrates all other arguments to one, and cannot be passed with the other arguments. Optional
filename Filename, for example: invoice.exe Optional
filetype Filetype, for example: docx Optional
filetype_desc Filetype description, for example: PE32 executable Optional
env_id Environment ID Optional
country Country (3 digit ISO), for example: swe, usa, fra Optional
verdict Verdict Optional
av_detect AV Multiscan range, for example: 50-70 (min 0, max 100) Optional
vx_family AV Family Substring, for example: nemucod Optional
tag Hashtag, for example: ransomware Optional
port Port, for example: 8080 Optional
host Host, for example: 192.168.0.1 Optional
domain Domain, for example: checkip.dyndns.org Optional
url HTTP Request Substring, for example: google Optional
similar_to Similar Samples Optional
context Sample Context Optional
imp_hash Import Hash Optional
ssdeep SSDeep Optional
authentihash Authentication Hash Optional

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the search result.
File.SHA1 string The SHA-1 of the search result.
File.MD5 string The MD5 hash of the search result.
File.environmentId number The environment ID of the search result.
File.start_time unknown The start time of the search result.
File.threatscore string The threat score of the search result (by server).
File.verdict string The verdict of the search result.
File.environmentDescription string The environment description of search result.
File.submitname string The submission name of the search result.
File.vxfamily string The family of the search result.
File.threatscore number The threat score of the search result.
File.type_short string The type of search result, for example: url or host.
File.size number The size of the search result.
File.Malicious.Vendor string For malicious files, the vendor that made the decision.
File.Malicious.Description string For malicious files, the reason that the vendor made the decision.

 

Command Example
crowdstrike-search filetype=.docx
Context Example
{
    "VX.Search": [],
    "File": []
}
Human Readable Output

No data returned

9. (Deprecated) Get result data for a file


Retrieves result data for a file. This command returns a file. Deprecated, use the crowdstrike-result command instead.

Base Command

vx-result

Input
Argument Name Description Required
file File hash (MD5, SHA-1, or SHA-256). Required
environmentId The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Optional

 

Context Output

There is no context output for this command.

10. Get result data for a file


Retrieves result data for a file. This command returns a file.

Base Command

crowdstrike-result

Input
Argument Name Description Required
file File hash (MD5, SHA-1, or SHA-256). Madatory in v1. Optional
environmentId The environment ID to submit file to. To get all environments, run the crowdstrike-get-environments command. Mandatory in v1. Optional
file-type File type of report to return (supported only in v2). Optional
JobID Job ID of file to generate report of (supported only in v2). Optional

 

Context Output
Path Type Description
DBotScore.Indicator string The indicator that was tested.
DBotScore.Type string The indicator type.
DBotScore.Vendor string The vendor used to calculate the score.
DBotScore.Score number The actual score.

 

Command Example
crowdstrike-result file=59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355

11. (Deprecated) Detonate a file


Detonates file using Falcon Sandbox.

Base Command

vx-detonate-file

Input
Argument Name Description Required
entryId The War Room entry ID of the sample file. Required
environmentID The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Default is 100, or other WINDOWS ID. Optional
delay The delay wait time between calls (in seconds). Optional
timeout The total wait time (in seconds). Optional

 

Context Output

There is no context output for this command.

12. (Deprecated) Detonate a file


Detonates a file using Falcon Sandbox.

Base Command

crowdstrike-detonate-file

Input
Argument Name Description Required
entryId The War Room entry ID of the sample file. Required
environmentID The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Default is 100, or other WINDOWS ID. Optional
delay The delay wait time between calls (in seconds). Optional
timeout The total wait time (in seconds). Optional

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
File.SHA1 string The SHA-1 hash of the file.
File.MD5 string The MD5 hash of the file.
File.environmentId string The environment ID of the file.
File.analysis_start_time string The analysis start time of the file.
File.submitname string The submission name of the file.
File.classification_tags unknown A list of classification tags of the file.
File.vxfamily string The family classification of the file.
File.total_network_connections number The total network connections of the file.
File.total_processes number The total processes count of the file.
File.total_signatures number The total signatures count of the file.
File.hosts unknown A list of file’s hosts.
File.isinteresting boolean Whether the server found this file interesting.
File.domains unknown A list of the file’s related domains.
File.isurlanalysis boolean Whether the file was analyzed by URL.
File.Malicious.Vendor string For malicious files, the vendor that made the decision.
File.Malicious.Description string For malicious files, the reason that the vendor made the decision.
DBotScore.Indicator string The indicator that was tested.
DBotScore.Type string The indicator type.
DBotScore.Vendor string The vendor used to calculate the score.
DBotScore.Score number The actual score.

 

13. Submit a URL for analysis


Submits a URL for analysis. This command is only supported in v2.

Base Command

crowdstrike-submit-url

Input
</tr>
Argument Name Description Required
url The URL to analyze. Required
environmentID The ID of the environment to submit the URL to. Required
dontThrowErrorOnFileDetonation Determine if the command will throw an error on an unsupported file error. Default is false.

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
CrowdStrike.EnvironmentID string The ID of the environment in which the URL was analyzed.
CrowdStrike.JobID string The job ID of the URL analysis.

 

Command Example
crowdstrike-submit-url url=www.google.com environmentID=100
Context Example
{
    "CrowdStrike": {
        "EnvironmentID": 100,
        "JobID": "58c1c211aac2eda9503bc31f"
    },
    "File": {
        "SHA256": "d2edef8e43054be586d17ddcc761e7a1f4a6946c39e653d7e095a826ef34b6a1",
        "hash": "d2edef8e43054be586d17ddcc761e7a1f4a6946c39e653d7e095a826ef34b6a1"
    }
}
Human Readable Output

URL www.google.com was submitted for analysis on CrowdStrike Falcon Sandbox

EnvironmentId JobId Sha256
100 58c1c211aac2eda9503bc31f d2edef8e43054be586d17ddcc761e7a1f4a6946c39e653d7e095a826ef34b6a1

 

14. Get screenshots from a report


Retrieves screenshots from a report. This command is only supported in v2.

Base Command

crowdstrike-get-screenshots

Input
Argument Name Description Required
file The SHA-2556 hash of the file to retrieve screenshots of. Optional
environmentID The ID of the environment to retrieve screenshots from. Optional
JobID The job ID to retrieve screenshots from. Optional

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the search result.
File.SHA1 string The SHA-1 hash of the search result.
File.MD5 string The MD5 hash of the search result.
File.environmentId number The ID of the search result environment.
File.start_time unknown The start time of the search result.
File.threatscore string The threat score of the search result (by server).
File.verdict string The verdict of the search result.
File.environmentDescription string The description of the search result environment.
File.submitname string The submission name of the search result.
File.vxfamily string The family of search result.
File.threatscore number The threat score of the search result.
File.type_short string The type of search result, for example: url or host.
File.size number Size of the search result.
File.Malicious.Vendor string For malicious files, the vendor that made the decision.
File.Malicious.Description string For malicious files, the reason that the vendor made the decision.

 

Command Example
crowdstrike-get-screenshots file=59e17f98cef7dd1bf4fb791eb1dcd0cea6dd870b6e36af7c37bd732c84d43355

15. (Deprecated) Detonate a URL


Detonates a URL address using Falcon Sandbox. This command is only supported in v2.

Base Command

crowdstrike-detonate-url

Input
Argument Name Description Required
url The URL address to be submitted. Required
environmentID The ID of the environment to submit the URL to. To get all IDs, run the crowdstrike-get-environments command. Default is 100, or other WINDOWS ID. Optional
delay Delay wait time between calls (in seconds). Optional
timeout Total wait time (in seconds). Optional
file-type The report file type. Optional

 

Context Output
Path Type Description
DBotScore.Indicator string The indicator that was tested.
DBotScore.Type string The indicator type.
DBotScore.Vendor string The vendor used to calculate the score.
DBotScore.Score number The actual score.

 

16. Submit a file for analysis (by URL)


Submit a file for analysis (by URL). This command is only supported only in v2.

Base Command

crowdstrike-submit-file-by-url

Input
Argument Name Description Required
environmentID The ID of the environment to submit the file to. To get all IDs, run the crowdstrike-get-environments command. Optional
url The URL of the file to submit. Required

 

Context Output
Path Type Description
File.SHA256 string The SHA-256 hash of the file.
CrowdStrike.EnvironmentID string The ID of the environment in which the file was analyzed.
CrowdStrike.JobID string The job ID of the file analysis.

 

Command Example
crowdstrike-submit-file-by-url url=https://swagger.io/swagger/media/blog/wp-content/uploads/2017/06/Whitepaper_APIDocumentationDX.pdf
Context Example
{
    "CrowdStrike": {
        "EnvironmentID": 100,
        "JobID": "5c98a51e028838377b1662c0"
    },
    "File": {
        "SHA256": "f317cc246bc0fe55db49a8eb40acab49d9689f3ea764d19abbc464008f01b6d1"
    }
}
Human Readable Output

File https://swagger.io/swagger/media/blog/wp-content/uploads/2017/06/Whitepaper_APIDocumentationDX.pdf was submitted for analysis on CrowdStrike Falcon Sandbox

EnvironmentId JobId Sha256
100 5c98a51e028838377b1662c0 f317cc246bc0fe55db49a8eb40acab49d9689f3ea764d19abbc464008f01b6d1

Configuration parameters

  • serverUrl — Server URL (e.g. https://216.3.128.82) (required)
  • apiKey — API Key (required)
  • secretKey — Secret Key (applicable only for v1)
  • version — API Version (v1,v2)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (16)

  • crowdstrike-detonate-file Deprecated

    (Deprecated - Please use CrowdStrike Falcon Sandbox - Detonate file playbook instead) Detonate file through Falcon Sandbox

  • crowdstrike-detonate-url Deprecated

    (Deprecated - Please use CrowdStrike Falcon Sandbox - Detonate URL playbook instead) Detonates URL address through Falcon Sandbox (supported only in v2)

  • crowdstrike-get-environments

    Get a list of all available environments

  • crowdstrike-get-screenshots

    Retrieves screenshots from a report (Supported only in v2)

  • crowdstrike-result

    Retrieve result data upon a file. NOTE - This command returns a file

  • crowdstrike-scan

    Get summary information for a given MD5, SHA1 or SHA256 and all the reports generated for any environment ID

  • crowdstrike-search

    Search the database using the Falcon Sandbox search syntax

  • crowdstrike-submit-file-by-url

    Submit a file by URL for analysis (Supported only in v2).

  • crowdstrike-submit-sample

    Submit a file from investigation to analysis server

  • crowdstrike-submit-url

    Submit a URL for analysis (Supported only in v2)

  • vx-detonate-file Deprecated

    (Deprecated - Please use CrowdStrike Falcon Sandbox - Detonate file playbook instead) Detonate file through Falcon Sandbox

  • vx-get-environments Deprecated

    Get a list of all available environments

  • vx-result Deprecated

    Retrieve result data upon a file. NOTE - This command returns a file

  • vx-scan Deprecated

    Get summary information for a given MD5, SHA1 or SHA256 and all the reports generated for any environment ID

  • vx-search Deprecated

    Search the database using the Falcon Sandbox search syntax

  • vx-submit-sample Deprecated

    Submit a file from investigation to analysis server

var apiKey = params.apiKey;
var secretKey = params.secretKey;
var serverUrl = params.serverUrl;
var insecure = params.insecure;
var proxy = params.proxy;
var version = params.version;
if (version === undefined) {
    version = 'v1';
}
if (version === 'v1' && !secretKey) {
    return 'No API secret key was provided.';
}
var HEADERS = {
    'User-Agent': ['Falcon Sandbox']
};
if (version === 'v1') {
    HEADERS['Authorization'] = ['Basic ' + Base64.encode(apiKey + ':' + secretKey)];
} else { // API Version is v2
    HEADERS['api-key'] = [apiKey];
    HEADERS['accept'] = ['application/json'];
}

// handle '/' at the end of serverUrl
if (serverUrl[serverUrl.length - 1] === '/') {
    serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}

// Add `contains` to String prototype.

if (!('contains' in String.prototype))
    String.prototype.contains = function(str, startIndex) {
        return -1 !== String.prototype.indexOf.call(this, str, startIndex);
    };

function argToBool(arg){
    switch (typeof arg){
        case 'boolean': return arg;
        case 'string': return (arg === 'true');
        case 'undefined': return false;
    }

}

function entryError(errorCode, text) {
    var error = 'Falcon Sandbox returned an error (' + errorCode + ') - ' + text;
    return {Type: entryTypes.error, ContentsFormat: formats.text, Contents: error};
}

// return a function that maps object keys by mapper (or capitlize keys if key is not exists in mapper)
function mapObject(mapper) {
    return function(obj) {
        var res = {};
        Object.keys(obj).forEach(function(key) {
            // map key or capitalize if not exists
            var newKey = mapper[key] || key;
            res[newKey] = obj[key];
        });
        return res;
    };
}

function createTableEntry(name, rawResponse, table, context, headers) {
    return {
        Type: entryTypes.note,
        ContentsFormat: formats.json,
        Contents: rawResponse,
        ReadableContentsFormat: formats.markdown,
        HumanReadable: tableToMarkdown(name, table, headers, undefined, headerTransform=underscoreToCamelCase),
        EntryContext: context
    };
}

function sendRequest(method, endpoint, body) {
    var requestUrl = serverUrl + endpoint;
    var res = http(
        requestUrl,
        {
            Method: method,
            Headers: HEADERS,
            Body: body
        },
        insecure,
        proxy
    );

    if (res.StatusCode < 200 || res.StatusCode >= 300) {
        throw 'Request Failed.\nStatus code: ' + res.StatusCode + '.\nBody: ' + JSON.stringify(res, null, 2) + '.';
    }
    var responseBody;
    try {
        responseBody = JSON.parse(res.Body);
    } catch (ex) {
        responseBody = res.Bytes;
    }
    return responseBody;
}

function scan(hash) {
    if (version === 'v1'){
        return sendRequest('GET', '/api/scan/' + hash);
    } else { // v2
        HEADERS['Content-Type'] = ['application/x-www-form-urlencoded'];
        return sendRequest('POST', '/api/v2/search/hash', 'hash='+hash);
    }

}
function scanToEntry(res, hash) {
    if (version === 'v1' && res.response_code !== 0) {
        return entryError(res.response_code, res.response.error);
    }
    var response = (version === 'v1') ? res.response: res;
    // Prettify response certificates
    if (response[0].certificates) {
        for (var i = 0; i < response[0].certificates.length; i++) {
            response[0].certificates[i] = JSON.stringify(response[0].certificates[i], null, 2);
        }
    }
    // create table from response
    var tableMapper = {
       threatlevel: 'threat level',
       total_network_connections: 'total network connections',
       targeturl: 'target url',
       classification_tags: 'classification tags',
       threatscore: 'threat score',
       total_processes: 'total processes',
       submitname: 'submit name',
       environmentDescription: 'environment description',
       isinteresting: 'interesting',
       environmentId: 'environment id',
       isurlanalysis: 'url analysis',
       analysis_start_time: 'analysis start time',
       total_signatures: 'total signatures'
    };

    var table = response.map(mapObject(tableMapper));

    // create context from response
    var context = {};

    var contextMapper = {
        sha1: 'SHA1',
        sha256: 'SHA256',
        md5: 'MD5',
        job_id: 'JobID',
        environment_id: 'environmentId',
        threat_score: 'threatscore',
        environment_description: 'environmentDescription',
        submit_name: 'submitname',
        url_analysis: 'isurlanalysis',
        interesting: 'isinteresting',
        vx_family: 'vxfamily'
    };
    var filePath = "File(val.hash===obj.hash)";
    fileContext = response.map(mapObject(contextMapper));
    fileContext[0].hash = hash;
    context[filePath] = fileContext;
    response.forEach(function(res) {
       if(res.threatlevel && res.threatlevel > 1) {
           addMalicious(context, outputPaths.file, {
                MD5: res.md5,
                SHA1: res.sha1,
                SHA256: res.sha256,
                Malicious: {
                    Vendor: 'Falcon Sandbox',
                    Description: 'Score above ' + res.threatscore
                }
            });
       }
    });
    context.DBotScore = {
        Indicator: response[0].sha256,
        Type: 'hash',
        Vendor: 'CrowdStrike Falcon Sandbox',
        Score: translateScore(response[0]['threat_level'])
    }
    return createTableEntry('Scan Results:', response, table, context);
}

function getEnvironments() {
    var response;
    if (version === 'v1'){
        var res = sendRequest('GET', '/system/state');
        if (res.response_code !== 0) {
            return entryError(res.response_code, res.response.error);
        }
        response = res.response;
    }
    else{//v2
        response = sendRequest('GET', '/api/v2/system/environments')
    }
    return response;
}

function tableFromEnvironments(response) {
    var environments = response; // if v2
    if(version === 'v1'){
        if ('environment' in response) { // Single-server setup
            environments = response.environment;
        } else { // Multi-server setup
            environments = response.backend.global_environment;
        }
    }
    var environmentsKeys = Object.keys(environments);
    var table=[];
    var envContext = [];
    for (var i = 0; i < environmentsKeys.length; i++){
        var currentEnvironment = environments[environmentsKeys[i]];
        table[i] = {
            'ID': (version === 'v1') ? currentEnvironment.ID : currentEnvironment.environment_id,
            description: currentEnvironment.description,
            architecture: currentEnvironment.architecture,
            'total VMS': (version === 'v1') ? currentEnvironment.VMs_total : currentEnvironment.total_virtual_machines,
            'busy VMS': (version === 'v1') ? currentEnvironment.VMs_busy : currentEnvironment.busy_virtual_machines,
            'analysis mode': (version === 'v1') ? currentEnvironment.analysisMode : currentEnvironment.analysis_mode,
            'group icon': currentEnvironment.groupicon ? currentEnvironment.groupicon :
            currentEnvironment.group_icon ? currentEnvironment.group_icon : ''
        };
        envContext[i] = {
            'ID': (version === 'v1') ? currentEnvironment.ID : currentEnvironment.environment_id,
            'description': currentEnvironment.description,
            'architecture': currentEnvironment.architecture,
            'VMs_invalid': (version === 'v1') ? currentEnvironment.VMs_invalid : currentEnvironment.invalid_virtual_machines,
            'VMs_total': (version === 'v1') ? currentEnvironment.VMs_total : currentEnvironment.total_virtual_machines,
            'VMs_busy': (version === 'v1') ? currentEnvironment.VMs_busy : currentEnvironment.busy_virtual_machines,
            'analysisMode': (version === 'v1') ? currentEnvironment.analysisMode : currentEnvironment.analysis_mode,
            'groupicon': currentEnvironment.groupicon ? currentEnvironment.groupicon :
            currentEnvironment.group_icon ? currentEnvironment.group_icon : ''
        }
    }
    // create context from environments
    var context = {
        'VX.Environment(val.ID && val.ID == obj.ID)': envContext,
        'CrowdStrike.Environment(val.ID && val.ID == obj.ID)': envContext
    };


    return createTableEntry('All Environments:', response, table, context, ['ID', 'description', 'architecture', 'total VMS', 'busy VMS', 'analysis mode', 'group icon']);
}

function submitFile(entryId, environmentId) {
    var requestUrl = version === 'v1' ? serverUrl + '/api/submit' : serverUrl + '/api/v2/submit/file';
    var multipart_content = null;
    if (version === 'v2') {
        HEADERS['Content-Type'] = ['application/x-www-form-urlencoded'];
        multipart_content = {environment_id: environmentId}; // For API v2
    } else {
        multipart_content = {environmentId: environmentId}; // For API v1
    }

    // submit file
    var res = httpMultipart(
                requestUrl, // URL
                entryId, // Optional - FilePath / EntryID
                {
                    Method: 'POST',
                    Headers: HEADERS
                },
                multipart_content,
                insecure,
                proxy
            );

    if (res.StatusCode < 200 || res.StatusCode >= 300) {
        throw 'Multipart Request Failed.\nStatus code: ' + res.StatusCode + '.\nBody: ' + JSON.stringify(res) + '.';
    }
    var body;

    try {
        body = JSON.parse(res.Body);
    } catch (ex) {
        throw 'Error parsing response - ' + res.Body + ' - ' + ex;
    }
    if (version === 'v1' && body.response_code !== 0) {
        return entryError(body.response_code, body.response.error);
    }
    var response = version === 'v1' ? body.response: body;

    var fileResult = {};
    if (response.sha256) {
        fileResult.SHA256 = response.sha256;
    }
    if (response.sha1) {
        fileResult.SHA1 = response.sha1;
    }
    if (response.md5) {
        fileResult.MD5 = response.md5;
    }
    if (response['job_id']) {
        fileResult.JobID = response['job_id'];
    }
    if (response['environment_id']) {
        fileResult.EnvironmentID = response['environment_id'];
    }
    return fileResult;
}

function submitFileEntry(file) {
    var resMessage = 'File submitted successfully';
    var fileContext = {}
    var csContext = {}
    if (file.SHA256) {
        fileContext.SHA256 = file.SHA256;
        resMessage += '\nSHA256 - ' + file.SHA256;
    }
    if (file.SHA1) {
        fileContext.SHA1 = file.SHA1;
        resMessage += '\nSHA1 - ' + file.SHA1;
    }
    if (file.MD5) {
        fileContext.MD5 = file.MD5;
        resMessage += '\nMD5 - ' + file.MD5;
    }
    if (file.JobID) {
        csContext.JobID = file.JobID;
        resMessage += '\nJob ID - ' + file.JobID;
    }
    if (file.EnvironmentID) {
        csContext.EnvironmentID = file.EnvironmentID;
        resMessage += '\nEnvironment ID - ' + file.EnvironmentID;
    }
    var context = {
        'File(val.JobID && val.JobID == obj.JobID || val.SHA256 && val.SHA256 == obj.SHA256)': fileContext
    }

    if (csContext) {
        context['CrowdStrike(val.JobID && val.JobID === obj.JobID)'] = csContext
    }

    return {
        Type: entryTypes.note,
        ContentsFormat: formats.json,
        Contents: file,
        ReadableContentsFormat: formats.markdown,
        HumanReadable: resMessage,
        EntryContext: context
    };
}

function searchQuery() {
    var res;
    if (version === 'v1') {
        var query = '';
        if (args.query) {
            query = args.query;
        } else {
        // Build Crowd Strike query syntax from arguments, i.e. key:value
            for (var key in args) {
                if (key === 'verdict') {
                    var verdictNumber = translateVerdict(args[key]);
                    query += key + ':' + verdictNumber + '&';
                    continue;
                }
                if (key === 'country' && args[key].length != 3) {
                    throw 'Country ISO code should be 3 characters long'
                }
                query += key + ':' + args[key] + '&';
            }
        }
        res = sendRequest('GET', '/api/search?query=' + query);
    } else { //API Version is v2
        HEADERS['Content-Type'] = ['application/x-www-form-urlencoded'];
        body = '';
        if (args.query) {
            args.query.split(',').forEach(function(keyValue){
               splittedObject = keyValue.split(/:(.+)/); // Split by first ':' only
               key = splittedObject[0];
               value = splittedObject[1];
               body += key + '=' + value + '&'
            });
        } else {
        // Build Crowd Strike query syntax from arguments, i.e. key:value
            for (var key in args) {
                if (key === 'verdict') {
                    var verdictNumber = translateVerdict(args[key]);
                    body += key + '=' + verdictNumber + '&';
                    continue;
                }
                if (key === 'country' && args[key].length != 3) {
                    throw 'Country ISO code should be 3 characters long'
                }
                body += key + '=' + args[key] + '&';
            }
        }
        res = sendRequest('POST', '/api/v2/search/terms', body)
    }

    if (version === 'v1' && res.response_code !== 0) {
        return entryError(res.response_code, res.response.error);
    }

    var result = version === 'v1' ? res.response.result : res.result

    // create table from search result
    var tableMapper = {
       environmentDescription: 'environment description',
       start_time: 'start time',
       submitname: 'submit name',
       threatscore: 'threat score',
       type_short: 'type short',
    };

    var table = result.map(mapObject(tableMapper));

    // create context from search result
    var contextMapper;
    var context;
    if (version === 'v1') {
        contextMapper = {
            sha1: 'SHA1',
            sha256: 'SHA256',
            md5: 'MD5',
        };

        context = {
            'File(val.MD5 && val.MD5 == obj.MD5 || val.SHA1 && val.SHA1 == obj.SHA1 || val.SHA256 && val.SHA256 == obj.SHA256)': result.map(mapObject(contextMapper)),
            'VX.Search(val.JobID && val.JobID == obj.JobID || val.SHA256 && val.SHA256 == obj.SHA256)': result.map(mapObject(contextMapper)) //VX.Search context path is for backward compatibility
        };
    } else { // v2
        contextMapper = {
            job_id: 'JobID',
            sha256: 'SHA256',
            environment_id: 'environmentId',
            threat_score: 'threatscore',
            environment_description: 'environmentDescription',
            submit_name: 'submitname',
            analysis_start_time: 'start_time'
        };

        context = {
            'File(val.JobID && val.JobID == obj.JobID || val.SHA256 && val.SHA256 == obj.SHA256)': result.map(mapObject(contextMapper)),
            'VX.Search(val.JobID && val.JobID == obj.JobID || val.SHA256 && val.SHA256 == obj.SHA256)': result.map(mapObject(contextMapper)) //VX.Search context path is for backward compatibility
        };
    }

    result.forEach(function(res) {
       if(res.threatlevel && res.threatlevel > 1) {
           addMalicious(context, outputPaths.file, {
                MD5: res.md5,
                SHA1: res.sha1,
                SHA256: res.sha256,
                Malicious: {
                    Vendor: 'Falcon Sandbox',
                    Description: 'Score above ' + res.threatscore
                }
            });
       }
    });

    return createTableEntry('Search results:', result, table, context);
}

function translateVerdict(verdict) {
    var verdictNumber;
    switch (verdict) {
        case 'Whitelisted':
            verdictNumber = 1;
            break;
        case 'NoVerdict':
            verdictNumber = 2;
            break;
        case 'NoSpecificThreat':
            verdictNumber = 3;
            break;
        case 'Suspicious':
            verdictNumber = 4;
            break;
        case 'Malicious':
            verdictNumber = 4;
            break;
    }
    return verdictNumber;
}

function csResultCmd(hash, environmentId, fileType, jobID) {
    var res = csResult(hash, environmentId, fileType, jobID);

    if (res.response_code !== undefined && res.response_code !== 0) {
        return entryError(res.response_code, res.response.error);
    }

    if (version === 'v2') {
      var fileScan = null;
      if(hash != null){
        var fileScan = scan(hash);
      }
      return resultEntry(res, fileType, fileScan);
    } else {
        return res;
    }
}

function csResult(hash, environmentId, fileType, jobID) {
    var csID;
    if (version === 'v2') {
        if (hash && environmentId){
            csID = hash + ':' + environmentId;
        } else if (jobID) {
            csID = jobID;
        } else {
            return 'Job ID or SHA256 and environment ID are required.'
        }
    }
    var cmdUrl = (version === 'v1') ? '/api/result/' + hash + '?type=json&environmentId=' + args.environmentId : '/api/v2/report/' + csID + '/report/' + fileType;
    return sendRequest('GET', cmdUrl);
}

function resultEntry(result, fileType, scan) {
    var currentTime = new Date();
    var filename =  'CrowdStrike_report_' + currentTime.getTime();
    switch (fileType) {
        case 'pcap':
        case 'bin':
        case 'xml':
        case 'html':
            filename += '.gz';
            break;
        case 'json':
            filename += '.json';
            result = JSON.stringify(result);
            break;
        case 'misp':
        case 'stix':
            filename += '.xml';
            break;
        case 'pdf':
            filename += '.pdf';
    }
    ec = {}
    if(scan != null){
      ec = {
          DBotScore: {
              Indicator: scan[0].sha256,
              Type: 'hash',
              Vendor: 'CrowdStrike Falcon Sandbox',
              Score: translateScore(scan[0]['threat_level'])
          }
      }
    }
    return {
        Type: 9,
        FileID: saveFile(result),
        File: filename,
        Contents: filename,
        EntryContext: ec
    };
}

function translateScore(score) {
    /* Translates CS threat level to DBot Score */
    var scoreObject = {
        3: 0,
        2: 3,
        1: 2,
        0: 1
    }
    if (score in scoreObject) {
        return scoreObject[score];
    } else {
        return 0;
    }
}

function detonateFile(entryId, delay, timeout) {
    var environmentId;
    if (args.environmentID) {
        environmentId = args.environmentID;
    } else {
        var environments = getEnvironments();
        if(version === 'v1'){
            if ('environment' in environments) { // Single-server setup
                environments = environments.environment;
            } else { // Multi-server setup
                environments = environments.backend.global_environment;
            }
        }
        for (var i=0; i<environments.length; i++) {
            if (environments[i]['ID'] === 100) {
                environmentId = 100;
                break;
             } else if (environments[i]['architecture'].toLowerCase() === 'windows') {
                environmentId = environments[i]['ID'];
                break;
            }
        }
    }
    if (!environmentId) {
        throw 'No environment ID was given'
    }
    var file = submitFile(entryId, environmentId.toString());
    var hash = file.SHA256;

    delayTime = parseInt(delay);
    timeOut = parseInt(timeout);
    var waitTime = delayTime;

    wait(delayTime);
    while (waitTime<timeOut) {
        var res = scan(hash);
        if ((version === 'v1' && res.response.length > 0 && res.response[0]) || (version === 'v2' && res.length > 0)) {
            return scanToEntry(res, hash);
        } else {
            waitTime = waitTime + delayTime;
            wait(delayTime);
        }
    }
    throw ('Timeout due to no answer after ' + timeOut + ' seconds.');
}

function submitUrlCmd(url, environmentID, dontThrowErrorOnFileDetonation) {
    if (version === 'v1') {
        throw 'This command is supported only in API v2.'
    }
    try {
      var response = submitUrl(url, environmentID);
    } catch (exception) {
          var notSupported = 'The provided URL resolves to a file.'
          if (dontThrowErrorOnFileDetonation && exception.contains(notSupported)){
              return 'The file format is not supported, use the command "crowdstrike-submit-file-by-url" instead.';
          } else {
              throw exception;
          }
    }
    var context = {
        'File(val.hash && val.hash === obj.hash)': {
            'SHA256': response['sha256'],
            'hash': response['sha256']
        },
        'CrowdStrike(val.JobID && val.JobID === obj.JobID)': {
            'EnvironmentID': response['environment_id'],
            'JobID': response['job_id']
        }
    };
    var title = 'URL ' + url + ' was submitted for analysis on CrowdStrike Falcon Sandbox';
    return createTableEntry(title, response, response, context);
}

function submitUrl(url, environmentID) {
    var cmdUrl = '/api/v2/submit/url-for-analysis';
    var body = 'url=' + encodeURIComponent(url) + '&environment_id=' + environmentID;
    HEADERS['Content-Type'] = ['application/x-www-form-urlencoded'];
    return sendRequest('POST', cmdUrl, body);
}

function getScreenshotsCmd(file, environmentID, jobID) {
    if (version === 'v1') {
        throw 'This command is supported only in API v2.'
    }
    var response = getScreenshots(file, environmentID, jobID);
    var images = [];
    for (var i = 0; i < response.length; i++) {
        images.push({
            Type: entryTypes.note,
            ContentsFormat: formats.json,
            Contents: '',
            ReadableContentsFormat: formats.markdown,
            HumanReadable: '![](data:image/png;base64,' + response[i]['image'] + ')'
        });
    }
    return images
}

function getScreenshots(file, environmentID, jobID) {
    var csID;
    if (file && environmentID){
        csID = file + ':' + environmentID;
    } else if (jobID) {
        csID = jobID;
    } else {
        return 'Job ID or SHA256 and environment ID are required.'
    }
    var cmdUrl = '/api/v2/report/' + csID +'/screenshots';
    return sendRequest('GET', cmdUrl);
}

function file(hash) {
    args.context = hash;
    delete args.file;
    return searchQuery();
}

function detonateUrl(url, delay, timeout, fileType) {
    if (version === 'v1') {
        throw 'This command is supported only in API v2.'
    }
    var environmentId;
    if (args.environmentID) {
        environmentId = args.environmentID;
    } else {
        var environments = getEnvironments();
        if(version === 'v1'){
            if ('environment' in environments) { // Single-server setup
                environments = environments.environment;
            } else { // Multi-server setup
                environments = environments.backend.global_environment;
            }
        }
        for (var i=0; i<environments.length; i++) {
            if (environments[i]['ID'] === 100) {
                environmentId = 100;
                break;
             } else if (environments[i]['architecture'].toLowerCase() === 'windows') {
                environmentId = environments[i]['ID'];
                break;

            }
        }
    }
    if (!environmentId) {
        throw 'No environment ID was given'
    }
    var jobId = submitUrl(url, environmentId);
    delayTime = parseInt(delay);
    timeOut = parseInt(timeout);
    var waitTime = delayTime;

    wait(delayTime);
    while (waitTime<timeOut) {
        if (response) {
            var response = csResult(null, environmentId, fileType, jobId);
            return resultEntry(response, fileType);
        } else {
            waitTime = waitTime + delayTime;
            wait(delayTime);
        }
    }
    throw ('Timeout due to no answer after ' + timeOut + ' seconds.');
}

function submitFileByUrlCommad(url, environmentID) {
    if (version === 'v1') {
        throw 'This command is supported only in API v2.'
    }
    var response = submitFileByUrl(url, environmentID);
    var context = {
        'File(val.SHA256 && val.SHA256 === obj.SHA256)': {
            'SHA256': response['sha256']
        },
        'CrowdStrike(val.JobID && val.JobID === obj.JobID)': {
            'EnvironmentID': response['environment_id'],
            'JobID': response['job_id']
        }
    };
    var title = 'File ' + url + ' was submitted for analysis on CrowdStrike Falcon Sandbox';
    return createTableEntry(title, response, response, context);
}

function submitFileByUrl(url, environmentID) {
    var cmdUrl = '/api/v2/submit/url-to-file';
    var body = 'url=' + url + '&environment_id=' + environmentID;
    HEADERS['Content-Type'] = ['application/x-www-form-urlencoded'];
    return sendRequest('POST', cmdUrl, body);
}

switch (command) {
    case 'test-module':
        args.query = 'url:google';
        var entry = searchQuery();
        if (entry && entry.Type === entryTypes.note) {
           return 'ok';
        }
        return entry && entry.Contents;
    case 'vx-scan': // Deprecated
    case 'crowdstrike-scan':
        var res = scan(args.file);
        if (Object.keys(res).length > 0){
            return scanToEntry(res, args.file);
        } else {
            return {
                Type: entryTypes.note,
                ContentsFormat: formats.json,
                Contents: {},
                ReadableContentsFormat: formats.markdown,
                HumanReadable: 'No results found.',
                EntryContext: {
                    "File(val.hash==obj.hash)": {
                    "state": "NO_CONTENT",
                    "hash": args.file
                    }
                }
            };
        }
    case 'vx-get-environments': // Deprecated
    case 'crowdstrike-get-environments':
        var response = getEnvironments();
        return tableFromEnvironments(response);
    case 'vx-submit-sample': // Deprecated
    case 'crowdstrike-submit-sample':
        var entry = submitFile(args.entryId, args.environmentID);
        // return entry if type is error
        if ('Type' in entry && entry['Type'] === entryTypes.error) {
            return entry;
        }
        return submitFileEntry(entry);
    case 'vx-search': // Deprecated
    case 'crowdstrike-search':
        return searchQuery();
    case 'vx-result': // Deprecated
    case 'crowdstrike-result':
        return csResultCmd(args.file, args.environmentId, args['file-type'], args.JobID);
    case 'vx-detonate-file': // Deprecated
    case 'crowdstrike-detonate-file':
        return detonateFile(args.entryId, args.delay, args.timeout);
    case 'crowdstrike-submit-url':
        return submitUrlCmd(args.url, args.environmentID, argToBool(args.dontThrowErrorOnFileDetonation));
    case 'crowdstrike-get-screenshots':
        return getScreenshotsCmd(args.file, args.environmentID, args.JobID);
    case 'file':
        return file(args.file);
    case 'crowdstrike-detonate-url':
        return detonateUrl(args.url, args.delay, args.timeout, args['file-type']);
    case 'crowdstrike-submit-file-by-url':
        return submitFileByUrlCommad(args.url, args.environmentID);
}