Genians
Use the Genian NAC integration to block IP addresses using the assign tag.
Network Security · Genians
Details
| ID | Genians |
|---|---|
| Provider | Genians |
| Category | Network Security |
| From Version | 5.5.0 |
| Docker Image | demisto/python3:3.12.8.3296088 |
| Supported Modules | Agentix XSIAM |
README
Use the Genian NAC integration to block IP addresses using the assign tag.
Genian NAC network sensing technology powered by Device Platform Intelligence (DPI) discovers and presents all detected devices’ business contextual and risk-related information along with their technical information without disturbing existing network infrastructure. The resulting intelligence enhances visibility and allows operators to detect and respond to any non-compliant or compromised devices in real time.
With the result of comprehensive network visibility, Genian NAC can ensure compliance from all connected devices by leveraging Virtual In-Line Packet Inspection which operates at Layer 2. This technology has complete control over endpoint device traffic over TCP and UDP by eliminating the need for complex configurations and network changes.
Genians Genian NAC Module Requirements
Before you can use this integration in Cortex XSOAR, you need to enable certain modules in your Genian NAC environment.
Genian NAC Web Console
- This is the network address of the Genian NAC Enterprise or standalone Appliance. (The host on which the the Genian NAC is hosted.) For example, if the Genian NAC is hosted at the IP address 192.168.100.100, then you enter https://192.168.10.100:8443/mc2
Enforcement Mode
- Go to System > System > Click IP of Sensor > Click Sensor Tab > Click Sensor on the right
- Go to Sensor Operation > Sensor Mode and change the Sensor Mode to ‘host’
- Change Sensor Operationg Mode to ‘Enforcement’
- Monitoring: (Default) Monitoring mode. No blocking.
- Enforcement: Blocking mode
Specifying the Tag to be assigned to the node under control
- Go to Preferences > Properties > Tag
- Create new Tag or use existing Tag (e.g. THREAT)
Create Enforcement Policy
Reference the Enforcement Policy section in the Genian NAC Docs
Configuration Parameters
Server IP
- Input Genian NAC IP Address (e.g. 192.168.100.100)
API Key
- You can generate an API Key in the Genian NAC Web Console.
- Go to Management > User > Administrator tab > API Key to generate a key and save it.
- Input API Key (e.g. 912fae69-b454-4608-bf4b-fa142353b463)
Tag Name
- Input Tag Name for IP Block (e.g. THREAT, GUEST)
Configure Genian NAC in Cortex
- Name: a textual name for the integration instance.
- Server IP
- API Key
- Tag Name
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.
- Post IP address to a tag: genians-assign-ip-tag
- Delete IP address from a tag: genians-unassign-ip-tag
Post IP address to a tag
Assigns a tag to the Node specified.
Base Command
genians-assign-ip-tag
Input
| Argument Name | Description | Required |
|---|---|---|
| ip | IP Address (e.g. 192.168.100.87) | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| genians.tag.nodeId | string | nodeid of IP |
| genians.tag.Name | string | Tag name |
Raw Output
[
{
"Type": "node",
"Description": "Threat",
"IDX": 9,
"nodeId": "dd9394cc-4495-103a-8010-2cf05d0cf498-537696fb",
"Name": "THREAT"
}
]
Delete IP address from a tag
Removes the tag(s) from the Node specified.
Base Command
genians-unassign-ip-tag
Input
| Argument Name | Description | Required |
|---|---|---|
| ip | IP Address (e.g. 192.168.100.87) | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| genians.tag.nodeId | string | nodeid of IP |
| genians.tag.Name | string | Tag name |
Raw Output
[]
Configuration parameters
server_ip— Server IP (e.g. 172.29.62.26) (required)apikey— API Key (e.g. 912fae69-b454-4608-bf4b-fa142353b463) (required)insecure— Trust any certificate (not secure)tag_name— Tag Name (e.g. THREAT, GUEST) (required)feed— Fetch indicators
Commands (2)
-
genians-assign-ip-tagAssigns a tag to the Node specified.
-
genians-unassign-ip-tagRemoves the tag(s) from the Node specified.
import demistomock as demisto from CommonServerPython import * """ IMPORT """ import json import requests import urllib3 # Disable insecure warnings urllib3.disable_warnings() """ PARAMS """ SERVER_IP = demisto.params().get("server_ip") APIKEY = demisto.params().get("apikey") TAG_NAME = demisto.params().get("tag_name") # Genian NAC Policy Center (Server) URL BASE_URL = "https://" + SERVER_IP + ":8443/mc2" # Genian NAC REST API Request URL REQUEST_BASE_URL = "https://" + SERVER_IP + ":8443/mc2/rest/" # Should We use SSL USE_SSL = not demisto.params().get("insecure", False) # Response Content Type HEADER = {"accept": "application/json", "content-type": "application/json;charset=UTF-8"} """ HELPER FUNCTIONS """ def http_request(method, url, body=None): """ Makes an API call with the given arguments """ try: result = requests.request( method, url, data=body, headers=HEADER, verify=USE_SSL, ) if result.status_code < 200 or result.status_code >= 300: raise Exception(f"Error in Genian NAC Integration API Call. Code: {str(result.status_code)}") json_result = result.json() return json_result except Exception as e: return_error(str(e)) def get_ip_nodeid(ip: str): URL = REQUEST_BASE_URL + "nodes/" + ip + "/managementscope?apiKey=" + APIKEY result = http_request("GET", URL) return result def get_tag_list(): URL = REQUEST_BASE_URL + "tags?page=1&pageSize=30&npName=" + TAG_NAME + "&apiKey=" + APIKEY result = http_request("GET", URL) return result def list_tag_data_string(tag_name: str): data = [ {"id": "", "name": tag_name, "description": "", "startDate": "", "expireDate": "", "periodType": "", "expiryPeriod": ""} ] return data """ COMMANDS + REQUESTS FUNCTIONS """ def assign_ip_tag(nodeid: str): URL = REQUEST_BASE_URL + "nodes/" + nodeid + "/tags?apiKey=" + APIKEY data = list_tag_data_string(TAG_NAME) result = http_request("POST", URL, body=json.dumps(data)) return result def assign_ip_tag_command(): IP = demisto.getArg("ip") result = get_ip_nodeid(IP) nodeid = result[0]["nl_nodeid"] if not nodeid: demisto.results(f"IP not found. [{IP}] is not exist in your network") else: result2 = assign_ip_tag(nodeid) tag_check = "assign fail" for a in result2: if a["Name"] == TAG_NAME: tag_check = TAG_NAME break if tag_check == TAG_NAME: hr = f"IP : [{IP}], [{TAG_NAME}] Tag assign success." assign_tag = {"nodeId": nodeid, "Name": TAG_NAME} demisto.results( { "Type": entryTypes["note"], "ContentsFormat": formats["json"], "Contents": result2, "ReadableContentsFormat": formats["text"], "HumanReadable": hr, "EntryContext": {"genians.tag.(val.Tag == obj.Tag)": assign_tag}, } ) else: raise Exception(f"IP : [{IP}], [{TAG_NAME}] Tag assign fail.") def unassign_ip_tag(nodeid: str, data): URL = REQUEST_BASE_URL + "nodes/" + nodeid + "/tags?apiKey=" + APIKEY result = http_request("DELETE", URL, body=data) return result def unassign_ip_tag_command(): IP = demisto.getArg("ip") result = get_ip_nodeid(IP) nodeid = result[0]["nl_nodeid"] if not nodeid: demisto.results(f"IP not found. [{IP}] is not exist in your network") else: result2 = get_tag_list() tag_check = "tag_not_exists" for a in result2["result"]: if a["NP_NAME"] == TAG_NAME: tag_check = a["NP_IDX"] break if tag_check != "tag_not_exists": if int(tag_check): data = '["' + str(tag_check) + '"]' result3 = unassign_ip_tag(nodeid, data) if str(result3) == "[]": hr = f"IP : [{IP}], [{TAG_NAME}] Tag unassign success." unassign_tag = {"nodeId": nodeid, "Name": TAG_NAME} demisto.results( { "Type": entryTypes["note"], "ContentsFormat": formats["json"], "Contents": result3, "ReadableContentsFormat": formats["text"], "HumanReadable": hr, "EntryContext": {"genians.tag.(val.Tag == obj.Tag)": unassign_tag}, } ) else: raise Exception(f"IP : [{IP}], [{TAG_NAME}] Tag unassign fail.") else: demisto.results(f"[{TAG_NAME}] Tag not found.") else: demisto.results(f"[{TAG_NAME}] Tag not found.") def main(): """Main execution block""" try: LOG(f"Command being called is {demisto.command()}") if demisto.command() == "test-module": get_ip_nodeid("8.8.8.8") demisto.results("ok") elif demisto.command() == "genians-assign-ip-tag": assign_ip_tag_command() elif demisto.command() == "genians-unassign-ip-tag": unassign_ip_tag_command() else: raise NotImplementedError(f"Command {demisto.command()} was not implemented.") except Exception as e: return_error(str(e)) finally: LOG.print_log() # python2 uses __builtin__ python3 uses builtins if __name__ == "__builtin__" or __name__ == "builtins": main()