<?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: Automatization of Minemeld with API in General Topics</title>
    <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/247133#M97128</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/99860"&gt;@ITSCERT&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I think you have some issues with quoting in the python code. If you want to pass a string with the JSON&amp;nbsp;data encoded, it should look like (note the \\):&lt;/P&gt;
&lt;PRE&gt;'{"query": "{\\"operator\\":\\"all\\",\\"children\\":[{\\"field\\":\\"sample.malware\\",\\"operator\\":\\"is\\",\\"value\\":1},{\\"field\\":\\"sample.create_date\\",\\"operator\\":\\"is after\\",\\"value\\":[\\"2019-01-07\\",\\"2019-01-07\\"]}]}", "artifact_source": "af", "scope": "global"}'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Otherwise you can also pass the dictionary to requests and requests will encode it in json for you:&lt;/P&gt;
&lt;PRE&gt;query = {u'query': u'{"operator":"all","children":[{"field":"sample.malware","operator":"is","value":1},{"field":"sample.create_date","operator":"is after","value":["2019-01-07","2019-01-07"]}]}', u'artifact_source': u'af', u'scope': u'global'}&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Jan 2019 13:03:50 GMT</pubDate>
    <dc:creator>lmori</dc:creator>
    <dc:date>2019-01-23T13:03:50Z</dc:date>
    <item>
      <title>Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/244674#M97123</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Im trying to create node using "autofocus.sampleMiner" proto using API.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I try to get existing node config I get the following answer when I run /config/node/N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTTP/2 200&lt;BR /&gt;server: nginx/1.11.3&lt;BR /&gt;date: Wed, 02 Jan 2019 12:19:16 GMT&lt;BR /&gt;content-type: application/json&lt;BR /&gt;content-length: 227&lt;BR /&gt;expires: Wed, 02 Jan 2019 12:19:15 GMT&lt;BR /&gt;cache-control: no-cache&lt;BR /&gt;strict-transport-security: max-age=15724800; includeSubDomains; preload&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; "result": {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "af-miner",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "properties": {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "inputs": [],&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "output": true,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "prototype": "autofocus.samplesMiner"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "version": "e5c8dd3c-16b5-4dbf-9798-72f8XXXXXXX"&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to customize "autofocus query" parameter in order to create custom miners. Any option?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy new year.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 13:02:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/244674#M97123</guid>
      <dc:creator>AlexForeroITS</dc:creator>
      <dc:date>2019-01-02T13:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/244782#M97124</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just ran this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&lt;BR /&gt; "name": "My af miner",&lt;BR /&gt; "properties": {&lt;BR /&gt; "prototype": "autofocus.samplesMiner",&lt;BR /&gt; &lt;BR /&gt; "config": {&lt;BR /&gt; "attributes": {&lt;BR /&gt; "share_level": "red",&lt;BR /&gt; "confidence": "100"&lt;BR /&gt; &lt;BR /&gt; }&lt;BR /&gt; },&lt;BR /&gt; "output": true,&lt;BR /&gt; "query": {"operator":"all","children":[{"field":"sample.malware","operator":"is","value":1}]}&lt;BR /&gt; },&lt;BR /&gt; "version": "e5c8dd3c-16b5-4dbf-9798-XXXXXXXXXXX"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the node has been created sucessfully but now, I need to set a specific query, scope, and antifacts. Where should I&amp;nbsp;put them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance,&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 08:57:59 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/244782#M97124</guid>
      <dc:creator>ITSCERT</dc:creator>
      <dc:date>2019-01-03T08:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/245800#M97125</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/99860"&gt;@ITSCERT&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;there is a dedicated API to add what is called "side config", i.e. parameters read by the node at runtime. The query should be added using that API.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;PUT&amp;nbsp;https://&amp;lt;minemeld&amp;gt;/config/data/&amp;lt;miner-name&amp;gt;_side_config

