ForescoutEyeInspect
Delivers flexible and scalable OT/ICS asset visibility.
Network Security · Forescout EyeInspect
Details
| ID | ForescoutEyeInspect |
|---|---|
| Provider | Advent International |
| Category | Network Security |
| From Version | 6.0.1 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM |
README
Forescout EyeInspect
Delivers flexible and scalable OT/ICS asset visibility.
This integration was integrated and tested with version 4.2.20 of Forescout EyeInspect.
Configure Forescout EyeInspect in Cortex
| Parameter | Description | Required |
|---|---|---|
| Server URL | True | |
| Username | True | |
| Password | True | |
| Trust any certificate (not secure) | False | |
| Use system proxy settings | False | |
| Maximum incidents per fetch | Default is 50. Maximum is 200. | False |
| First fetch timestamp (<number> <time unit>, like 12 hours, 7 days) | False | |
| Incident type | False | |
| Fetch incidents | False |
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.
forescout-ei-host-list
Retrieves information about the hosts in the eyeInspect CC database.
Base Command
forescout-ei-host-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
| last_seen | List only records with the last seen timestamp greater than or equal to the provided parameter. | Optional |
| id_min | Retrieve hosts that are equal to or greater than the specified ID. | Optional |
| ip | A comma-separated list of IP addresses. The command will filter the results from the returned page according to the provided values. | Optional |
| vlan_id | A comma-separated list of VLAN IDs. The command will filter the results from the returned page according to the provided values. | Optional |
| mac_address | A comma-separated list of MAC addresses. The command will filter the results from the returned page according to the provided values. | Optional |
| sensor_id | A comma-separated list of sensor IDs. The command will filter the results from the returned page according to the provided values. | Optional |
| sort_field | List records and sort them based on the specified field, as well as on the ID. Also, the command will filter the results from the returned page. Possible values are: ip_reuse_domain_id, ip_reuse_domain, address, ip, vlan, nested_address, mac_addresses, sorted_mac_addresses, real_mac_addresses, sorted_real_mac_addresses, observed_mac_addresses, sorted_observed_mac_addresses, mac_vendors, vendor_with_real_macs, vendor_with_observed_macs, sensor_ids, is_broadcast_ip, is_multicast_ip, is_public_ip, is_learnt_host, name, all_names, description, role, all_roles, vendor_model, all_vendors_models, os_version, client_proto_port_info, server_proto_port_info, first_seen, last_seen, labels, sorted_labels, purdue_level, criticality, firmware_version, hardware_version, serial_number, project, ip_type, monitored_networks, open_ports, complex_cves, sorted_client_protocols, sorted_server_protocols, module_count, sorted_module_details, security_risk, operational_risk, alert_count. | Optional |
| sort_ascending | Indicates whether the result list should be sorted in ascending or descending order. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.Host.id | Number | The unique ID of the host in the eyeInspect CC. |
| ForescoutEyeInspect.Host.ip_reuse_domain_id | Number | The unique ID of the IP Reuse Domain the host is in. |
| ForescoutEyeInspect.Host.ip | String | The IP address of the host. |
| ForescoutEyeInspect.Host.nested_address | String | In case of a nested device host, the nested address of the host. |
| ForescoutEyeInspect.Host.vlan | String | The VLAN ID of the host. |
| ForescoutEyeInspect.Host.mac_addresses | String | The MAC addresses associated to the host. |
| ForescoutEyeInspect.Host.sensor_ids | String | The unique IDs of the sensors that have “seen” this host. |
| ForescoutEyeInspect.Host.main_name | String | The main name of the host. |
| ForescoutEyeInspect.Host.description | String | Description of the host. |
| ForescoutEyeInspect.Host.os_version | String | The operating system version of the host. |
| ForescoutEyeInspect.Host.first_seen | String | The ISO-formatted timestamp of when the host was first seen. |
| ForescoutEyeInspect.Host.last_seen | String | The ISO-formatted timestamp of when the host was last seen. |
| ForescoutEyeInspect.Host.open_ports | String | The open TCP and UDP ports of the host. |
Command example
!forescout-ei-host-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"Host": {
"first_seen": "2022-03-18T00:58:27.000+01:00",
"host_mac_addresses": [],
"id": 34558,
"ip": "20.190.159.71",
"ip_reuse_domain_id": 1,
"last_seen": "2022-03-18T00:58:27.000+01:00",
"mac_addresses": [
"C4:24:56:A4:86:11"
],
"nested_address": "",
"sensor_ids": [
9
],
"vlan": ""
}
}
}
Human Readable Output
Hosts List
Current page size: 1
Showing page 1 out of others that may exist.
ID IP MAC Addresses 34558 20.190.159.71 C4:24:56:A4:86:11
forescout-ei-link-list
Retrieves information about the links in the eyeInspect CC database.
Base Command
forescout-ei-link-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
| src_host_id | List only records with the src_host_id property set to the specified value. | Optional |
| dst_host_id | List only records with the dst_host_id property set to the specified value. | Optional |
| proto | List only records with the proto field containing the specified value. | Optional |
| port | List only records with one of the values of the port property equal to the specified parameter. | Optional |
| last_seen | List only records with the last_seen timestamp greater than or equal to the provided parameter. | Optional |
| id_min | Retrieve links that are greater than or equal to the specified ID. | Optional |
| sort_field | List records and sort them based on the specified field, as well as on the ID. Possible values are: src_host_id, dst_host_id, proto, ports, tx_bytes, rx_bytes, first_seen, last_seen. | Optional |
| sort_ascending | Indicates whether the result list should be sorted in ascending or descending order. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.Link.id | Number | The unique ID of the link in the eyeInspect CC. |
| ForescoutEyeInspect.Link.src_host_id | Number | The unique ID of the source host in the eyeInspect CC. |
| ForescoutEyeInspect.Link.dst_host_id | Number | The unique ID of the destination host in the eyeInspect CC. |
| ForescoutEyeInspect.Link.proto | String | The name of the protocol (application layer (L7) and transport or datalink layer (L4 or L3/L2) detected for the link. |
| ForescoutEyeInspect.Link.tx_bytes | Number | The total number of bytes sent upstream (i. |
| ForescoutEyeInspect.Link.rx_bytes | Number | The total number of bytes sent downstream (i. |
| ForescoutEyeInspect.Link.first_seen | String | Timestamp in ISO format of when the link was first seen. |
| ForescoutEyeInspect.Link.last_seen | String | Timestamp in ISO format of when the link was last seen. |
| ForescoutEyeInspect.Link.ports | String | TCP or UDP ports used in the link. |
Command example
!forescout-ei-link-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"Link": {
"dst_host_id": 34555,
"first_seen": "2022-03-18T10:28:47.000+01:00",
"id": 203725,
"last_seen": "2022-03-18T10:28:56.000+01:00",
"proto": "FailedConnection (TCP)",
"src_host_id": 8
}
}
}
Human Readable Output
Host Links List
Current page size: 1
Showing page 1 out of others that may exist.
ID Source Host ID Destination Host ID Protocol 203725 8 34555 FailedConnection (TCP)
forescout-ei-vulnerability-info-get
Retrieves information about a specific vulnerability stored in the eyeInspect CC database.
Base Command
forescout-ei-vulnerability-info-get
Input
| Argument Name | Description | Required |
|---|---|---|
| cve_id | The unique ID of the vulnerability information record to be retrieved. The CVE ID can be retrieved from public vulnerability databases, such as NVD, or from the “CVEs and IoCs” page inside Forescout EyeInspect. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.CVE.id | String | The vulnerability ID. |
| ForescoutEyeInspect.CVE.cve_id | String | The CVE ID from the NVD. |
| ForescoutEyeInspect.CVE.icsa_id | String | The ICS Cert Security Advisory ID related to the vulnerability. |
| ForescoutEyeInspect.CVE.vendor_specific_id | String | The vendor-specific advisory ID related to the vulnerability. |
| ForescoutEyeInspect.CVE.published_date | String | The timestamp in ISO format when the vulnerability information was published. |
| ForescoutEyeInspect.CVE.last_modified_date | String | The timestamp in ISO format when the vulnerability information was last modified. |
| ForescoutEyeInspect.CVE.cvss_score | Number | The CVSS score of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_temporal_score | Number | The CVSS temporal score of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_access_vector | String | The CVSS access vector scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_access_complexity | String | The CVSS access complexity scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_authentication | String | The CVSS authentication scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_confidentiality_impact | String | The CVSS confidentiality impact scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_integrity_impact | String | The CVSS integrity impact scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_availability_impact | String | The CVSS availability impact scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_exploitability | String | The CVSS exploitability scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_remediation_level | String | The CVSS remediation level scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.cvss_reporting_confidence | String | The CVSS reporting confidence scoring of the vulnerability. |
| ForescoutEyeInspect.CVE.references | String | The list of references (URLs) related to the vulnerability. |
| ForescoutEyeInspect.CVE.vendor | String | The vendor of the product affected by the vulnerability. |
| ForescoutEyeInspect.CVE.title | String | A short summary of the vulnerability. |
| ForescoutEyeInspect.CVE.description | String | Description of the vulnerability (including list of vulnerable devices and versions). |
| ForescoutEyeInspect.CVE.solution | String | Description of the proposed vulnerability solution (including to what version to update the software/firmware). |
Command example
!forescout-ei-vulnerability-info-get cve_id=CVE-2019-20218
Context Example
{
"ForescoutEyeInspect": {
"CVE": {
"cve_id": "CVE-2019-20218",
"cvss_access_complexity": "LOW",
"cvss_access_vector": "NETWORK",
"cvss_authentication": "NONE",
"cvss_availability_impact": "PARTIAL",
"cvss_confidentiality_impact": "NONE",
"cvss_exploitability": "UNDEFINED",
"cvss_integrity_impact": "NONE",
"cvss_remediation_level": "UNAVAILABLE",
"cvss_reporting_confidence": "CONFIRMED",
"cvss_score": 5,
"cvss_temporal_score": 0,
"cvss_version": "VERSION_2",
"icsa_id": "",
"id": "CVE-2019-20218",
"last_modified_date": "2020-04-14T02:00:00.000+02:00",
"published_date": "2018-11-27T01:00:00.000+01:00",
"references": [
{
"label": "Siemens CERT",
"url": "https://cert-portal.siemens.com/productcert/pdf/ssb-439005.pdf"
}
],
"solution": "Siemens is working on an update for the firmware, and recommends the following mitigations until an update is available:\n - Apply Defense-in-Depth: https://www.siemens.com/cert/operational-guidelines-industrial-security\n - Only build and run applications from trusted sources",
"summary": "selectExpander in select.c in SQLite 3.30.1 proceeds with WITH stack unwinding even after a parsing error.\n VULNERABLE PRODUCT\n - SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP (incl. SIPLUS variant): firmware version V2.6.1, and might also affect previous versions of the firmware",
"title": "Improper handling of exceptional conditions vulnerability in SQLite database in the SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP",
"vendor": "Siemens",
"vendor_specific_id": "SSB-439005"
}
}
}
Human Readable Output
CVE CVE-2019-20218 Information
ID Title Published Date Cvss Score CVE-2019-20218 Improper handling of exceptional conditions vulnerability in SQLite database in the SIMATIC S7-1500 CPU 1518(F)-4 PN/DP MFP 2018-11-27T01:00:00.000+01:00 5.0
forescout-ei-alert-list
Retrieves information about the alerts inside eyeInspect CC.
Base Command
forescout-ei-alert-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
| start_timestamp | List only records with the timestamp property greater than or equal to the specified value. For example, 2020-05-26T15:00:00.000Z+01:00. | Optional |
| end_timestamp | List only records with the timestamp property less than or equal to the specified value. For example, 2020-05-26T15:00:00.000Z+01:00. | Optional |
| event_type_id | List records that have the event_type_id property containing the specified parameter. | Optional |
| l4_proto | List records that have the l4_proto property equal to the specified parameter. Possible values are: TCP, UDP, ICMP, UNDEFINED. | Optional |
| l7_proto | List records that have the l7_proto property equal to the specified parameter. | Optional |
| src_ip | List records that have the src_ip property equal to the specified parameter, or contained in the given CIDR-defined network. | Optional |
| dst_ip | List records that have the dst_ip property equal to the specified parameter, or contained in the given CIDR-defined network. | Optional |
| ip | List records that have either the src_ip or the dst_ip property equal to the specified parameter, or contained in the given CIDR-defined network. | Optional |
| severity | A comma-separated list of severities. The command will filter the results from the returned page according to the provided values. | Optional |
| vlan_id | A comma-separated list of vLAN IDs. The command will filter the results from the returned page according to the provided values. | Optional |
| status | A comma-separated list of statuses. The command will filter the results from the returned page according to the provided values. Possible values are: Not analysed, In progress, Analyzed, False alert, Relevant, Not relevant, Unknown, Trimmed. | Optional |
| sensor_name | A comma-separated list of sensor names. The command will filter the results from the returned page according to the provided values. | Optional |
| dst_port | Fetch records that have the dst_port property equal to the specified parameter. | Optional |
| src_host_id | List records that have the src_ip or src_mac property equal to the IP address or MAC address of the host with ID equal to the specified parameter. | Optional |
| dst_host_id | List records that have the dst_ip or dst_mac property equal to the IP address or MAC address of the host with ID equal to the specified parameter. | Optional |
| host_id | List records that have either the src_ip, src_mac or dst_ip, dst_mac equal to the IP address or MAC address of the host with ID equal to the specified parameter. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.Alert.alert_id | Number | The ID of the alert in the eyeInspect database. |
| ForescoutEyeInspect.Alert.timestamp | String | Timestamp of the alert in ISO format. |
| ForescoutEyeInspect.Alert.event_type_ids | String | The list of unique IDs identifying the type of events reported in the alert. |
| ForescoutEyeInspect.Alert.event_type_names | String | The list of names of the type of events reported in the alert. |
| ForescoutEyeInspect.Alert.description | String | A description of the event types reported in the alert, as well as other details regarding the specific alert instance coming from the sensor. |
| ForescoutEyeInspect.Alert.notes | String | Notes that a eyeInspect user may have attached to the alert. |
| ForescoutEyeInspect.Alert.sensor_id | Number | The unique ID of the sensor firing the Alert. |
| ForescoutEyeInspect.Alert.sensor_name | String | The name of the sensor firing the alert. |
| ForescoutEyeInspect.Alert.engine | String | The detection engine that raised the Alert. |
| ForescoutEyeInspect.Alert.profile_module_name | String | The name of the profile or module that raised the Alert. |
| ForescoutEyeInspect.Alert.profile_id | Number | The unique ID of the profile that raised the alert. |
| ForescoutEyeInspect.Alert.l2_proto | String | The layer 2 (datalink) protocol. |
| ForescoutEyeInspect.Alert.l3_proto | String | The layer 3 (network) protocol. |
| ForescoutEyeInspect.Alert.l4_proto | String | The layer 4 (transport) protocol. |
| ForescoutEyeInspect.Alert.l7_proto | String | The layer 7 (application) protocol. |
| ForescoutEyeInspect.Alert.vlan | String | The VLAN ID used in the network communication reported in the alert. |
| ForescoutEyeInspect.Alert.src_mac | String | The MAC address of the host initiating the connection reported in the alert. |
| ForescoutEyeInspect.Alert.dst_mac | String | The MAC address of the host receiving the connection reported in the alert. |
| ForescoutEyeInspect.Alert.src_ip | String | The IP address of the host initiating the connection reported in the alert. |
| ForescoutEyeInspect.Alert.dst_ip | String | The IP address of the host receiving the connection reported in the alert. |
| ForescoutEyeInspect.Alert.src_port | Number | The source TCP or UDP port used in the connection reported in the alert. |
| ForescoutEyeInspect.Alert.dst_port | Number | The destination TCP or UDP port used in the connection reported in the alert. |
| ForescoutEyeInspect.Alert.severity | Number | The severity level of the alert. |
| ForescoutEyeInspect.Alert.status | String | The status of the alert. |
Command example
!forescout-ei-alert-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"Alert": {
"alert_id": 1,
"case_id": 0,
"case_name": "",
"description": "TCP portscan: the attacker sends multiple out-of-state ACK packets to scan the victim's hosts and determine the open ports. This might be intelligence gathering or (the first phase of) an attack (e.g., DoS, exploit)\n\nFailed connections:\n - (scanner) 213.8.143.143 \n - 192.168.92.12 \n * 54009 ( 1 failed connection(s) [ ACK: 1 ] )\n * 54010 ( 1 failed connection(s) [ ACK: 1 ] )\n * 54011 ( 1 failed connection(s) [ ACK: 1 ] )\n * 54013 ( 1 failed connection(s) [ ACK: 1 ] )\n * 54017 ( 1 failed connection(s) [ ACK: 1 ] )\n",
"direction_certain": false,
"dst_ip": "192.168.92.12",
"dst_mac": "",
"dst_port": 0,
"engine": "PORTSCAN",
"event_type_ids": [
"ps_tcp_ack"
],
"event_type_names": [
"TCP ACK portscan"
],
"fea_alert_count": 0,
"fea_duration_sec": 0,
"fea_start": "1970-01-01T01:00:00.000+01:00",
"fea_state": "None",
"hotstart": false,
"l2_proto": "ETHERNET",
"l3_proto": "IP",
"l4_proto": "TCP",
"l7_proto": "UNDEFINED",
"labels": "",
"link": "https://192.168.30.115/evt?id=1",
"normalized": false,
"notes": "",
"profile_id": 0,
"profile_module_name": "Portscan",
"sensor_id": 9,
"sensor_name": "Test1",
"severity": 2,
"src_ip": "213.8.143.143",
"src_mac": "",
"src_port": 0,
"status": "Not analyzed",
"timestamp": "2022-02-03T07:49:50.092+01:00",
"vlan": "",
"xsoar_severity": 1
}
}
}
Human Readable Output
Alerts List
Current page size: 1
Showing page 1 out of others that may exist.
Alert ID Description Timestamp Source IP Destination IP 1 TCP portscan: the attacker sends multiple out-of-state ACK packets to scan the victim’s hosts and determine the open ports. This might be intelligence gathering or (the first phase of) an attack (e.g., DoS, exploit)
Failed connections:
- (scanner) 213.8.143.143
- 192.168.92.12
54009 ( 1 failed connection(s) [ ACK: 1 ] )
54010 ( 1 failed connection(s) [ ACK: 1 ] )
54011 ( 1 failed connection(s) [ ACK: 1 ] )
54013 ( 1 failed connection(s) [ ACK: 1 ] )
* 54017 ( 1 failed connection(s) [ ACK: 1 ] )2022-02-03T07:49:50.092+01:00 213.8.143.143 192.168.92.12
forescout-ei-alert-pcap-get
Retrieves the PCAP file associated to a given alert.
Base Command
forescout-ei-alert-pcap-get
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_id | The unique ID of the alert to get the PCAP of. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| InfoFile.Size | Number | The size of the file. |
| InfoFile.Name | String | The name of the file. |
| InfoFile.EntryID | String | The entry ID of the file. |
| InfoFile.Info | String | File information. |
| InfoFile.Type | String | The file type. |
| InfoFile.Extension | String | The file extension. |
Command example
!forescout-ei-alert-pcap-get alert_id=1
Context Example
{
"InfoFile": {
"EntryID": "3111@8479e914-8493-4968-8f32-78852375d17b",
"Extension": "pcap",
"Info": "application/vnd.tcpdump.pcap",
"Name": "alert_1_sniff.pcap",
"Size": 424,
"Type": "tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 65535)"
}
}
Human Readable Output
forescout-ei-sensor-list
Retrieves information about the sensors associated to the eyeInspect CC.
Base Command
forescout-ei-sensor-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
| all_sensors | Whether to retrieve all the sensors (ICS Patrol and passive) or only the passive ones. Possible values are: true, false. | Optional |
| name | A comma-separated list of sensor names. The command will filter the results from the returned page according to the provided values. | Optional |
| address | A comma-separated list of IP addresses or domain names. The command will filter the results from the returned page according to the provided values. | Optional |
| port | A comma-separated list of listening ports. The command will filter the results from the returned page according to the provided values. | Optional |
| type | A comma-separated list of sensor types. The command will filter the results according to the provided values. Possible values are: PASSIVE, PATROL. | Optional |
| state | A comma-separated list of sensor states. The command will filter the results from the returned page according to the provided values. Possible values are: OPERATIVE_ON, OPERATIVE_OFF, DISCONNECTED, LICENSE_EXPIRED, LICENSE_INVALID, UNKNOWN. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.Sensor.id | Number | Unique ID of the sensor in the eyeInspect CC. |
| ForescoutEyeInspect.Sensor.name | String | Name of the sensor. |
| ForescoutEyeInspect.Sensor.address | String | IP address or domain name of the sensor’s management interface. |
| ForescoutEyeInspect.Sensor.port | Number | TCP port number on which the sensor is listening for incoming CC connections. |
| ForescoutEyeInspect.Sensor.type | String | Type of the sensor (PASSIVE / PATROL). |
| ForescoutEyeInspect.Sensor.sensor_version | String | Version of the eyeInspect sensor software. |
| ForescoutEyeInspect.Sensor.state | String | Current status of the sensor. |
| ForescoutEyeInspect.Sensor.health_status | String | Current health status of the sensor. |
Command example
!forescout-ei-sensor-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"Sensor": {
"address": "127.0.0.1",
"health_status": {
"cpu_load_avg_1_min": {
"current_value": "8.5%",
"level": "NORMAL",
"name": ""
},
"disk_usage": [
{
"current_value": "8%",
"level": "NORMAL",
"name": "/"
}
],
"dropped_packets": {
"current_value": "0%",
"level": "NORMAL",
"name": ""
},
"license_status": {
"current_value": "VALID",
"level": "NORMAL",
"name": ""
},
"memory_usage": {
"current_value": "84.62%",
"level": "WARNING",
"name": ""
},
"net_if_status": [
{
"current_value": "Running",
"level": "NORMAL",
"name": "br-1b1f2d7e6a87"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "ens160"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "ens192"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "veth24fab08"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "vethf0fd758"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "vethfb6c608"
}
],
"services": [],
"throughput": {
"current_value": "0.0 bps",
"level": "CRITICAL",
"name": ""
}
},
"id": 2,
"name": "sensor1",
"port": 9999,
"sensor_version": "4.3.21",
"state": "OPERATIVE_ON",
"type": "PASSIVE"
}
}
}
Human Readable Output
Sensors List
Current page size: 1
Showing page 1 out of others that may exist.
ID Name Address Port Type 2 sensor1 127.0.0.1 9999 PASSIVE
forescout-ei-sensor-module-list
Retrieves information about the modules of the specified sensor.
Base Command
forescout-ei-sensor-module-list
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor to query for modules. | Required |
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.SensorModule.id | Number | Unique ID of the module in the eyeInspect CC. |
| ForescoutEyeInspect.SensorModule.sensor_id | Number | Unique ID of the sensor the module is deployed in, in the eyeInspect CC. |
| ForescoutEyeInspect.SensorModule.engine | String | Name of the engine powering the module in the sensor. |
| ForescoutEyeInspect.SensorModule.singleton | Boolean | Whether the module can only have one single instance or can have multiple instances in the sensor. |
| ForescoutEyeInspect.SensorModule.name | String | The name of the module. |
| ForescoutEyeInspect.SensorModule.description | String | The description of the module. |
| ForescoutEyeInspect.SensorModule.started | Boolean | Whether the module is started or paused in the sensor. |
| ForescoutEyeInspect.SensorModule.operational_mode | String | Operational mode of the module in the sensor. |
| ForescoutEyeInspect.SensorModule.date_last_update | String | Timestamp in ISO format of when the module was last updated. |
Command example
!forescout-ei-sensor-module-list sensor_id=2 page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"SensorModule": {
"date_last_update": "2022-03-18T11:13:09.898+01:00",
"description": "",
"engine": "THREAT_LIBRARY",
"id": 1,
"name": "Industrial threat library (ITL)",
"operational_mode": "",
"sensor_id": 2,
"singleton": true,
"started": true
}
}
}
Human Readable Output
Sensor 2 Modules List
Current page size: 1
Showing page 1 out of others that may exist.
ID Name Engine Started 1 Industrial threat library (ITL) THREAT_LIBRARY true
forescout-ei-sensor-module-update
Changes the specified properties of the specified module.
Base Command
forescout-ei-sensor-module-update
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor that has the module to update. | Required |
| module_id | The unique ID of the module to update. | Required |
| name | Name of the module. | Optional |
| description | Description of the module. | Optional |
| started | If set to true, the module will be started. If set to false, the module will be paused. Possible values are: true, false. | Optional |
| operational_mode | Changes the operational mode of the module to the specified value. Possible values are: Learning, Detecting. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.SensorModule.id | Number | Unique ID of the module in the eyeInspect CC. |
| ForescoutEyeInspect.SensorModule.sensor_id | Number | Unique ID of the sensor the module is deployed in, in the eyeInspect CC. |
| ForescoutEyeInspect.SensorModule.engine | String | Name of the engine powering the module in the sensor. |
| ForescoutEyeInspect.SensorModule.singleton | Boolean | Whether the module can only have one single instance or can have multiple instances in the sensor. |
| ForescoutEyeInspect.SensorModule.name | String | The name of the module. |
| ForescoutEyeInspect.SensorModule.description | String | The description of the module. |
| ForescoutEyeInspect.SensorModule.started | Boolean | Whether the module is started or paused in the sensor. |
| ForescoutEyeInspect.SensorModule.operational_mode | String | Operational mode of the module in the sensor. |
| ForescoutEyeInspect.SensorModule.date_last_update | String | Timestamp in ISO format of when the module was last updated. |
Command example
!forescout-ei-sensor-module-update sensor_id=2 module_id=5 started=true
Context Example
{
"ForescoutEyeInspect": {
"SensorModule": {
"date_last_update": "1970-01-01T01:00:00.000+01:00",
"description": "",
"engine": "PORTSCAN",
"id": 5,
"name": "Portscan",
"operational_mode": "",
"sensor_id": 2,
"singleton": true,
"started": true
}
}
}
Human Readable Output
Updated Module 5 of Sensor 2
Name Engine Started Portscan PORTSCAN true
forescout-ei-sensor-module-delete
Deletes the specified module from the specified sensor and from the eyeInspect CC database.
Base Command
forescout-ei-sensor-module-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor of the module to delete. | Required |
| module_id | The unique ID of the module to delete. | Required |
Context Output
There is no context output for this command.
Command example
!forescout-ei-sensor-module-delete sensor_id=2 module_id=8
Human Readable Output
The module 8 of sensor 2 was successfully deleted
forescout-ei-ip-blacklist-get
Retrieves the IP blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-ip-blacklist-get
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor for which to retrieve the IP blacklist. | Required |
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.IPBlacklist.address | String | A blacklisted IP address. |
| ForescoutEyeInspect.IPBlacklist.comment | String | A comment provided by the user. The comment might be empty. |
Command example
!forescout-ei-ip-blacklist-get sensor_id=2 page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"IPBlacklist": {
"address": "1.1.1.5",
"comment": "demo test",
"sensor_id": 2
}
}
}
Human Readable Output
IP Blacklist of Sensor 2
Current page size: 1
Showing page 1 out of others that may exist.
Address Comment 1.1.1.5 demo test
forescout-ei-ip-blacklist-add
Adds a new entry to the IP blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-ip-blacklist-add
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor for which to update the IP blacklist. | Required |
| address | The IP address to add to the blacklist. | Required |
| comment | A comment about the blacklisted IP address. | Optional |
Context Output
There is no context output for this command.
Command example
!forescout-ei-ip-blacklist-add sensor_id=2 address=3.4.5.6 comment=Malicious
Human Readable Output
New IP Blacklist Entry of Sensor 2
Address Comment 3.4.5.6 Malicious forescout-ei-domain-blacklist-get
Retrieves the domain name blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-domain-blacklist-get
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor that contains the domain blacklist. | Required |
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.DomainBlacklist.domain_name | String | A blacklisted domain name. |
| ForescoutEyeInspect.DomainBlacklist.comment | String | A comment provided by the user. The comment might be empty. |
Command example
!forescout-ei-domain-blacklist-get sensor_id=2 page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"DomainBlacklist": {
"comment": "demo command",
"domain_name": "028xmz.com",
"sensor_id": 2
}
}
}
Human Readable Output
Domain Blacklist of Sensor 2
Current page size: 1
Showing page 1 out of others that may exist.
Domain Name Comment 028xmz.com demo command
forescout-ei-domain-blacklist-add
Adds a new entry to the domain name blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-domain-blacklist-add
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor of which the domain to be updated. | Required |
| domain_name | The domain name to add to the blacklist. | Required |
| comment | A comment about the domain name. Default is Command and Control server. | Optional |
Context Output
There is no context output for this command.
Command example
!forescout-ei-domain-blacklist-add sensor_id=2 domain_name=malicious.xyz comment=Maleware
Human Readable Output
New Domain Blacklist Entry of Sensor 2
Domain Name Comment malicious.xyz Maleware forescout-ei-ssl-client-blacklist-get
Retrieves the SSL client application blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-ssl-client-blacklist-get
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor for which to retrieve the SSL client blacklist. | Required |
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.SSLClientBlacklist.sensor_id | Number | The unique ID of the sensor for which to retrieve the SSL client. |
| ForescoutEyeInspect.SSLClientBlacklist.application_name | String | The application name related to the entry. |
| ForescoutEyeInspect.SSLClientBlacklist.ja3_hash | String | The JA3 hash of a blacklisted client application. |
| ForescoutEyeInspect.SSLClientBlacklist.comment | String | A comment provided by the user. The comment might be empty. |
Command example
!forescout-ei-ssl-client-blacklist-get sensor_id=2 page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"SSLClientBlacklist": {
"application_name": "Potential malware: eitest-hoeflertext-chrome-popup-traffic-4-of-6",
"comment": "Generated from all PCAPs on https://www.malware-traffic-analysis.net",
"ja3_hash": "098f55e27d8c4b0a590102cbdb3a5f3a",
"sensor_id": 2
}
}
}
Human Readable Output
SSL Client Applications Blacklist of Sensor 2
Current page size: 1
Showing page 1 out of others that may exist.
Application Name Ja3 Hash Comment Potential malware: eitest-hoeflertext-chrome-popup-traffic-4-of-6 098f55e27d8c4b0a590102cbdb3a5f3a Generated from all PCAPs on https://www.malware-traffic-analysis.net
forescout-ei-ssl-client-blacklist-add
Adds a new entry to the SSL client application blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-ssl-client-blacklist-add
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor of which the SSL client. | Required |
| application_name | The related application name to add to the blacklist. | Required |
| ja3_hash | The JA3 hash of a blacklisted client application. | Required |
| comment | Comment about the SSL client application. | Optional |
Context Output
There is no context output for this command.
Command example
!forescout-ei-ssl-client-blacklist-add sensor_id=2 application_name=Shodan ja3_hash=0ad94fcb7d3a2c56679fbd004f6b12cd comment=Malicious
Human Readable Output
New SSL Client Blacklist Entry of Sensor 2
Application Name Ja3 Hash Comment Shodan 0ad94fcb7d3a2c56679fbd004f6b12cd Malicious forescout-ei-file-operation-blacklist-get
Retrieves the file operation blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-file-operation-blacklist-get
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor for which to retrieve the file operation blacklist. | Required |
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.FileOperationBlacklist.matching_type | String | The way file or folder should be matched. |
| ForescoutEyeInspect.FileOperationBlacklist.file_or_folder | String | The name of the file or folder the entry applies to. |
| ForescoutEyeInspect.FileOperationBlacklist.operation | String | The name of the file operation. |
| ForescoutEyeInspect.FileOperationBlacklist.comment | String | A comment provided by the user. The comment might be empty. |
Command example
!forescout-ei-file-operation-blacklist-get sensor_id=2 page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"FileOperationBlacklist": {
"comment": "Access 2007 Database File. A database file created with Microsoft Access 2007 or later. It typically contains data organized into tables and fields. (default blacklist entry).",
"file_or_folder": "\\.accdb$",
"matching_type": "REGEX",
"operation": "WRITE",
"sensor_id": 2
}
}
}
Human Readable Output
File Operation Blacklist of Sensor 2
Current page size: 1
Showing page 1 out of others that may exist.
Matching Type File Or Folder Operation Comment REGEX .accdb$ WRITE Access 2007 Database File. A database file created with Microsoft Access 2007 or later. It typically contains data organized into tables and fields. (default blacklist entry).
forescout-ei-file-operation-blacklist-add
Adds entries to the file operation blacklist from the Industrial Threat Library of the specified sensor.
Base Command
forescout-ei-file-operation-blacklist-add
Input
| Argument Name | Description | Required |
|---|---|---|
| sensor_id | The unique ID of the sensor for which to update the file operation blacklist. | Required |
| matching_type | The way file or folder should be matched. Possible values are: CONTAINS, STARTS_WITH, ENDS_WITH, MATCHES, REGEX. | Required |
| file_or_folder | The name of the file or folder the entry applies to. | Required |
| operation | The name of the file operation. Possible values are: WRITE, READWRITE. | Required |
| comment | A comment provided by the user. | Optional |
Context Output
There is no context output for this command.
Command example
!forescout-ei-file-operation-blacklist-add sensor_id=2 matching_type=REGEX file_or_folder=\\.mal$ operation=WRITE comment=Virus
Human Readable Output
New File Operation Blacklist Entry of Sensor 2
Matching Type File Or Folder Operation Comment REGEX .mal$ WRITE Virus forescout-ei-diagnostics-information-get
Retrieves information about all monitored Command Center resources and their health status excluding the logs.
Base Command
forescout-ei-diagnostics-information-get
Input
| Argument Name | Description | Required |
| — | — | — |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.CCInfo.ip_address | String | IP address of the Command Center. |
| ForescoutEyeInspect.CCInfo.hostname | String | Hostname of the Command Center. |
| ForescoutEyeInspect.CCInfo.open_ports | String | TCP open port number of the Command Center. |
| ForescoutEyeInspect.CCInfo.cc_version | String | Version of the Command Center software. |
| ForescoutEyeInspect.CCInfo.health_status | String | Current health status of the Command Center. |
Command example
#### Context Example
```json
{
"ForescoutEyeInspect": {
"CCInfo": {
"cc_version": "4.3.21",
"health_status": {
"analytics_db_used_mem": {
"current_value": "4.3 GiB",
"name": ""
},
"cpu_load_avg_1_min": {
"current_value": "5.5%",
"level": "NORMAL",
"name": ""
},
"disk_usage": [
{
"current_value": "8%",
"level": "NORMAL",
"name": "/"
}
],
"memory_usage": {
"current_value": "84.56%",
"level": "WARNING",
"name": ""
},
"message_queue_used_mem": {
"current_value": "602.4 MiB",
"name": ""
},
"net_if_status": [
{
"current_value": "Running",
"level": "NORMAL",
"name": "ens160"
},
{
"current_value": "Not running",
"level": "NORMAL",
"name": "docker0"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "br-1b1f2d7e6a87"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "ens192"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "vethf0fd758"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "veth24fab08"
},
{
"current_value": "Running",
"level": "NORMAL",
"name": "vethfb6c608"
}
],
"relational_db_used_mem": {
"current_value": "3.4 GiB",
"name": "silentdefense"
},
"web_server_used_mem": {
"current_value": "4.4 GiB",
"name": ""
}
},
"hostname": "4321-bundle-16g",
"ip_address": "192.168.30.115",
"open_ports": [
"443"
]
}
}
}
Human Readable Output
Command Center Diagnostics Information
IP Address Hostname Open Ports Cc Version 192.168.30.115 4321-bundle-16g 443 4.3.21
forescout-ei-diagnostic-logs-get
Download the ZIP file which contains diagnostic logs of the Command Center.
Base Command
forescout-ei-diagnostic-logs-get
Input
| Argument Name | Description | Required |
|---|---|---|
| cc_info | Whether to include Command Center diagnostic logs inside the downloaded zip, in addition to sensors logs. If this value is false, the downloaded zip won’t contain the general server logs, but only the logs about the sensors. Possible values are: true, false. Default is True. | Optional |
| sensor_id | Include logs from a specific sensor by its ID, or all sensors (by specifying All). | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| InfoFile.Size | Number | The size of the file. |
| InfoFile.Name | String | The name of the file. |
| InfoFile.EntryID | String | The entry ID of the file. |
| InfoFile.Info | String | File information. |
| InfoFile.Type | String | The file type. |
| InfoFile.Extension | String | The file extension. |
Command example
!forescout-ei-diagnostic-logs-get sensor_id=2
Context Example
{
"InfoFile": {
"EntryID": "3167@8479e914-8493-4968-8f32-78852375d17b",
"Extension": "zip",
"Info": "application/zip",
"Name": "command_center_diagnostic_logs.zip",
"Size": 26280500,
"Type": "Zip archive data, at least v2.0 to extract"
}
}
Human Readable Output
forescout-ei-group-policy-list
Get all group policies.
Base Command
forescout-ei-group-policy-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.GroupPolicy.id | Number | The ID of the policy. |
| ForescoutEyeInspect.GroupPolicy.name | String | The name of the group policy. |
| ForescoutEyeInspect.GroupPolicy.description | String | The description of the group policy. |
| ForescoutEyeInspect.GroupPolicy.constraints | Unknown | List of constraints of the policy. |
Command example
!forescout-ei-group-policy-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"GroupPolicy": {
"constraints": [
{
"operator": "equals",
"os_version": "Windows 10",
"type": "os_version"
}
],
"description": "Test",
"id": 8,
"name": "Test Playbook Policy"
}
}
}
Human Readable Output
Group Policies List
Current page size: 1
Showing page 1 out of others that may exist.
ID Name Description 8 Test Playbook Policy Test
forescout-ei-group-policy-create
Create a new group policy.
Base Command
forescout-ei-group-policy-create
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name of the group policy. | Required |
| description | The description of the group policy. | Required |
| constraints | List of constraints of the policy. Each policy constraint is an object that includes the following fields: type: The type of the constraint. Possible values are os_version, firmware_version, open_ports. operator: The operator of the constraint. Possible values are equals (all types), allowed (open_ports) and contains (os_version, firmware_version). os_version: The value of the OS version for the os_version type. firmware_version: The value of the firmware version for the firmware_version type. open_ports_tcp: Comma-separated list of ports or range of ports for the open_ports type. Example: “10, 20-30”. open_ports_udp: Comma-separated list of ports or range of ports for the open_ports type. Example: “10, 20-30”. Example for list of policy constraints: [{ “type”: “os_version”, “operator”: “contains”, “os_version”: “Windows” }]. . |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.GroupPolicy.id | Number | The ID of the policy. |
| ForescoutEyeInspect.GroupPolicy.name | String | The name of the group policy. |
| ForescoutEyeInspect.GroupPolicy.description | String | The description of the group policy. |
| ForescoutEyeInspect.GroupPolicy.constraints | Unknown | List of constraints of the policy. |
Command example
!forescout-ei-group-policy-create name="example policy" description="policy" constraints="[{\"type\": \"os_version\", \"operator\": \"equals\", \"os_version\": \"Windows 10\"}]"
Context Example
{
"ForescoutEyeInspect": {
"GroupPolicy": {
"constraints": [
{
"operator": "equals",
"os_version": "Windows 10",
"type": "os_version"
}
],
"description": "policy",
"id": 20,
"name": "example policy"
}
}
}
Human Readable Output
Group Policy Information
ID Name Description 20 example policy policy Group Policy Constraints
Type Operator Os Version os_version equals Windows 10
forescout-ei-group-policy-update
Update a group policy. Note: the whole policy will be overridden, therefore all fields are required.
Base Command
forescout-ei-group-policy-update
Input
| Argument Name | Description | Required |
|---|---|---|
| policy_id | The unique ID of the policy to be updated. | Required |
| name | The name of the group policy. | Required |
| description | The description of the group policy. | Required |
| constraints | List of constraints of the policy. Each policy constraint is an object that includes the following fields: type: The type of the constraint. Possible values are os_version, firmware_version, open_ports. operator: The operator of the constraint. Possible values are equals (all types), allowed (open_ports) and contains (os_version, firmware_version). os_version: The value of the OS version for the os_version type. firmware_version: The value of the firmware version for the firmware_version type. open_ports_tcp: Comma-separated list of ports or range of ports for the open_ports type. Example: “10, 20-30”. open_ports_udp: Comma-separated list of ports or range of ports for the open_ports type. Example: “10, 20-30”. Example for list of policy constraints: [{ “type”: “os_version”, “operator”: “contains”, “os_version”: “Windows” }]. |
Required |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.GroupPolicy.id | Number | The ID of the policy. |
| ForescoutEyeInspect.GroupPolicy.name | String | The name of the group policy. |
| ForescoutEyeInspect.GroupPolicy.description | String | The description of the group policy. |
| ForescoutEyeInspect.GroupPolicy.constraints | Unknown | List of constraints of the policy. |
Command example
!forescout-ei-group-policy-update policy_id=20 name="example policy" description="policy" constraints="[{\"type\": \"os_version\", \"operator\": \"equals\", \"os_version\": \"Windows 10\"}]"
Context Example
{
"ForescoutEyeInspect": {
"GroupPolicy": {
"constraints": [
{
"operator": "equals",
"os_version": "Windows 10",
"type": "os_version"
}
],
"description": "policy",
"id": 20,
"name": "example policy"
}
}
}
Human Readable Output
Updated Group Policy
ID Name Description 20 example policy policy Group Policy Constraints
Type Operator Os Version os_version equals Windows 10
forescout-ei-group-policy-delete
Delete a group policy.
Base Command
forescout-ei-group-policy-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| policy_id | The unique ID of the policy for which the hosts will be added to. | Required |
Context Output
There is no context output for this command.
Command example
!forescout-ei-group-policy-delete policy_id=20
Human Readable Output
The group policy 20 was successfully deleted
forescout-ei-group-policy-hosts-assign
Add all hosts not assigned to any policy (individual or group) matching the filter to the group policy.
Base Command
forescout-ei-group-policy-hosts-assign
Input
| Argument Name | Description | Required |
|---|---|---|
| policy_id | The unique ID of the policy for which the hosts will be added to. | Required |
| filter_type | The type of the filter. Possible values are: address, host_mac_address_exact, vendor_model, os_version, firmware_version, ip_reuse_domain. | Required |
| filter_value | The value of the filter. | Required |
Context Output
There is no context output for this command.
Command example
!forescout-ei-group-policy-hosts-assign policy_id=20 filter_type=address filter_value=192.168.1.1
Human Readable Output
1 Additional Hosts Were Assigned to Group Policy 20
forescout-ei-group-policy-hosts-unassign
Unassign all hosts assigned to the group policy matching the filter.
Base Command
forescout-ei-group-policy-hosts-unassign
Input
| Argument Name | Description | Required |
|---|---|---|
| policy_id | The unique ID of the policy for which the hosts will be removed. | Required |
| filter_type | The type of the filter. Possible values are: address, host_mac_address_exact, vendor_model, os_version, firmware_version, ip_reuse_domain. | Required |
| filter_value | The value of the filter. | Required |
Context Output
There is no context output for this command.
Command example
!forescout-ei-group-policy-hosts-unassign policy_id=20 filter_type=address filter_value=192.168.1.1
Human Readable Output
1 Additional Hosts Were Unassigned from Group Policy 20
forescout-ei-ip-reuse-domain-list
Get all IP reuse domains.
Base Command
forescout-ei-ip-reuse-domain-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.IPReuseDomain.id | Number | The ID of the IP reuse domain. |
| ForescoutEyeInspect.IPReuseDomain.name | String | The name of the IP reuse domain. |
| ForescoutEyeInspect.IPReuseDomain.description | String | The description of the IP reuse domain. |
| ForescoutEyeInspect.IPReuseDomain.address | String | The address of the IP reuse domain. |
| ForescoutEyeInspect.IPReuseDomain.mask | Number | The number of bits in the mask. |
| ForescoutEyeInspect.IPReuseDomain.vlan_ids | String | VLAN IDs of the IP reuse domain. |
Command example
!forescout-ei-ip-reuse-domain-list page=2 limit=1
Context Example
{
"ForescoutEyeInspect": {
"IPReuseDomain": {
"address": "192.168.99.0",
"description": "Servers IP Reuse",
"id": 2,
"mask": 0,
"name": "servers",
"vlan_ids": "any"
}
}
}
Human Readable Output
IP Reuse Domains List
Current page size: 1
Showing page 2 out of others that may exist.
ID Name Description Address 2 servers Servers IP Reuse 192.168.99.0
forescout-ei-hosts-changelog-list
Retrieves information about the changes of host properties and configuration from the eyeInspect CC database.
Base Command
forescout-ei-hosts-changelog-list
Input
| Argument Name | Description | Required |
|---|---|---|
| page | The page number of the results to retrieve (minimum is 1). Default is 1. | Optional |
| limit | Maximum number of records to retrieve. Default is 50. | Optional |
| host_id | List only records with the host_id property equal to the provided parameter. | Optional |
| start_timestamp | List only records with the timestamp property greater than or equal to the specified value. For example, 2020-05-26T15:00:00.000Z+01:00. | Optional |
| end_timestamp | List only records with the timestamp property less than or equal to the specified value. 2020-05-26T15:00:00.000Z+01:00. | Optional |
| event_type_id | List only records with the event_type_id property equal to the specified value. Possible values are: hostcl_new_host, hostcl_new_mac, hostcl_new_name, hostcl_new_role, hostcl_new_vendor_model, hostcl_new_os_version, hostcl_changed_os_version, hostcl_new_client_proto, hostcl_new_client_port, hostcl_new_server_proto, hostcl_new_server_port, hostcl_new_label, hostcl_new_fw_version, hostcl_changed_fw_version, hostcl_new_hw_version, hostcl_changed_hw_version, hostcl_changed_serial, hostcl_new_project, hostcl_changed_project, hostcl_new_module, hostcl_changed_module_name, hostcl_changed_module_type, hostcl_changed_module_vendor. | Optional |
| event_category | List only records with the event_type_id property equal to the specified value. Possible values are: PROPERTIES, CONFIGURATION, ALL. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| ForescoutEyeInspect.HostChangeLog.id | Number | The unique ID of the HostChangeLog in the eyeInspect CC. |
| ForescoutEyeInspect.HostChangeLog.timestamp | String | Timestamp in ISO format of when the host change was detected. |
| ForescoutEyeInspect.HostChangeLog.event_type_id | String | An identifier of the type of change detected. |
| ForescoutEyeInspect.HostChangeLog.event_type_name | String | A more human readable representation of the type of change detected. |
| ForescoutEyeInspect.HostChangeLog.event_category | String | A more general type of the change detected. |
| ForescoutEyeInspect.HostChangeLog.host_id | Number | The unique ID of the host in the eyeInspect CC database in which the change was detected. |
| ForescoutEyeInspect.HostChangeLog.information_source | String | The source of information for the detected change. |
| ForescoutEyeInspect.HostChangeLog.sensor_id | Number | In case the detected change was reported from a sensor, the unique ID in the eyeInspect CC database of the sensor reporting the information. |
| ForescoutEyeInspect.HostChangeLog.sensor_id | Number | In case the detected change was reported from a sensor, the unique ID in the eyeInspect CC database of the sensor reporting the information. |
| ForescoutEyeInspect.HostChangeLog.username | String | In case the detected change was reported from a eyeInspect user, the username of the user reporting the information. |
| ForescoutEyeInspect.HostChangeLog.old_value | String | The old value of the host property. |
| ForescoutEyeInspect.HostChangeLog.new_value | String | The new value of the host property. |
| ForescoutEyeInspect.HostChangeLog.host_address | String | The IP address, or nested address (in case of a nested device) of the host. |
| ForescoutEyeInspect.HostChangeLog.host_vlan | String | The VLAN ID of the host (only present if the process_vlan_tags option is enabled in the sensor). |
| ForescoutEyeInspect.HostChangeLog.host_name | String | The main name of the host. |
| ForescoutEyeInspect.HostChangeLog.host_ip_reuse_domain_id | String | The unique ID of the IP Reuse Domain the host is in. |
| ForescoutEyeInspect.HostChangeLog.host_mac_addresses | String | The MAC addresses associated to the host. |
Command example
!forescout-ei-hosts-changelog-list page=1 limit=1
Context Example
{
"ForescoutEyeInspect": {
"HostChangeLog": {
"event_category": "PROPERTIES",
"event_type_id": "hostcl_new_host",
"event_type_name": "New host",
"host_address": "192.168.30.82",
"host_id": 1,
"host_ip_reuse_domain_id": 1,
"host_mac_addresses": [
"00:50:56:A6:41:89",
"C4:24:56:A4:86:11"
],
"host_name": "",
"host_vlan": "",
"id": 1,
"information_source": "USER",
"new_value": "",
"old_value": "",
"sensor_id": 0,
"timestamp": "2022-01-16T17:38:41.505+01:00",
"username": "admin"
}
}
}
Human Readable Output
Hosts Changes List
Current page size: 1
Showing page 1 out of others that may exist.
ID Host ID Event Type Name 1 1 New host
Configuration parameters
server_url— Server URL (required)credentials— Username (required)insecure— Trust any certificate (not secure)proxy— Use system proxy settingsmax_fetch— Maximum incidents per fetchfirst_fetch— First fetch timestamp (<number> <time unit>, like 12 hours, 7 days).incidentType— Incident typeincidentFetchInterval— Incidents Fetch IntervalisFetch— Fetch incidents
Commands (27)
-
forescout-ei-alert-listRetrieves information about the alerts inside eyeInspect CC.
-
forescout-ei-alert-pcap-getRetrieves the PCAP file associated to a given alert.
-
forescout-ei-diagnostic-logs-getDownload the ZIP file that contains diagnostic logs of the Command Center.
-
forescout-ei-diagnostics-information-getRetrieves information about all monitored Command Center resources and their health status excluding the logs.
-
forescout-ei-domain-blacklist-addAdds a new entry to the domain name blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-domain-blacklist-getRetrieves the domain name blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-file-operation-blacklist-addAdds entries to the file operation blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-file-operation-blacklist-getRetrieves the file operation blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-group-policy-createCreate a new group policy.
-
forescout-ei-group-policy-deleteDelete a group policy.
-
forescout-ei-group-policy-hosts-assignAdd all hosts not assigned to any policy (individual or group) matching the filter to the group policy.
-
forescout-ei-group-policy-hosts-unassignUnassign all hosts assigned to the group policy matching the filter.
-
forescout-ei-group-policy-listGet all group policies.
-
forescout-ei-group-policy-updateUpdate a group policy. Note: Since the entire policy will be overridden, all fields are required.
-
forescout-ei-host-listRetrieves information about the hosts in the eyeInspect CC database.
-
forescout-ei-hosts-changelog-listRetrieves information about the changes of host properties and configuration from the eyeInspect CC database.
-
forescout-ei-ip-blacklist-addAdds a new entry to the IP blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-ip-blacklist-getRetrieves the IP blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-ip-reuse-domain-listGet all IP reuse domains.
-
forescout-ei-link-listRetrieves information about the links in the eyeInspect CC database.
-
forescout-ei-sensor-listRetrieves information about the sensors associated to the eyeInspect CC.
-
forescout-ei-sensor-module-deleteDeletes the specified module from the specified sensor and from the eyeInspect CC database.
-
forescout-ei-sensor-module-listRetrieves information about the modules of the specified sensor.
-
forescout-ei-sensor-module-updateChanges the specified properties of the specified module.
-
forescout-ei-ssl-client-blacklist-addAdds a new entry to the SSL client application blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-ssl-client-blacklist-getRetrieves the SSL client application blacklist from the Industrial Threat Library of the specified sensor.
-
forescout-ei-vulnerability-info-getRetrieves information about a specific vulnerability stored in the eyeInspect CC database.
from copy import deepcopy from typing import Any # from urllib.parse import urljoin # type: ignore import demistomock as demisto # noqa: F401 import urllib3 from CommonServerPython import * # noqa: F401 # pylint: disable=unused-wildcard-import from urllib.parse import urljoin # type: ignore from CommonServerUserPython import * # disable insecure warnings urllib3.disable_warnings() CUSTOM_TABLE_HEADERS = { "Id": "ID", "Ip": "IP", "Mac": "MAC", "Src": "Source", "Dst": "Destination", "Proto": "Protocol", } XSOAR_SEVERITY_MAPPING = { 0: IncidentSeverity.UNKNOWN, 1: IncidentSeverity.INFO, 2: IncidentSeverity.LOW, 3: IncidentSeverity.MEDIUM, 4: IncidentSeverity.HIGH, 5: IncidentSeverity.CRITICAL, } DEFAULT_PAGE = 1 DEFAULT_LIMIT = 50 DEFAULT_FIRST_FETCH = "7 days" MAX_LIMIT = 100 DEFAULT_FETCH_INCIDENTS = 50 MAX_FETCH_INCIDENTS = 200 class Client(BaseClient): """ Client for ForescoutEyeInspect RESTful API. Args: base_url (str): The base URL of ForescoutEyeInspect. use_ssl (bool): Specifies whether to verify the SSL certificate or not. use_proxy (bool): Specifies if to use XSOAR proxy settings. """ def __init__(self, base_url: str, username: str, password: str, use_ssl: bool, use_proxy: bool): super().__init__(urljoin(base_url, "/api/v1/"), auth=(username, password), verify=use_ssl, proxy=use_proxy) def list_hosts_request( self, offset: Optional[int] = None, limit: Optional[int] = None, last_seen: Optional[str] = None, id_min: Optional[int] = None, sort_field: Optional[str] = None, sort_ascending: Optional[bool] = None, ) -> List[dict[str, Any]]: """ Retrieves information about the hosts in the eyeInspect CC database. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. last_seen (Optional[int]): List only records with the last seen timestamp bigger or equal to the provided parameter. id_min (Optional[int]): Retrieve hosts from a minimum ID value onward. sort_field (Optional[int]): List records and sort them based on a specific field, as well as on ID. sort_ascending (Optional[bool]): Indicates whether the result list should be sorted ascending or descending. Returns: List[Dict[str, Any]]: Forescout EyeInspect hosts. """ params = remove_empty_elements( { "offset": offset, "limit": limit, "last_seen": last_seen, "id_min": id_min, "sort_field": sort_field, "sort_ascending": sort_ascending, } ) return self._http_request(method="GET", url_suffix="hosts", params=params) def list_links_request( self, offset: Optional[int] = None, limit: Optional[int] = None, src_host_id: Optional[int] = None, dst_host_id: Optional[int] = None, proto: Optional[str] = None, port: Optional[str] = None, last_seen: Optional[str] = None, id_min: Optional[int] = None, sort_field: Optional[str] = None, sort_ascending: Optional[bool] = None, ) -> List[dict[str, Any]]: """ Retrieves information about the links in the eyeInspect CC database. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. src_host_id (Optional[int]): List only records with the src_host_id property set to the specified value. dst_host_id (Optional[int]): List only records with the dst_host_id property set to the specified value. proto (Optional[str]): List only records with the provided protocol. port (Optional[str]): List only records with one of the values of the port property equal to the provided parameter. last_seen (Optional[str]): List only records with the last_seen timestamp bigger or equal to the provided parameter. id_min (Optional[int]): Retrieve links from a minimum ID value onward. sort_field (Optional[str]): List records and sort them based on a specific field, as well as on ID. sort_ascending (Optional[bool]): Indicates whether the result list should be sorted ascending or descending. Returns: List[Dict[str, Any]]: Link between 2 hosts. """ params = remove_empty_elements( { "offset": offset, "limit": limit, "src_host_id": src_host_id, "dst_host_id": dst_host_id, "proto": proto, "port": port, "last_seen": last_seen, "id_min": id_min, "sort_field": sort_field, "sort_ascending": sort_ascending, } ) return self._http_request(method="GET", url_suffix="links", params=params) def get_vulnerability_info_request(self, cve_id: str) -> dict[str, Any]: """ Retrieves information about a specific vulnerability stored in the eyeInspect CC database. Args: cve_id (str): The unique ID of the vulnerability information record to be retrieved. Returns: Dict[str, Any]: Information about the CVE. """ return self._http_request(method="GET", url_suffix=f"cve_info/{cve_id}") def list_alerts_request( self, offset: Optional[int] = None, limit: Optional[int] = None, start_timestamp: Optional[str] = None, end_timestamp: Optional[str] = None, event_type_id: Optional[str] = None, l4_proto: Optional[str] = None, l7_proto: Optional[str] = None, src_ip: Optional[str] = None, dst_ip: Optional[str] = None, ip: Optional[str] = None, dst_port: Optional[int] = None, src_host_id: Optional[int] = None, dst_host_id: Optional[int] = None, host_id: Optional[int] = None, ) -> List[dict[str, Any]]: """ Retrieves information about the alerts inside eyeInspect CC. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. start_timestamp (Optional[str]): List only records with the timestamp property bigger or equal to the specified value. end_timestamp (Optional[str]): List only records with the timestamp property smaller or equal to the specified value. event_type_id (Optional[str]): List records that have the event_type_id property containing the specified parameter. l4_proto (Optional[str]): List records that have the l4_proto property equal to the specified parameter. l7_proto (Optional[str]): List records that have the l7_proto property equal to the specified parameter. src_ip (Optional[str]): List records that have the src_ip property equal to the specified parameter, or contained in the given CIDR-defined network. dst_ip (Optional[str]): List records that have the dst_ip property equal to the specified parameter, or contained in the given CIDR-defined network. ip (Optional[str]): List records that have either the src_ip or the dst_ip property equal to the specified parameter, or contained in the given CIDR-defined network. dst_port (Optional[int]): Fetch records that have dst_port equal to the specified parameter. src_host_id (Optional[int]): Fetch records that have the src_ip or src_mac equal to the specified host id. dst_host_id (Optional[int]): Fetch records that have the dst_ip or dst_mac equal to the specified host id. host_id (Optional[int]): Fetch records that have either the IP or MAC address equal to the specified host id. Returns: List[Dict[str, Any]]: Forescout EyeInspect alert. """ params = remove_empty_elements( { "offset": offset, "limit": limit, "start_timestamp": start_timestamp, "end_timestamp": end_timestamp, "event_type_id": event_type_id, "l4_proto": l4_proto, "l7_proto": l7_proto, "src_ip": src_ip, "dst_ip": dst_ip, "ip": ip, "dst_port": dst_port, "src_host_id": src_host_id, "dst_host_id": dst_host_id, "host_id": host_id, } ) return self._http_request(method="GET", url_suffix="alerts", params=params) def get_alert_pcap_request(self, alert_id: int) -> bytes: """ Retrieves the PCAP file associated to a given Alert. Args: alert_id (int): The unique ID of the Alert to get the PCAP of. Returns: Dict[str, Any]: Alert PCAP file. """ return self._http_request(method="GET", url_suffix=f"alert_pcaps/{alert_id}", resp_type="content") def list_sensors_request( self, offset: Optional[int] = None, limit: Optional[int] = None, all_sensors: Optional[bool] = None ) -> List[dict[str, Any]]: """ Retrieves information about the sensors associated to the eyeInspect CC. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. all_sensors (Optional[bool]): Whether to retrieve all the sensors (ICS Patrol and passive) or only the passive ones. Returns: List[Dict[str, Any]]: Forescout EyeInspect sensors. """ params = remove_empty_elements({"offset": offset, "limit": limit, "all_sensors": all_sensors}) return self._http_request(method="GET", url_suffix="sensors", params=params) def list_sensor_modules_request( self, sensor_id: int, offset: Optional[int] = None, limit: Optional[int] = None ) -> List[dict[str, Any]]: """ Retrieves information about the Modules of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor to query for modules. offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: Forescout EyeInspect sensor module. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix=f"sensors/{sensor_id}/modules", params=params) def update_sensor_module_request( self, sensor_id: int, module_id: int, name: Optional[str] = None, description: Optional[str] = None, started: Optional[bool] = None, operational_mode: Optional[str] = None, ) -> dict[str, Any]: """ Changes the specified properties of the specified Module. Args: sensor_id (int): The unique ID of the Sensor which the Module to update. module_id (int): The unique ID of the Module to update. name (Optional[str]): Name of the module. description (Optional[str]): Description of the module. started (Optional[bool]): If set to true the module will be started. operational_mode (Optional[str]): Changes the operational mode of the Module to the specified value. Returns: Dict[str, Any]: Forescout EyeInspect sensor module. """ params = remove_empty_elements( {"name": name, "description": description, "started": started, "operational_mode": operational_mode} ) return self._http_request(method="PUT", url_suffix=f"sensors/{sensor_id}/modules/{module_id}", params=params) def delete_sensor_module_request(self, sensor_id: int, module_id: int) -> None: """ Deletes the specified Module from the specified Sensor and from the eyeInspect CC database. Args: sensor_id (int): The unique ID of the Sensor which the Module to delete. module_id (int): The unique ID of the Module to delete. """ self._http_request(method="DELETE", url_suffix=f"sensors/{sensor_id}/modules/{module_id}", resp_type="text") def get_ip_blacklist_request( self, sensor_id: int, offset: Optional[int] = None, limit: Optional[int] = None ) -> List[dict[str, Any]]: """ Retrieves the IP blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the IP blacklist is to be retrieved. offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: The IP addresses of the blacklist. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_bip/blacklist", params=params) def add_ip_blacklist_request(self, sensor_id: int, address: str, comment: str = "") -> None: """ Adds a new entry to the IP blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the IP blacklist is to be updated. address (str): The IP to add to the blacklist. comment (str): A comment about the blacklisted IP. """ body = [{"address": address, "comment": comment}] self._http_request( method="POST", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_bip/blacklist", json_data=body, resp_type="text" ) def get_domain_blacklist_request( self, sensor_id: int, offset: Optional[int] = None, limit: Optional[int] = None ) -> List[dict[str, Any]]: """ Retrieves the domain name blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor that contains the domain blacklist. offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: Dict[str, Any]: The domain names from the blacklist. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_dns_bd/blacklist", params=params) def add_domain_blacklist_request(self, sensor_id: int, domain_name: str, comment: str = "") -> None: """ Adds a new entry to the domain name blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the domain to be updated. domain_name (str): The domain name to add to the blacklist. comment (str): A comment about the domain name. """ body = [{"domain_name": domain_name, "comment": comment}] self._http_request( method="POST", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_dns_bd/blacklist", json_data=body, resp_type="text" ) def get_ssl_client_blacklist_request( self, sensor_id: int, offset: Optional[int] = None, limit: Optional[int] = None ) -> List[dict[str, Any]]: """ Retrieves the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the SSL client blacklist to be retrieved. offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: The SSL client applications from the specified sensor's blacklist. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request( method="GET", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_ssl_bja3/blacklist", params=params ) def add_ssl_client_blacklist_request(self, sensor_id: int, application_name: str, ja3_hash: str, comment: str = "") -> None: """ Adds a new entry to the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the SSL client. application_name (str): The application name related to add to blacklist. ja3_hash (str): The JA3 hash of a blacklisted client application. comment (str): Comment about the SSL client application. Returns: Dict[str, Any]: Forescout EyeInspect ITL SSL client applications blacklist. """ body = [{"application_name": application_name, "ja3_hash": ja3_hash, "comment": comment}] self._http_request( method="POST", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_ssl_bja3/blacklist", json_data=body, resp_type="text" ) def get_file_operation_blacklist_request( self, sensor_id: int, offset: Optional[int] = None, limit: Optional[int] = None ) -> List[dict[str, str]]: """ Retrieves the file operation blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the file operation blacklist to be retrieved. offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: The file operations from the specified sensor's blacklist. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_bfo/blacklist", params=params) def add_file_operation_blacklist_request( self, sensor_id: int, matching_type: str, file_or_folder: str, operation: str, comment: str = "" ) -> None: """ Adds entries to the file operation blacklist from the Industrial Threat Library of the specified Sensor. Args: sensor_id (int): The unique ID of the Sensor of which the file operation blacklist is to be updated. matching_type (str): The way file_or_folder should be matched. file_or_folder (str): The name of the file or folder the entry applies to. operation (str): The name of the file operation. comment (str): A comment provided by the user. """ body = [{"matching_type": matching_type, "file_or_folder": file_or_folder, "operation": operation, "comment": comment}] self._http_request( method="POST", url_suffix=f"sensors/{sensor_id}/itl/itl_sec_udb_bfo/blacklist", json_data=body, resp_type="text" ) def get_diagnostics_information_request(self) -> dict[str, Any]: """ Retrieves information about all monitored Command Center resources and their health status excluding the logs. Returns: Dict[str, Any]: The command center diagnostics. """ return self._http_request(method="GET", url_suffix="cc_info") def get_diagnostic_logs_request(self, cc_info: Optional[bool] = None, sensor_id: Optional[str] = None) -> bytes: """ Download the ZIP file which contains diagnostic logs of the Command Center. Args: cc_info (Optional[bool]): Whether to include Command Center diagnostic logs inside the downloaded zip, in addition to sensors logs. sensor_id (Optional[str]): Include logs from specific sensor by its ID, or all sensors (by specifying All). Returns: bytes: Diagnostics logs ZIP file. """ params = remove_empty_elements({"cc_info": cc_info, "sensor_id": sensor_id}) return self._http_request(method="GET", url_suffix="diagnostic_logs", params=params, resp_type="content") def list_group_policies_request(self, offset: Optional[int] = None, limit: Optional[int] = None) -> List[dict[str, Any]]: """ Get all group policies. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: Forescout EyeInspect group policies. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix="group_policy", params=params) def create_group_policy_request(self, name: str, description: str, constraints: List[dict[str, Any]]) -> dict[str, Any]: """ Create a new group policy. Args: name (str): The name of the group policy. description (str): The description of the group policy. constraints (List[Dict[str, Any]]): List of constraints of the policy. Returns: Dict[str, Any]: Forescout EyeInspect group policy. """ body = {"name": name, "description": description, "constraints": constraints} return self._http_request(method="POST", url_suffix="group_policy", json_data=body) def update_group_policy_request( self, policy_id: int, name: str, description: str, constraints: List[dict[str, Any]] ) -> dict[str, Any]: """ Update a group policy. Args: policy_id (int): The unique ID of the Policy of which the hosts will be added to. name (str): The name of the group policy. description (str): The description of the group policy. constraints (List[Dict[str, Any]]): List of constraints of the policy. Returns: Dict[str, Any]: Forescout EyeInspect group policy. """ body = {"name": name, "description": description, "constraints": constraints} return self._http_request(method="PUT", url_suffix=f"group_policy/{policy_id}", json_data=remove_empty_elements(body)) def delete_group_policy_request(self, policy_id: int) -> None: """ Delete an existing group policy. Args: policy_id (int): The unique ID of the Policy of which the hosts will be added to. """ self._http_request(method="DELETE", url_suffix=f"group_policy/{policy_id}", resp_type="text") def assign_group_policy_hosts_request(self, policy_id: int, filter_type: str, filter_value: str) -> dict[str, Any]: """ Add all hosts not assigned to any policy (individual or group) matching the filter to the group policy. Args: policy_id (int): The unique ID of the Policy of which the hosts will be added to. filter_type (str): The type of the filter. filter_value (str): The value of the filter. Returns: Dict[str, Any]: The response with the number of assigned hosts. """ body = [{"type": filter_type, "value": filter_value}] return self._http_request(method="POST", url_suffix=f"group_policy/{policy_id}/add_hosts", json_data=body) def unassign_group_policy_hosts_request(self, policy_id: int, filter_type: str, filter_value: str) -> dict[str, Any]: """ Unassign all hosts assigned to the group policy matching the filter. Args: policy_id (int): The unique ID of the Policy of which the hosts will be removed. filter_type (str): The type of the filter. filter_value (str): The value of the filter. Returns: Dict[str, Any]: The response with the number of assigned hosts. """ body = [{"type": filter_type, "value": filter_value}] return self._http_request(method="POST", url_suffix=f"group_policy/{policy_id}/remove_hosts", json_data=body) def list_ip_reuse_domains_request(self, offset: Optional[int] = None, limit: Optional[int] = None) -> List[dict[str, Any]]: """ Get all IP reuse domains. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. Returns: List[Dict[str, Any]]: Forescout EyeInspect IP reuse domains. """ params = remove_empty_elements({"offset": offset, "limit": limit}) return self._http_request(method="GET", url_suffix="ip_reuse_domains", params=params) def list_hosts_changelog_request( self, offset: Optional[int] = None, limit: Optional[int] = None, host_id: Optional[int] = None, start_timestamp: Optional[str] = None, end_timestamp: Optional[str] = None, event_type_id: Optional[str] = None, event_category: Optional[str] = None, ) -> List[dict[str, Any]]: """ Retrieves information about the changes of host properties and configuration from the eyeInspect CC database. Args: offset (Optional[int]): List records starting from the given offset (minimum is 0). limit (Optional[int]): List only up to limit records. host_id (Optional[int]): List only records with the host_id property equal to the provided parameter. start_timestamp (Optional[str]): List only records with the timestamp property bigger or equal to the specified value. end_timestamp (Optional[str]): List only records with the timestamp property smaller or equal to the specified value. event_type_id (Optional[str]): List only records with the event_type_id property equal to the specified value. event_category (Optional[str]): List only records with the event_type_id property equal to the specified value. Returns: List[Dict[str, Any]]: changelog about a host. """ params = remove_empty_elements( { "offset": offset, "limit": limit, "host_id": host_id, "start_timestamp": start_timestamp, "end_timestamp": end_timestamp, "event_type_id": event_type_id, "event_category": event_category, } ) return self._http_request(method="GET", url_suffix="host_change_logs", params=params) def get_alert_link(self, alert_id: int) -> str: return f'{urljoin(self._base_url, "/evt")}?id={alert_id}' def _http_request( self, method: str, url_suffix: str = "", full_url: str = None, headers: dict[str, str] = None, *args, **kwargs ): if method in ["POST", "PUT", "DELETE"]: headers = headers or {} headers["X-CSRF-Token"] = self._get_csrf_token() return super()._http_request(method, url_suffix, full_url, headers, *args, **kwargs) def _get_csrf_token(self) -> str: session_response = self._http_request(method="GET", url_suffix="sensors", resp_type="response") session_id = session_response.cookies.get("CCJSESSIONID") old_auth = self._auth self._auth = None token_response = self._http_request( method="GET", url_suffix="sensors", resp_type="response", headers={"X-CSRF-Token": "Fetch"}, cookies={"CCJSESSIONID": session_id}, ) self._auth = old_auth return token_response.headers["X-CSRF-Token"] def arg_to_type_list(arg: str, item_type: type[Any]) -> List[Any]: """ Converts XSOAR argument to list with certain type. Args: arg (str): The XSOAR argument. item_type (Type[Any]): The type of items inside the converted list. Returns: List[Any]: The converted list. """ return [item_type(item) for item in argToList(arg)] def arg_to_boolean(arg: Optional[str]) -> Optional[bool]: """ Converts XSOAR argument to a Python boolean value. Args: arg (Optional[str]): The XSOAR argument. Returns: Optional[bool]: None if argument is None, otherwise the converted boolean. """ if arg is None: return None return argToBoolean(arg) def arg_to_datetime_string(arg: Optional[str]) -> Optional[str]: """ Converts argument from XSOAR datetime to datetime string in API format. Args: arg (Optional[str]): The datetime argument from the user. Returns: str: The datetime string in API format. """ date = arg_to_datetime(arg) return date.astimezone().isoformat() if date else None def get_pagination_readable_message(page: int, limit: int) -> str: """ Gets a readable output message for commands with pagination. Args: page (int): The page used in the command. limit (int): The limit used in the command. Returns: str: The message that describes the pagination. """ return f"Current page size: {limit}\n Showing page {page} out of others that may exist." def to_table_header(string: str) -> str: """ Converts a name from API data to a readable header. Args: string (str): The name from the API data. Returns: str: The readable table header. """ new_string = string_to_table_header(string) return " ".join(CUSTOM_TABLE_HEADERS.get(word, word) for word in new_string.split()) def matches_one_item(items: List[Any], container_list: List[Any]) -> bool: """ Checks if one of the items inside a list is inside another list. Args: items (List[Any]): The first list to iterate its items. container_list (List[Any]): The list to check if the items inside it. Returns: bool: Whether one of the items is inside container_list. """ return any(True for item in items if item in container_list) def filter_single_result(result: dict[str, Any], **fields: List[Any]) -> bool: """ Filters a single result of the API, based on the results fields. Args: result (Dict[str, Any]): A single object from Forescout EyeInspect API. Returns: bool: Whether the result passed the filter or not. """ for name, values in fields.items(): result_value = result.get(name) if not values: continue if isinstance(result_value, list) and matches_one_item(values, result_value): continue if not isinstance(result_value, list) and result_value in values: continue return False return True def filter_results(results: List[dict[str, Any]], **fields: List[Any]) -> List[dict[str, Any]]: """ Filters records from the API based on the provided fields. This is required due to lack of essential fields inside the API filtering. Args: results (List[Dict[str, Any]]): The results from the API. Returns: List[Dict[str, Any]]: The results after filtering it. """ return [result for result in results if filter_single_result(result, **fields)] def add_alerts_fields(client: Client, alerts: List[dict[str, Any]]) -> None: """ Adds additional data to the alerts. Args: client (Client): The client of ForescoutEyeInspect. alerts (List[Dict[str, Any]]): The alert to add the additional data. """ for alert in alerts: alert["link"] = client.get_alert_link(alert["alert_id"]) alert["xsoar_severity"] = XSOAR_SEVERITY_MAPPING.get(alert["severity"], alert["severity"]) def get_pagination_arguments(args: dict[str, Any]) -> tuple[int, int, int]: """ Gets and validates pagination arguments for client (offset and limit). Args: args (Dict[str, Any]): The command arguments (page and limit). Returns: Tuple[int, int, int]: The page, calculated offset, and limit after validation. """ page = arg_to_number(args.get("page", DEFAULT_PAGE)) limit = arg_to_number(args.get("limit", DEFAULT_LIMIT)) if page < 1: # type: ignore[operator] raise DemistoException("Page argument must be greater than 1") if not 1 <= limit <= MAX_LIMIT: # type: ignore[operator] raise DemistoException(f"Limit argument must be between 1 to {MAX_LIMIT}") return page, (page - 1) * limit, limit # type: ignore[operator,return-value] def validate_fetch_params(max_fetch: int, first_fetch: str) -> None: """ Validates the parameters for fetch incident command. Args: max_fetch: (int): The maximum number of incidents for one fetch. first_fetch: (str): First fetch time in words. """ try: arg_to_datetime(first_fetch) except ValueError: return_error("First fetch parameter is not a valid datetime") if max_fetch > MAX_FETCH_INCIDENTS: return_error(f"The Maximum number of incidents per fetch should not exceed {MAX_FETCH_INCIDENTS}.") def list_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the hosts in the eyeInspect CC database. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) last_seen = arg_to_datetime_string(args.get("last_seen")) id_min = arg_to_number(args.get("id_min")) sort_field = args.get("sort_field") sort_ascending = arg_to_boolean(args.get("sort_ascending")) response = client.list_hosts_request( offset=offset, limit=limit, last_seen=last_seen, id_min=id_min, sort_field=sort_field, sort_ascending=sort_ascending ) outputs = response["results"] # type: ignore[call-overload] ip_addresses = argToList(args.get("ip")) vlan_ids = argToList(args.get("vlan_id")) mac_addresses = argToList(args.get("mac_address")) sensor_ids = arg_to_type_list(args.get("sensor_id"), int) # type: ignore[arg-type] outputs = filter_results(outputs, ip=ip_addresses, vlans=vlan_ids, mac_addresses=mac_addresses, sensor_ids=sensor_ids) readable_output = tableToMarkdown( "Hosts List:", outputs, removeNull=True, headers=["id", "main_name", "description", "os_version", "ip", "mac_addresses"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.Host", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def list_links_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the links in the eyeInspect CC database. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) src_host_id = arg_to_number(args.get("src_host_id")) dst_host_id = arg_to_number(args.get("dst_host_id")) proto = args.get("proto") port = args.get("port") last_seen = arg_to_datetime_string(args.get("last_seen")) id_min = arg_to_number(args.get("id_min")) sort_field = args.get("sort_field") sort_ascending = arg_to_boolean(args.get("sort_ascending")) response = client.list_links_request( offset=offset, limit=limit, src_host_id=src_host_id, dst_host_id=dst_host_id, proto=proto, port=port, last_seen=last_seen, id_min=id_min, sort_field=sort_field, sort_ascending=sort_ascending, ) outputs = response["results"] # type: ignore[call-overload] readable_output = tableToMarkdown( "Host Links List:", outputs, removeNull=True, headers=["id", "src_host_id", "dst_host_id", "proto"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.Link", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def get_vulnerability_info_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about a specific vulnerability stored in the eyeInspect CC database. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ cve_id = args["cve_id"] response = client.get_vulnerability_info_request(cve_id=cve_id) readable_output = tableToMarkdown( f"CVE {cve_id} Information:", response, removeNull=True, headers=["id", "title", "description", "published_date", "cvss_score"], headerTransform=to_table_header, ) return CommandResults( outputs_prefix="ForescoutEyeInspect.CVE", outputs_key_field="id", outputs=response, readable_output=readable_output, raw_response=response, ) def list_alerts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the alerts inside eyeInspect CC. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) start_timestamp = arg_to_datetime_string(args.get("start_timestamp")) end_timestamp = arg_to_datetime_string(args.get("end_timestamp")) event_type_id = args.get("event_type_id") l4_proto = args.get("l4_proto") l7_proto = args.get("l7_proto") src_ip = args.get("src_ip") dst_ip = args.get("dst_ip") ip = args.get("ip") response = client.list_alerts_request( offset=offset, limit=limit, start_timestamp=start_timestamp, end_timestamp=end_timestamp, event_type_id=event_type_id, l4_proto=l4_proto, l7_proto=l7_proto, src_ip=src_ip, dst_ip=dst_ip, ip=ip, ) outputs = response["results"] # type: ignore[call-overload] sensor_names = argToList(args.get("sensor_name")) vlan_ids = argToList(args.get("vlan_id")) severities = arg_to_type_list(args.get("severity"), int) # type: ignore[arg-type] statuses = argToList(args.get("status")) outputs = filter_results(outputs, sensor_name=sensor_names, vlan=vlan_ids, severity=severities, status=statuses) add_alerts_fields(client, outputs) readable_output = tableToMarkdown( "Alerts List:", outputs, removeNull=True, headers=["alert_id", "description", "timestamp", "src_ip", "dst_ip"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.Alert", outputs_key_field="alert_id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def get_alert_pcap_command(client: Client, args: dict[str, str]) -> dict[str, Any]: """ Retrieves the PCAP file associated to a given Alert. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: Dict[str, Any]: File entry of the alert PCAP. """ alert_id = arg_to_number(args["alert_id"]) response = client.get_alert_pcap_request(alert_id=alert_id) # type: ignore[arg-type] return fileResult(filename=f"alert_{alert_id}_sniff.pcap", data=response, file_type=EntryType.ENTRY_INFO_FILE) def list_sensors_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the sensors associated to the eyeInspect CC. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) all_sensors = arg_to_boolean(args.get("all_sensors")) response = client.list_sensors_request(offset=offset, limit=limit, all_sensors=all_sensors) outputs = response["results"] # type: ignore[call-overload] names = argToList(args.get("name")) addresses = argToList(args.get("address")) ports = arg_to_type_list(args.get("port"), int) # type: ignore[arg-type] sensor_types = argToList(args.get("type")) states = argToList(args.get("state")) outputs = filter_results(outputs, name=names, address=addresses, port=ports, type=sensor_types, state=states) readable_output = tableToMarkdown( "Sensors List:", outputs, removeNull=True, headers=["id", "name", "address", "port", "type"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.Sensor", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def list_sensor_modules_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the Modules of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) page, offset, limit = get_pagination_arguments(args) response = client.list_sensor_modules_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] outputs = response["results"] # type: ignore[call-overload] readable_output = tableToMarkdown( f"Sensor {sensor_id} Modules List:", outputs, removeNull=True, headers=["id", "name", "description", "engine", "started"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.SensorModule", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def update_sensor_module_command(client: Client, args: dict[str, str]) -> CommandResults: """ Changes the specified properties of the specified Module. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) module_id = arg_to_number(args["module_id"]) name = args.get("name") description = args.get("description") started = arg_to_boolean(args.get("started")) operational_mode = args.get("operational_mode") response = client.update_sensor_module_request( sensor_id=sensor_id, # type: ignore[arg-type] module_id=module_id, # type: ignore[arg-type] name=name, description=description, started=started, operational_mode=operational_mode, ) readable_output = tableToMarkdown( f"Updated Module {module_id} of Sensor {sensor_id}:", response, removeNull=True, headers=["name", "description", "engine", "started"], headerTransform=to_table_header, ) return CommandResults( outputs_prefix="ForescoutEyeInspect.SensorModule", outputs_key_field="id", outputs=response, readable_output=readable_output, raw_response=response, ) def delete_sensor_module_command(client: Client, args: dict[str, str]) -> CommandResults: """ Deletes the specified Module from the specified Sensor and from the eyeInspect CC database. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) module_id = arg_to_number(args["module_id"]) client.delete_sensor_module_request(sensor_id=sensor_id, module_id=module_id) # type: ignore[arg-type] readable_output = f"## The module {module_id} of sensor {sensor_id} was successfully deleted!" return CommandResults(readable_output=readable_output) def get_ip_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the IP blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) page, offset, limit = get_pagination_arguments(args) response = client.get_ip_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] outputs = deepcopy(response["results"]) # type: ignore[call-overload] for entry in outputs: entry["sensor_id"] = sensor_id readable_output = tableToMarkdown( f"IP Blacklist of Sensor {sensor_id}:", outputs, removeNull=True, headers=["address", "comment"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.IPBlacklist", outputs_key_field="address", outputs=outputs, readable_output=readable_output, raw_response=response, ) def add_ip_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the IP blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) address = args["address"] comment = args.get("comment", "") client.add_ip_blacklist_request(sensor_id=sensor_id, address=address, comment=comment) # type: ignore[arg-type] outputs = {"address": address, "comment": comment} readable_output = tableToMarkdown( f"New IP Blacklist Entry of Sensor {sensor_id}:", outputs, removeNull=True, headers=["address", "comment"], headerTransform=to_table_header, ) return CommandResults(readable_output=readable_output) def get_domain_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the domain name blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) page, offset, limit = get_pagination_arguments(args) response = client.get_domain_blacklist_request(sensor_id=sensor_id, offset=offset, limit=limit) # type: ignore[arg-type] outputs = deepcopy(response["results"]) # type: ignore[call-overload] for entry in outputs: entry["sensor_id"] = sensor_id readable_output = tableToMarkdown( f"Domain Blacklist of Sensor {sensor_id}:", outputs, removeNull=True, headers=["domain_name", "comment"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.DomainBlacklist", outputs_key_field="domain_name", outputs=outputs, readable_output=readable_output, raw_response=response, ) def add_domain_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the domain name blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) domain_name = args["domain_name"] comment = args.get("comment", "") client.add_domain_blacklist_request( sensor_id=sensor_id, # type: ignore[arg-type] domain_name=domain_name, comment=comment, ) outputs = {"domain_name": domain_name, "comment": comment} readable_output = tableToMarkdown( f"New Domain Blacklist Entry of Sensor {sensor_id}", outputs, removeNull=True, headers=["domain_name", "comment"], headerTransform=to_table_header, ) return CommandResults(readable_output=readable_output) def get_ssl_client_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) page, offset, limit = get_pagination_arguments(args) response = client.get_ssl_client_blacklist_request( sensor_id=sensor_id, # type: ignore[arg-type] offset=offset, limit=limit, ) outputs = deepcopy(response["results"]) # type: ignore[call-overload] for entry in outputs: entry["sensor_id"] = sensor_id readable_output = tableToMarkdown( f"SSL Client Applications Blacklist of Sensor {sensor_id}:", outputs, removeNull=True, headers=["application_name", "ja3_hash", "comment"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.SSLClientBlacklist", outputs_key_field="ja3_hash", outputs=outputs, readable_output=readable_output, raw_response=response, ) def add_ssl_client_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds a new entry to the SSL client application blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) application_name = args["application_name"] ja3_hash = args["ja3_hash"] comment = args.get("comment", "") client.add_ssl_client_blacklist_request( sensor_id=sensor_id, # type: ignore[arg-type] application_name=application_name, ja3_hash=ja3_hash, comment=comment, ) outputs = { "application_name": application_name, "ja3_hash": ja3_hash, "comment": comment, } readable_output = tableToMarkdown( f"New SSL Client Blacklist Entry of Sensor {sensor_id}:", outputs, removeNull=True, headers=["application_name", "ja3_hash", "comment"], headerTransform=to_table_header, ) return CommandResults(readable_output=readable_output) def get_file_operation_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves the file operation blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) page, offset, limit = get_pagination_arguments(args) response = client.get_file_operation_blacklist_request( sensor_id=sensor_id, # type: ignore[arg-type] offset=offset, limit=limit, ) outputs = deepcopy(response["results"]) # type: ignore[call-overload] for entry in outputs: entry["sensor_id"] = sensor_id readable_output = tableToMarkdown( f"File Operation Blacklist of Sensor {sensor_id}:", outputs, removeNull=True, headers=["matching_type", "file_or_folder", "operation", "comment"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.FileOperationBlacklist", outputs_key_field="file_or_folder", outputs=outputs, readable_output=readable_output, raw_response=response, ) def add_file_operation_blacklist_command(client: Client, args: dict[str, str]) -> CommandResults: """ Adds entries to the file operation blacklist from the Industrial Threat Library of the specified Sensor. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ sensor_id = arg_to_number(args["sensor_id"]) matching_type = args["matching_type"] file_or_folder = args["file_or_folder"] operation = args["operation"] comment = args.get("comment", "") client.add_file_operation_blacklist_request( sensor_id=sensor_id, # type: ignore[arg-type] matching_type=matching_type, file_or_folder=file_or_folder, operation=operation, comment=comment, ) outputs = {"matching_type": matching_type, "file_or_folder": file_or_folder, "operation": operation, "comment": comment} readable_output = tableToMarkdown( f"New File Operation Blacklist Entry of Sensor {sensor_id}:", outputs, removeNull=True, headers=["matching_type", "file_or_folder", "operation", "comment"], headerTransform=to_table_header, ) return CommandResults(readable_output=readable_output) def get_diagnostics_information_command(client: Client, *_) -> CommandResults: """ Retrieves information about all monitored Command Center resources and their health status excluding the logs. Args: client (client): The ForescoutEyeInspect client. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ response = client.get_diagnostics_information_request() readable_output = tableToMarkdown( "Command Center Diagnostics Information:", response, removeNull=True, headers=["ip_address", "hostname", "open_ports", "cc_version"], headerTransform=to_table_header, ) return CommandResults( outputs_prefix="ForescoutEyeInspect.CCInfo", outputs_key_field="ip_address", outputs=response, readable_output=readable_output, raw_response=response, ) def get_diagnostic_logs_command(client: Client, args: dict[str, str]) -> dict[str, Any]: """ Download the ZIP file which contains diagnostic logs of the Command Center. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: Dict[str, Any]: Command results with raw response, outputs and readable outputs. """ cc_info = arg_to_boolean(args.get("cc_info")) sensor_id = args.get("sensor_id") response = client.get_diagnostic_logs_request(cc_info=cc_info, sensor_id=sensor_id) return fileResult(filename="command_center_diagnostic_logs.zip", data=response, file_type=EntryType.ENTRY_INFO_FILE) def list_group_policies_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get all group policies. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) response = client.list_group_policies_request(offset=offset, limit=limit) outputs = response["results"] # type: ignore[call-overload] readable_output = tableToMarkdown( "Group Policies List:", outputs, removeNull=True, headers=["id", "name", "description"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.GroupPolicy", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def create_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Create a group policy. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ name = args["name"] description = args["description"] constraints = argToList(args["constraints"]) response = client.create_group_policy_request(name=name, description=description, constraints=constraints) readable_output = tableToMarkdown( "Group Policy Information:", response, removeNull=True, headers=["id", "name", "description"], headerTransform=to_table_header, ) readable_output += tableToMarkdown( "Group Policy Constraints:", response.get("constraints", []), removeNull=True, headers=["type", "operator", "os_version", "firmware_version", "open_ports_tcp", "open_ports_udp"], headerTransform=to_table_header, ) return CommandResults( outputs_prefix="ForescoutEyeInspect.GroupPolicy", outputs_key_field="id", outputs=response, readable_output=readable_output, raw_response=response, ) def update_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Update a group policy. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ policy_id = arg_to_number(args["policy_id"]) name = args["name"] description = args["description"] constraints = argToList(args["constraints"]) response = client.update_group_policy_request( policy_id=policy_id, # type: ignore[arg-type] name=name, description=description, constraints=constraints, ) readable_output = tableToMarkdown( "Updated Group Policy:", response, removeNull=True, headers=["id", "name", "description"], headerTransform=to_table_header ) readable_output += tableToMarkdown( "Group Policy Constraints:", response.get("constraints", []), removeNull=True, headers=["type", "operator", "os_version", "firmware_version", "open_ports_tcp", "open_ports_udp"], headerTransform=to_table_header, ) return CommandResults( outputs_prefix="ForescoutEyeInspect.GroupPolicy", outputs_key_field="id", outputs=response, readable_output=readable_output, raw_response=response, ) def delete_group_policy_command(client: Client, args: dict[str, str]) -> CommandResults: """ Delete a group policy. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ policy_id = arg_to_number(args["policy_id"]) client.delete_group_policy_request(policy_id=policy_id) # type: ignore[arg-type] return CommandResults(readable_output=f"## The group policy {policy_id} was successfully deleted!") def assign_group_policy_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Add all hosts not assigned to any policy (individual or group) matching the filter to the group policy. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ policy_id = arg_to_number(args["policy_id"]) filter_type = args["filter_type"] filter_value = args["filter_value"] response = client.assign_group_policy_hosts_request( policy_id=policy_id, # type: ignore[arg-type] filter_type=filter_type, filter_value=filter_value, ) readable_output = f'## {response["count"]} Additional Hosts Were Assigned to Group Policy {policy_id}!' return CommandResults(readable_output=readable_output, raw_response=response) def unassign_group_policy_hosts_command(client: Client, args: dict[str, str]) -> CommandResults: """ Unassign all hosts assigned to the group policy matching the filter. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ policy_id = arg_to_number(args["policy_id"]) filter_type = args["filter_type"] filter_value = args["filter_value"] response = client.unassign_group_policy_hosts_request( policy_id=policy_id, # type: ignore[arg-type] filter_type=filter_type, filter_value=filter_value, ) readable_output = f'## {response["count"]} Additional Hosts Were Unassigned from Group Policy {policy_id}!' return CommandResults(readable_output=readable_output, raw_response=response) def list_ip_reuse_domains_command(client: Client, args: dict[str, str]) -> CommandResults: """ Get all IP reuse domains. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) response = client.list_ip_reuse_domains_request(offset=offset, limit=limit) outputs = response["results"] # type: ignore[call-overload] readable_output = tableToMarkdown( "IP Reuse Domains List:", outputs, removeNull=True, headers=["id", "name", "description", "address"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.IPReuseDomain", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def list_hosts_changelog_command(client: Client, args: dict[str, str]) -> CommandResults: """ Retrieves information about the changes of host properties and configuration from the eyeInspect CC database. Args: client (client): The ForescoutEyeInspect client. args (Dict[str, Any]): Command arguments from XSOAR. Returns: CommandResults: Command results with raw response, outputs and readable outputs. """ page, offset, limit = get_pagination_arguments(args) host_id = arg_to_number(args.get("host_id")) start_timestamp = arg_to_datetime_string(args.get("start_timestamp")) end_timestamp = arg_to_datetime_string(args.get("end_timestamp")) event_type_id = args.get("event_type_id") event_category = args.get("event_category") response = client.list_hosts_changelog_request( offset=offset, limit=limit, host_id=host_id, start_timestamp=start_timestamp, end_timestamp=end_timestamp, event_type_id=event_type_id, event_category=event_category, ) outputs = response["results"] # type: ignore[call-overload] readable_output = tableToMarkdown( "Hosts Changes List:", outputs, removeNull=True, headers=["id", "host_id", "host_name", "event_type_name", "old_value", "new_value"], headerTransform=to_table_header, metadata=get_pagination_readable_message(page, limit), ) return CommandResults( outputs_prefix="ForescoutEyeInspect.HostChangeLog", outputs_key_field="id", outputs=outputs, readable_output=readable_output, raw_response=response, ) def test_module(client: Client, should_fetch: bool, first_fetch: str, max_fetch: int) -> str: """ Validates integration parameters and tests connection to Forescout EyeInspect. Args: client (Client): The Forescout EyeInspect client. should_fetch (str): Whether the integration should fetch incidents or not. first_fetch (str): The initial time to fetch the alerts as incidents. max_fetch (int): The maximum amount of incidents per execution. Returns: str: ok for success, or anything else for failure. """ if should_fetch: validate_fetch_params(max_fetch=max_fetch, first_fetch=first_fetch) try: client.list_hosts_request(offset=0, limit=1) except DemistoException as e: if "Error in API call [401]" in str(e): return_error("The provided credentials are invalid. Please check you entered the right username and password.") else: raise return "ok" def fetch_alerts(client: Client, last_time: datetime, max_fetch: int, last_incident_id: int) -> List[dict[str, Any]]: """ Fetches alerts with pagination. This is essential since the API might return earlier alerts than the start timestamp. Args: client (Client): The Forescout EyeInspect client. last_time (datetime): The time of the last fetched incident. max_fetch (int): The maximum amount of alerts to fetch. last_incident_id (int): The ID of the last fetched incident. Returns: List[Dict[str, Any]]: The new fetched alerts. """ alerts = [] # type: ignore[var-annotated] offset = 0 while max_fetch > 0: results = client.list_alerts_request( offset=offset, # type: ignore[union-attr,call-overload] limit=max_fetch, start_timestamp=last_time.isoformat(), )["results"] offset += len(results) if not results: return alerts count = 0 for result in results: if not last_incident_id or result["alert_id"] > last_incident_id: count += 1 alerts.append(result) max_fetch -= count return alerts def fetch_incidents(client: Client, first_fetch: str, max_fetch: int) -> None: """ Fetches new alerts as incidents. Args: client (Client): The ForescoutEyeInspect client. first_fetch (str): The time to fetch the incidents for the first execution. max_fetch (int): Maximum amount of alert to fetch at one request. """ validate_fetch_params(max_fetch=max_fetch, first_fetch=first_fetch) last_run = demisto.getLastRun() or {} last_time = arg_to_datetime(last_run.get("time") or first_fetch).astimezone() # type: ignore[union-attr] last_incident_id = last_run.get("incident_id") alerts = fetch_alerts(client, last_time, max_fetch, last_incident_id) # type: ignore[arg-type] add_alerts_fields(client, alerts) incidents = [] for alert in alerts: incidents.append({"name": alert["event_type_names"][0], "occurred": alert["timestamp"], "rawJSON": json.dumps(alert)}) if alerts: last_incident_id = alerts[-1]["alert_id"] last_time = datetime.fromisoformat(alerts[-1]["timestamp"]) demisto.setLastRun({"time": last_time.isoformat(), "incident_id": last_incident_id}) demisto.incidents(incidents) def main(): params = demisto.params() server_url = params["server_url"] username = params["credentials"]["identifier"] password = params["credentials"]["password"] use_ssl = not params.get("insecure", False) use_proxy = params.get("proxy", False) client = Client(server_url, username, password, use_ssl, use_proxy) max_fetch = arg_to_number(params.get("max_fetch", DEFAULT_FETCH_INCIDENTS)) max_fetch = min(max_fetch, MAX_FETCH_INCIDENTS) # type: ignore[type-var] first_fetch = params.get("first_fetch", DEFAULT_FIRST_FETCH) commands = { "forescout-ei-host-list": list_hosts_command, "forescout-ei-link-list": list_links_command, "forescout-ei-vulnerability-info-get": get_vulnerability_info_command, "forescout-ei-alert-list": list_alerts_command, "forescout-ei-alert-pcap-get": get_alert_pcap_command, "forescout-ei-sensor-list": list_sensors_command, "forescout-ei-sensor-module-list": list_sensor_modules_command, "forescout-ei-sensor-module-update": update_sensor_module_command, "forescout-ei-sensor-module-delete": delete_sensor_module_command, "forescout-ei-ip-blacklist-get": get_ip_blacklist_command, "forescout-ei-ip-blacklist-add": add_ip_blacklist_command, "forescout-ei-domain-blacklist-get": get_domain_blacklist_command, "forescout-ei-domain-blacklist-add": add_domain_blacklist_command, "forescout-ei-ssl-client-blacklist-get": get_ssl_client_blacklist_command, "forescout-ei-ssl-client-blacklist-add": add_ssl_client_blacklist_command, "forescout-ei-file-operation-blacklist-get": get_file_operation_blacklist_command, "forescout-ei-file-operation-blacklist-add": add_file_operation_blacklist_command, "forescout-ei-diagnostics-information-get": get_diagnostics_information_command, "forescout-ei-diagnostic-logs-get": get_diagnostic_logs_command, "forescout-ei-group-policy-list": list_group_policies_command, "forescout-ei-group-policy-create": create_group_policy_command, "forescout-ei-group-policy-update": update_group_policy_command, "forescout-ei-group-policy-delete": delete_group_policy_command, "forescout-ei-group-policy-hosts-assign": assign_group_policy_hosts_command, "forescout-ei-group-policy-hosts-unassign": unassign_group_policy_hosts_command, "forescout-ei-ip-reuse-domain-list": list_ip_reuse_domains_command, "forescout-ei-hosts-changelog-list": list_hosts_changelog_command, } try: command = demisto.command() if command == "fetch-incidents": fetch_incidents(client, first_fetch, max_fetch) # type: ignore[arg-type] elif command == "test-module": should_fetch = arg_to_boolean(params.get("isFetch")) return_results(test_module(client, should_fetch, first_fetch, max_fetch)) # type: ignore[arg-type] elif command in commands: return_results(commands[command](client, demisto.args())) # type: ignore[operator] else: raise NotImplementedError(f"The command {command} does not exist!") except Exception as e: demisto.error(fix_traceback_line_numbers(traceback.format_exc())) if "Error in API call [401]" in str(e): return_error("You are not authorized to use Forescout EyeInspect. Please validate your username and password.") return_error(f"Failed to execute {demisto.command()} command.\nError:\n{e}") if __name__ in ("__main__", "__builtin__", "builtins"): main()