<?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: Introducing pyldfire - An easy-to-use Python module for the Wildfire API in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/112289#M1261</link>
    <description>&lt;P&gt;Thanks for the splunk and officialy python API links.&lt;/P&gt;</description>
    <pubDate>Sun, 11 Sep 2016 13:06:54 GMT</pubDate>
    <dc:creator>pulukas</dc:creator>
    <dc:date>2016-09-11T13:06:54Z</dc:date>
    <item>
      <title>Introducing pyldfire - An easy-to-use Python module for the Wildfire API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/84006#M1235</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While reading over the documentation for the WildFire API, I created this Python module for it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Features&lt;/H2&gt;
&lt;UL&gt;
&lt;LI&gt;Python 2 and 3 support&lt;/LI&gt;
&lt;LI&gt;Returns native Python objects&lt;/LI&gt;
&lt;LI&gt;Raises exceptions on API errors with error details&lt;/LI&gt;
&lt;LI&gt;Supports HTTPS proxies and SSL/TLS validation&lt;/LI&gt;
&lt;LI&gt;Supports WildFire cloud or appliance&lt;/LI&gt;
&lt;LI&gt;Supports all WildFire 7.1 API calls
&lt;UL&gt;
&lt;LI&gt;Uploading sample files and URLs&lt;/LI&gt;
&lt;LI&gt;Getting verdicts&lt;/LI&gt;
&lt;LI&gt;Getting full reports in PDF or dictionary formats&lt;/LI&gt;
&lt;LI&gt;Getting samples&lt;/LI&gt;
&lt;LI&gt;Getting PCAPs&lt;/LI&gt;
&lt;LI&gt;Getting a malware test file&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I hope others find it useful. All feedback is welcome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PyPI: &lt;A href="https://pypi.python.org/pypi/pyldfire" target="_blank"&gt;https://pypi.python.org/pypi/pyldfire&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;GitHub: &lt;A href="https://github.com/seanthegeek/pyldfire" target="_blank"&gt;https://github.com/seanthegeek/pyldfire&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Installing&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;$ sudo pip install pyldfire&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Examples&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;from pprint import PrettyPrinter
from io import BytesIO

from pyldfire import WildFire

printer = PrettyPrinter(indent=2)

wildfire = WildFire("api-key-goes-here")

# Submit a local file
with open("malware", "rb") as sample_file:
    results = wildfire.submit_file(sample_file)
printer.pprint(results)

# File Hashes can be MD5,SHA1, or SHA256
file_hash = "419251150a2f77422efa1e016d605d69"

# Download a sample to a file
with open("sample", "wb") as sample_file:
    sample_file.write(wildfire.get_sample(file_hash))

# Or keep it as a file-like object in memory instead
sample = BytesIO(wildfire.get_sample(file_hash))

# Same for PCAPs and PDF reports

# Get a verdict
verdict = wildfire.get_verdicts([file_hash])

# Get analysis results
results = wildfire.get_report(file_hash)

# Test your firewall
wildfire.get_malware_test_file()&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;DIV id="pyldfire-wildfire-methods"&gt;
&lt;H2&gt;pyldfire.WildFire methods&lt;/H2&gt;
&lt;P&gt;&lt;TT&gt;__init__(self, api_key, &lt;SPAN class="pre"&gt;host='wildfire.paloaltonetworks.com',&lt;/SPAN&gt; proxies=None, verify=True)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Initializes the WildFire class&lt;/P&gt;
&lt;PRE&gt;Args:
    api_key (str): A WildFire API Key
    host (str): The hostname of the WildFire service or appliance
    proxies (dict): An optional dictionary containing proxy data,
    with https as the key, and the proxy path as the value
    verify (bool): Verify the certificate
    verify (str): A path to a CA cert bundle
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_malware_test_file(self)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets a unique, benign malware test file that will trigger an alert on Palo Alto Networks’ firewalls&lt;/P&gt;
&lt;PRE&gt;Returns:
    bytes: A malware test file
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_pcap(self, file_hash, platform=None)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets a PCAP from a sample analysis&lt;/P&gt;
&lt;PRE&gt;Args:
    file_hash (str): A hash of a sample
    platform (int): One of the following integers:

    1: Windows XP, Adobe Reader 9.3.3, Office 2003
    2: Windows XP, Adobe Reader 9.4.0, Flash 10, Office 2007
    3: Windows XP, Adobe Reader 11, Flash 11, Office 2010
    4: Windows 7 32-bit, Adobe Reader 11, Flash 11, Office 2010
    5: Windows 7 64bit, Adobe Reader 11, Flash 11, Office 2010
    50: Mac OS X Mountain Lion
    201: Android 2.3, API 10, avd2.3.

Returns:
    bytes: The PCAP

Raises:
     WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_pdf_report(self, file_hash)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets analysis results as a PDF&lt;/P&gt;
&lt;PRE&gt;Args:
    file_hash: A hash of a sample of a file

Returns:
    bytes: The PDF

