title: Paramiko and Palo Alto Networks Firewall
body: <p>I am a novice python user.</p>
  
  <p>I am trying to connect to Palo Alto Networks Firewall to execute some commands and get output with Paramiko. The simple script I have just to try how it works is as below:</p>
  
  <pre><code>import paramiko
  ssh = paramiko.SSHClient()
  ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  ssh.connect('1.1.1.1', port=22, username='admin', password='password')
  stdin, stdout, stderr = ssh.exec_command('show interface all')
  output = stdout.readlines()
  </code></pre>
  
  <p>I found that script hangs after execution and hence tried the same in IDLE and saw the the shell hangs after I execute "output = stdout.readlines()". I also tried a few configuration commands as below and nothing happens on the firewall - e.g. it doesn't change firewall hostname in this instance:</p>
  
  <pre><code>stdin, stdout, stderr = ssh.exec_command('configure')
  stdin, stdout, stderr = ssh.exec_command('set deviceconfig system hostname FW1')
  stdin, stdout, stderr = ssh.exec_command('commit')
  </code></pre>
  
  <p>The same script if used on a Linux machine works very well (e.g. ls -l) and gives output in a second but somehow just doesn't work on Palo Alto Networks Firewall. I have seen several videos on youtube where people are successfully able to configure and manage Cisco routers with this script but somehow it's not working in my case. For information this is what happens when I login to firewall manually:</p>
  
  <pre><code>machine1:SSH user1$ ssh admin@1.1.1.1
  Password:
  Last login: Tue Dec 11 15:39:08 2018 from 1.1.1.2
  This firewall is for authorized use only. Legal action will be taken against unauthorized users.
  Number of failed attempts since last successful login: 0
  
  
  admin@PA-VM&gt;
  </code></pre>
  
  <p>I'll appreciate some thoughts and help on this one. Thanks.</p>