<?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: Paramiko with PaloAlto in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131461#M1313</link>
    <description>&lt;P&gt;Yes it is possible to log into the Palo Alto using&amp;nbsp;Paramiko, as long as you get all the timing and everything correct.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2016 14:31:40 GMT</pubDate>
    <dc:creator>jpackham</dc:creator>
    <dc:date>2016-12-06T14:31:40Z</dc:date>
    <item>
      <title>Paramiko with PaloAlto</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131016#M1312</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to Python scripting and have started to learn through my lab PaloAlto Firewall.&lt;/P&gt;&lt;P&gt;I wrote a basic script to just return me the output of an operational command. This script works on my lab SRX but hangs on the PaloAlto.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code snippet : (indentation is correct)&lt;/P&gt;&lt;P&gt;root# vi PAoutTest.py&lt;/P&gt;&lt;P&gt;#!/usr/bin/python&lt;/P&gt;&lt;P&gt;import paramiko&lt;BR /&gt;import time&lt;BR /&gt;import inspect&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ssh = paramiko.SSHClient()&lt;/P&gt;&lt;P&gt;ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())&lt;/P&gt;&lt;P&gt;timeout = 30&lt;/P&gt;&lt;P&gt;endtime = time.time() + timeout&lt;/P&gt;&lt;P&gt;iin = paramiko.sys.stdin&lt;BR /&gt;out = paramiko.sys.stdout&lt;BR /&gt;err = paramiko.sys.stderr&lt;/P&gt;&lt;P&gt;ssh.connect("x.x.x.x",username="xxxxx",password="xxxx")&lt;/P&gt;&lt;P&gt;iin, out, err = ssh.exec_command("show clock")&lt;/P&gt;&lt;P&gt;print out&lt;BR /&gt;#print out.read()&lt;/P&gt;&lt;P&gt;while not out.channel.eof_received:&lt;BR /&gt;time.sleep(1)&lt;BR /&gt;if time.time() &amp;gt; endtime:&lt;BR /&gt;out.channel.close()&lt;BR /&gt;break&lt;BR /&gt;print out.read()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included a while loop because without it the script would just hang forever and I have to manually kill the process.&lt;/P&gt;&lt;P&gt;So after the while loop the script times out without providing any output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this not possible with PaloAlto or only way to automate is via API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Dec 2016 21:27:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131016#M1312</guid>
      <dc:creator>Mohit</dc:creator>
      <dc:date>2016-12-04T21:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Paramiko with PaloAlto</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131461#M1313</link>
      <description>&lt;P&gt;Yes it is possible to log into the Palo Alto using&amp;nbsp;Paramiko, as long as you get all the timing and everything correct.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 14:31:40 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131461#M1313</guid>
      <dc:creator>jpackham</dc:creator>
      <dc:date>2016-12-06T14:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Paramiko with PaloAlto</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131462#M1314</link>
      <description>&lt;P&gt;I use this instead of using exec, I believe exec is only able to run one command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;channel = ssh.invoke_shell()&lt;BR /&gt;output = channel.recv(10000)&lt;BR /&gt;print output&lt;BR /&gt;print "connected to device"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;channel.send('show interface all\n')&lt;BR /&gt;output3 = channel.recv(1000000)&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 14:36:37 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/paramiko-with-paloalto/m-p/131462#M1314</guid>
      <dc:creator>jpackham</dc:creator>
      <dc:date>2016-12-06T14:36:37Z</dc:date>
    </item>
  </channel>
</rss>

