<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fetch Indicator Integration in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/591150#M3431</link>
    <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/211967"&gt;@AbelSantamarina&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I did this, as you can see here&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBoehm_0-1720073167418.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/60663iAFB8B35701250203/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JBoehm_0-1720073167418.png" alt="JBoehm_0-1720073167418.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;its a grid field type indicator field on our IP indicators. However i can't just append the key to IP object because the error i mentioned in the inital post.&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Exception: Failed to execute fetch-indicators command. Error: 'IP' object does not support item assignment"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;To create the mapping is basically my question, how do i do this? If i look in the common server python file on github, i cant see a way to fill up customFields to an indicator on creation. But there is no command which would update an indicator from an integration script.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBoehm_1-1720073447020.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/60664iF6724C0C0E8DE1A7/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JBoehm_1-1720073447020.png" alt="JBoehm_1-1720073447020.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So even if i would create the Indicator, then search it and add my custom field. I wouldnt be able to update the Indicator.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 06:11:39 GMT</pubDate>
    <dc:creator>JBoehm</dc:creator>
    <dc:date>2024-07-04T06:11:39Z</dc:date>
    <item>
      <title>Fetch Indicator Integration</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/590899#M3417</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i plan to implement a custom integration which fetches IP Indicators. So far so good i was able to create the indicators with no issue. However i would like to update some fields eg. Hostname and also some custom fields like a Gridfield of Vulnerabilities.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But for some reason i can't update any field by side the verdict.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thats my function:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;def fetch_indicators(client: Client, reportName: str, firstFetch: str = '3 days'):
    indicators = []
    last_run = demisto.getLastRun()
    if not last_run:
        last_run = {}
    if 'scan_id' not in last_run:
        # get timestamp in seconds
        last_id = 0
    else:
        last_id = int(last_run['scan_id'])

    demisto.debug(f"Looking for scans since ID:{last_id}")
    scans = client.list_scans()["response"]
    scans = sorted(get_elements(scans, "true"), key=lambda x: x['id'], reverse=True)

    if len(scans) == 0 or int(scans[0]['id']) &amp;lt;= last_id:
        # scan id is same or lower as the last run (lower shouldn't apear at all tbh)
        # however we can skip this run
        demisto.debug(f"Didn't found a new ID doing nothing. {last_id=}, max_id={scans[0]['id']}, lowest_id={scans[-1]['id']}")
        return

    demisto.debug(f"found a new scan since last update. downloading the report")
    results = client.download_report(scans[0]['id'])
    #loop over all rows of the report. it contains each vuln for each ip, so we need a dict where we can access the ip easily.
    vulns = {}
    for r in results:
        if r["IP Address"] not in vulns:
            vulns[r["IP Address"]] = []
        vulns[r["IP Address"]].append({
            "Name": r["Plugin Name"], # use Value
            "Severity": r["Severity"], # use Severity
            "Solution": r["Solution"], # use Solution
            "Descirption": r["Description"], # use short description
            "CVEs": r["CVE"].split(","), # new
            "CVSS Score": r["CVSS V3 Base Score"], # use CVSS Score
            "CVSS Vector": r["CVSS V3 Vector"], # use CVSS Vectore
            "CVSS Version": "V3", # use CVSS Version
            "Exploitable": r["Exploit?"], # new
            "Discovered": r["First Discovered"], #new
            "LastObserved": r["Last Observed"], #new
            "Synopsis": r["Synopsis"], #new
            "FurtherInfo": r["See Also"] #new
        })

    demisto.debug("Vulnerabilites mapped to the IPs")
    demisto.debug(json.dumps(vulns))
    indicators = generate_indicator(vulns)
    demisto.debug("Vulns converted to IP indicators")
    demisto.setLastRun({'scan_id': int(scans[0]['id'])})
    for b in batch(indicators, batch_size=2000):
        demisto.createIndicators(b)
    demisto.debug("Should have created new IP indicators")



def generate_indicator(vulns: Dict[str, any]):
    integration_name = get_integration_name()
    ips = []
    for ip in vulns:
        score = Common.DBotScore(indicator=ip, indicator_type=DBotScoreType.IP, integration_name="Tenable.sc", score=0)
        ip_obj = Common.IP(ip=ip,hostname="TenableIP",updated_date=datetime.now(),dbot_score=score)
        ip_obj["customFields"] = {'vulnerabilityinformations': vulns[ip]}
        ips.append(ip_obj)

    demisto.debug(f"Final Indciator Objects: {json.dumps(ips)}")
    return ips
&lt;/LI-CODE&gt;
&lt;P&gt;currently i get the error message &lt;BR /&gt;"&lt;SPAN&gt;Exception: Failed to execute fetch-indicators command. Error: 'IP' object does not support item assignment"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thats because i assign just the ["customFields"] key in the IP Object.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Does anybody has done this?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Yes, i know that there is a Tenanble.sc Integration, however this default integration don't offers the option to fetch indicators.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Greetings&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 08:25:11 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/590899#M3417</guid>
      <dc:creator>JBoehm</dc:creator>
      <dc:date>2024-07-02T08:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Indicator Integration</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/591057#M3425</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/266669"&gt;@JBoehm&lt;/a&gt;, you will need to create first a new indicator field called&amp;nbsp;&lt;STRONG&gt;vulnerabilityinformations&lt;/STRONG&gt;&amp;nbsp;and then add it as a custom field to the IP indicator type in the indicator type profile settings (&lt;A href="https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Indicator-type-profile" target="_blank"&gt;https://docs-cortex.paloaltonetworks.com/r/Cortex-XSOAR/8/Cortex-XSOAR-Cloud-Documentation/Indicator-type-profile&lt;/A&gt;). Once it's there, you should be able to create the mapping to the field&amp;nbsp;&lt;STRONG&gt;vulnerabilityinformations&lt;/STRONG&gt; in your code.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2024 14:48:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/591057#M3425</guid>
      <dc:creator>AbelSantamarina</dc:creator>
      <dc:date>2024-07-03T14:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch Indicator Integration</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/591150#M3431</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/211967"&gt;@AbelSantamarina&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I did this, as you can see here&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBoehm_0-1720073167418.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/60663iAFB8B35701250203/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JBoehm_0-1720073167418.png" alt="JBoehm_0-1720073167418.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;its a grid field type indicator field on our IP indicators. However i can't just append the key to IP object because the error i mentioned in the inital post.&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Exception: Failed to execute fetch-indicators command. Error: 'IP' object does not support item assignment"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;To create the mapping is basically my question, how do i do this? If i look in the common server python file on github, i cant see a way to fill up customFields to an indicator on creation. But there is no command which would update an indicator from an integration script.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBoehm_1-1720073447020.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/60664iF6724C0C0E8DE1A7/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="JBoehm_1-1720073447020.png" alt="JBoehm_1-1720073447020.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So even if i would create the Indicator, then search it and add my custom field. I wouldnt be able to update the Indicator.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 06:11:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/fetch-indicator-integration/m-p/591150#M3431</guid>
      <dc:creator>JBoehm</dc:creator>
      <dc:date>2024-07-04T06:11:39Z</dc:date>
    </item>
  </channel>
</rss>