Raises:
     WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_report(self, file_hash)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets analysis results as structured data&lt;/P&gt;
&lt;PRE&gt;Args:
    file_hash (str): A hash of a sample

Returns:
    dict: Analysis results

Raises:
        WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_sample(self, file_hash)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets a sample file&lt;/P&gt;
&lt;PRE&gt;Args:
    file_hash (str): A hash of a sample

Returns:
    bytes: The sample

Raises:
        WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;get_verdicts(self, file_hashes)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Gets the verdict for one or more samples&lt;/P&gt;
&lt;PRE&gt;Args:
       file_hashes (list): A list of file hash strings
       file_hashes (str): A single file hash

   Returns:
       str: If a single file hash is passed, a string containing the verdict
       list: If multiple hashes a passed, a list of corresponding list of verdict strings

       Possible values:

       'Benign'
       'Malware'
       'Greyware'
       'Pending`
       'Error'
       'Not found`

   Raises:
       WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;submit_file(self, file_obj, &lt;SPAN class="pre"&gt;filename="sample")&lt;/SPAN&gt;&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Submits a file to WildFire for analysis&lt;/P&gt;
&lt;PRE&gt;Args:
       file_obj (file): The file to send
       filename (str): An optional filename

   Returns:
       dict: Analysis results

   Raises:
        WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;submit_remote_file(self, url)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Submits a file from a remote URL for analysis&lt;/P&gt;
&lt;PRE&gt;Args:
       url (str): The URL where the file is located

   Returns:
       dict: Analysis results

   Raises:
        WildFireException: If an API error occurs

   Notes:
       This is for submitting files located at remote URLs, not web pages.

   See Also:
       submit_urls(self, urls)
&lt;/PRE&gt;
&lt;P&gt;&lt;TT&gt;submit_urls(self, urls)&lt;/TT&gt;&lt;/P&gt;
&lt;P&gt;Submits one or more URLs to a web page for analysis&lt;/P&gt;
&lt;PRE&gt;Args:
       urls (str): A single URL
       urls (list): A list of URLs

   Returns:
       dict: If a single URL is passed, a dictionary of analysis results
       list: If multiple URLs are passed, a list of corresponding dictionaries containing analysis results

   Raises:
        WildFireException: If an API error occurs
&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2016 17:54:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/84006#M1235</guid>
      <dc:creator>Sean.Whalen</dc:creator>
      <dc:date>2016-06-12T17:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Introducing pyldfire - An easy-to-use Python module for the Wildfire API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/110779#M1259</link>
      <description>&lt;P&gt;pretty sad that there is no official package from PaloAlto that works.&lt;/P&gt;&lt;P&gt;(or splunk app for that matter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 09:26:00 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/110779#M1259</guid>
      <dc:creator>mmonitz</dc:creator>
      <dc:date>2016-09-06T09:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Introducing pyldfire - An easy-to-use Python module for the Wildfire API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/110928#M1260</link>
      <description>&lt;P&gt;Great job! &amp;nbsp;Thanks for offering up this library to the community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46845"&gt;@mmonitz&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;pretty sad that there is no official package from PaloAlto that works.&lt;/P&gt;&lt;P&gt;(or splunk app for that matter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The official package developed within Palo Alto Networks for Wildfire (and PAN-OS and Autofocus) is called pan-python:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/kevinsteves/pan-python" target="_blank"&gt;https://github.com/kevinsteves/pan-python&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pypi.python.org/pypi/pan-python/" target="_blank"&gt;https://pypi.python.org/pypi/pan-python/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pan-python is lower level API access and often makes a good dependency for a higher level library like the one posted here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The official Splunk App developed by Palo Alto Networks is here:&lt;/P&gt;&lt;P&gt;App: &amp;nbsp;&lt;A href="https://splunkbase.splunk.com/app/491/" target="_blank"&gt;https://splunkbase.splunk.com/app/491/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Add-on: &amp;nbsp;&lt;A href="https://splunkbase.splunk.com/app/2757/" target="_blank"&gt;https://splunkbase.splunk.com/app/2757/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 16:02:07 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/110928#M1260</guid>
      <dc:creator>btorresgil</dc:creator>
      <dc:date>2016-09-06T16:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Introducing pyldfire - An easy-to-use Python module for the Wildfire API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/112289#M1261</link>
      <description>&lt;P&gt;Thanks for the splunk and officialy python API links.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2016 13:06:54 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/112289#M1261</guid>
      <dc:creator>pulukas</dc:creator>
      <dc:date>2016-09-11T13:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Introducing pyldfire - An easy-to-use Python module for the Wildfire API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/118481#M1272</link>
      <description>&lt;P&gt;Nice work! Thank you for the contribution!&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 17:48:41 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/introducing-pyldfire-an-easy-to-use-python-module-for-the/m-p/118481#M1272</guid>
      <dc:creator>scottdware</dc:creator>
      <dc:date>2016-10-07T17:48:41Z</dc:date>
    </item>
  </channel>
</rss>