{
"query":"{\"operator\":\"all\",\"children\":[{\"field\":\"sample.malware\",\"operator\":\"is\",\"value\":1},{\"field\":\"sample.create_date\",\"operator\":\"is after\",\"value\":[\"2019-01-07\",\"2019-01-07\"]}]}",
"scope":"global",
"artifact_source":"af"
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Jan 2019 18:44:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/245800#M97125</guid>
      <dc:creator>lmori</dc:creator>
      <dc:date>2019-01-13T18:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/246795#M97126</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I followed steps you detailed to me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) CreateNode running following cmds&lt;/P&gt;
&lt;P&gt;query = '{ "name": "My_af_miner2", "properties": { "prototype": "autofocus.samplesMiner", "config": { "attributes": { "share_level": "red", "confidence": "100" } }, "output": true }, "version": "9c3d9621xxxxxxxxx."&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; createNode = requests.post(URL+URI_STATUS, verify=False, auth=HTTPBasicAuth('Y, 'X'), headers={ "Content-Type": "application/json" }, data=query)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resp = createNode.json()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result is the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{'result': {'id': 87, 'version': '9c3d9621XXXXX0b-86ac-6XXXaa+0'}}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After create node, I verify that is correct on minemeld gui side. The only thing that needs are side_config params.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I run as you told me the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;URI_STATUS='/config/data/My_af_miner2_side_config'&lt;BR /&gt; query = '{ "query":"{\"operator\":\"all\",\"children\":[{\"field\":\"sample.malware\",\"operator\":\"is\",\"value\":1},{\"field\":\"sample.create_date\",\"operator\":\"is after\",\"value\":[\"2019-01-07\",\"2019-01-07\"]}]}", "scope":"global", "artifact_source":"af" }'&lt;BR /&gt; modifyNode = requests.put(URL+URI_STATUS, verify=False, auth=HTTPBasicAuth('y', 'x'), headers={ "Content-Type": "application/json" }, data=query)&lt;BR /&gt; resp = modifyNode.json()&lt;BR /&gt; print(resp)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the answer is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{'result': 'ok'}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the config of the minner has not changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried also to restart engine, but i got backoff error. Any other suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 14:21:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/246795#M97126</guid>
      <dc:creator>ITSCERT</dc:creator>
      <dc:date>2019-01-21T14:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/246838#M97127</link>
      <description>&lt;P&gt;hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/11678"&gt;@lmori&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After PUT what you told me to test, I receive ok, but the query is not set. If I restart engine, it fails and i need to delete node and commit&amp;nbsp; to make it working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance,&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 22:14:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/246838#M97127</guid>
      <dc:creator>ITSCERT</dc:creator>
      <dc:date>2019-01-21T22:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/247133#M97128</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/99860"&gt;@ITSCERT&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I think you have some issues with quoting in the python code. If you want to pass a string with the JSON&amp;nbsp;data encoded, it should look like (note the \\):&lt;/P&gt;
&lt;PRE&gt;'{"query": "{\\"operator\\":\\"all\\",\\"children\\":[{\\"field\\":\\"sample.malware\\",\\"operator\\":\\"is\\",\\"value\\":1},{\\"field\\":\\"sample.create_date\\",\\"operator\\":\\"is after\\",\\"value\\":[\\"2019-01-07\\",\\"2019-01-07\\"]}]}", "artifact_source": "af", "scope": "global"}'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Otherwise you can also pass the dictionary to requests and requests will encode it in json for you:&lt;/P&gt;
&lt;PRE&gt;query = {u'query': u'{"operator":"all","children":[{"field":"sample.malware","operator":"is","value":1},{"field":"sample.create_date","operator":"is after","value":["2019-01-07","2019-01-07"]}]}', u'artifact_source': u'af', u'scope': u'global'}&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Jan 2019 13:03:50 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/247133#M97128</guid>
      <dc:creator>lmori</dc:creator>
      <dc:date>2019-01-23T13:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatization of Minemeld with API</title>
      <link>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/247347#M97129</link>
      <description>&lt;P&gt;Solved!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/11678"&gt;@lmori&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 12:57:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/general-topics/automatization-of-minemeld-with-api/m-p/247347#M97129</guid>
      <dc:creator>ITSCERT</dc:creator>
      <dc:date>2019-01-24T12:57:28Z</dc:date>
    </item>
  </channel>
</rss>

