JizoM

This integration ensures interaction with the JizoM API.

Network Security · JizoM

Details

IDJizoM
ProviderCYBERDYNE inc
CategoryNetwork Security
From Version6.10.0
Docker Imagedemisto/python3:3.12.13.10116658

README

This integration ensures interaction with the JizoM API.
This integration was integrated and tested with version 12.3 of JizoM.

Configure JizoM in Cortex

Parameter Description Required
Username Reliability of the source providing the intelligence data. True
Password   True
Server URL. e.g., https://127.0.0.1:9001   True
Fetch incidents   False
Incident type   False
Trust any certificate (not secure)   False
Use system proxy settings   False
Incidents Fetch Interval   False
First fetch time (number, time unit, for example, 12 hours, 7 days, 3 months, 1 year)   False
Maximum number of alerts per fetch   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.

jizo-m-protocols-get


Get the list of alerts sorted by protocols.

Base Command

jizo-m-protocols-get

Input

Argument Name Description Required
ip_src Ipv4 or Ipv6 of the source. Optional
ip_dest Ipv4 or Ipv6 of the destination. Optional
datetime_from Get the alerts that were occurred from this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default value is 7 days ago. Optional
datetime_to Get the alerts that were occurred up to this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default is now. Optional
probe_name The name of the jizo probe. Optional
page A page number for pagination. Optional
limit The maximum number of protocols to display per alert. Optional

Context Output

Path Type Description
JizoM.Protocols.alerts_flows.count Number The number of displayed alerts.
JizoM.Protocols.alerts_flows.data String The details of alerts.
JizoM.Protocols.alerts_flows.total Number The total number of alerts.
JizoM.Protocols.alerts_files.count Number The number of displayed alerts.
JizoM.Protocols.alerts_files.data String The details of alerts.
JizoM.Protocols.alerts_files.total Number The total number of alerts.
JizoM.Protocols.alerts_usecase.count Number The number of displayed alerts.
JizoM.Protocols.alerts_usecase.data String The details of alerts.
JizoM.Protocols.alerts_usecase.total Number The total number of alerts.

jizo-m-peers-get


Get list of IP addresses connected to a specific one.

Base Command

jizo-m-peers-get

Input

Argument Name Description Required
ip_src Ipv4 or Ipv6 of the source. Optional
ip_dest Ipv4 or Ipv6 of the destination. Optional
datetime_from Get the alerts that were occurred from this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default value is 7 days ago. Optional
datetime_to Get the alerts that were occurred up to this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default is now. Optional
probe_name The name of the jizo probe. Optional
page A page number for pagination. Optional
limit The maximum number of samples to display per alert. Optional

Context Output

Path Type Description
JizoM.Peers.alerts_flows.count Number The number of displayed alerts.
JizoM.Peers.alerts_flows.data String The details of alerts.
JizoM.Peers.alerts_flows.total Number The total number of alerts.
JizoM.Peers.alerts_files.count Number The number of displayed alerts.
JizoM.Peers.alerts_files.data String The details of alerts.
JizoM.Peers.alerts_files.total Number The total number of alerts.
JizoM.Peers.alerts_usecase.count Number The number of displayed alerts.
JizoM.Peers.alerts_usecase.data String The details of alerts.
JizoM.Peers.alerts_usecase.total Number The total number of alerts.

jizo-m-query-records-get


Retrieve all information available on Jizo M, mainly alerts.

Base Command

jizo-m-query-records-get

Input

Argument Name Description Required
ip_src Ipv4 or Ipv6 of the source. Optional
ip_dest Ipv4 or Ipv6 of the destination. Optional
proto The protocol. Possible values are: TCP, UDP, IP, IPSEC, ICMP, ARP. Optional
app_proto The application protocol. Possible values are: HTTP, HTTPS, FTP, DNS, DHCP, DCERPC, SMB, SMTP, SNMP, SSL, SSH, SIP, RDP, RFB, NFS, MQTT, MSN, MODBUS, IMAP, TFTP, KRBS. Optional
port_src The source port. Optional
port_dest The destination port. Optional
flow_id The id of the flow. Optional
sid The id of the rule. Optional
probe_name The name of the jizo probe. Optional
port The alert port. Optional
datetime_from Get the alerts that were occurred from this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default value is 7 days ago. Optional
datetime_to Get the alerts that were occurred up to this date, for example, “3 days ago”, “2020-01-01-00:00:00”. The default is now. Optional
page A page number for pagination. Optional
limit The maximum number of samples to display per alert. Optional

Context Output

Path Type Description
JizoM.QueryRecords.alerts_flows.count Number The number of displayed alerts.
JizoM.QueryRecords.alerts_flows.data String The details of alerts.
JizoM.QueryRecords.alerts_flows.total Number The total number of alerts.
JizoM.QueryRecords.alerts_files.count Number The number of displayed alerts.
JizoM.QueryRecords.alerts_files.data String The details of alerts.
JizoM.QueryRecords.alerts_files.total Number The total number of alerts.
JizoM.QueryRecords.alerts_usecase.count Number The number of displayed alerts.
JizoM.QueryRecords.alerts_usecase.data String The details of alerts.
JizoM.QueryRecords.alerts_usecase.total Number The total number of alerts.

Configuration parameters

  • credentials — Username (required)
  • url — Server URL. e.g., https://127.0.0.1:9001 (required)
  • isFetch — Fetch incidents
  • incidentType — Incident type
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings
  • incidentFetchInterval — Incidents Fetch Interval
  • first_fetch — First fetch time (<number> <time unit>, for example, 12 hours, 7 days, 3 months, 1 year)
  • max_fetch — Maximum number of alerts per fetch

Commands (3)

  • jizo-m-peers-get

    Get the list of IP addresses connected to a specific one.

  • jizo-m-protocols-get

    Get the list of alerts sorted by protocols.

  • jizo-m-query-records-get

    Retrieve all information available on Jizo M, mainly alerts.

import json

from JizoM import (
    Client,
    get_peers_command,
    get_protocols_command,
    get_query_records_command,
)

MOCK_URL = "http://123-fake-api.com"
client = Client(
    base_url=MOCK_URL,
    auth=("user_role", "fake_password"),
    verify=False,
    proxy=False,
)


def load_mock_response(file_name: str) -> dict:
    """
    Load mock file that simulates an API response.

    Args:
        file_name (str): Name of the mock response JSON file to return.

    Returns:
        dict: Mock file content.

    """
    with open(f"test_data/{file_name}") as f:
        return json.load(f)


def test_test_module(requests_mock):
    """
    To test test_module command when success response come.
    Given
        - A valid response
    When
        - The status code returned is 200
    Then
        - Ensure test module should return success
    """

    from JizoM import test_module

    requests_mock.get(f"{MOCK_URL}/ping", status_code=200)
    assert test_module(client) == "ok"


def test_get_token(requests_mock):
    """
    To test get_token command when success response come.
    Given
        - A valid response
    Then
        - Ensure get_token returns the token that will be required
        to get responses from other endpoints
    """

    from JizoM import get_token

    requests_mock.post(f"{MOCK_URL}/login", json=load_mock_response("connect.json"), status_code=200)
    result = get_token(client)
    assert "token" in result
    assert type(result["token"]) is str


def test_get_protocols_command(requests_mock):
    requests_mock.get(
        f"{MOCK_URL}/jizo_get_protocols",
        json=load_mock_response("protocols.json"),
    )
    response = get_protocols_command(client, {})
    assert len(response) == 3
    assert response[1].outputs_prefix == "JizoM.Protocols.alerts_files"
    assert response[1].outputs["total"]["total"] == 200000


def test_get_peers_command(requests_mock):
    requests_mock.get(
        f"{MOCK_URL}/jizo_get_peers",
        json=load_mock_response("peers.json"),
    )

    response = get_peers_command(client, {})
    assert response[2].outputs_prefix == "JizoM.Peers.alerts_usecase"
    assert "Probe_02" in response[2].outputs["data"]
    assert response[0].outputs["data"]["Probe_01"]["2919"][0]["protocol"] == "TLS"


def test_get_query_records_command(requests_mock):
    requests_mock.get(
        f"{MOCK_URL}/jizo_query_records",
        json=load_mock_response("query_records.json"),
    )

    response = get_query_records_command(client, {})
    assert len(response[0].outputs["data"]) == response[0].outputs["count"]
    assert response[0].outputs_prefix == "JizoM.QueryRecords.alerts_flows"
    assert "data" in response[0].outputs


def test_fetch_incidents(requests_mock):
    """
    To test fetch_incidents command when success response come.
    Given
        - A valid response
    Then
        - Ensure fetch_incidents returns the valid response
    """

    from JizoM import convert_to_demisto_severity, fetch_incidents, formatting_date

    requests_mock.get(f"{MOCK_URL}/jizo_query_records", json=load_mock_response("fetch_incidents.json"))
    next_run, incidents = fetch_incidents(client, max_results=2, last_run={}, first_fetch_time="2024-01-01")

    assert len(incidents) == 2
    assert incidents[0]["type"] == "Jizo Alert"
    raw_alert = json.loads(incidents[0]["rawJSON"])
    assert "295" in incidents[0]["name"]
    assert incidents[0]["severity"] == convert_to_demisto_severity(raw_alert["severity"])
    assert incidents[0]["occurred"] == formatting_date("2024-03-14 17:20:10.000000")
    assert "last_fetch" in next_run
    assert next_run["last_fetch"] == incidents[-1]["occurred"]
    assert 294 in next_run["last_ids"]
    assert next_run["first_fetched_ids"] == [295]