<?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: [Python] Whats the best way to get the password prompt in ExtremeSwitching (EXOS/Switch Engine)</title>
    <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33104#M6229</link>
    <description>No telnet allowed.  &lt;BR /&gt;
&lt;BR /&gt;
Here is what I've tried. &lt;BR /&gt;
&lt;BR /&gt;
getImage = "scp USER@XXXX:summitX-X.X.X-patchX.X.xos summitX-X.X.X-patchX.X.xos"&lt;BR /&gt;
&lt;BR /&gt;
exsh.clicmd(getImage)&lt;BR /&gt;
&lt;BR /&gt;
Now the switch starts the download. How do I get the PW propmpt or even give the script a password via an argument?</description>
    <pubDate>Wed, 29 Jun 2016 19:07:00 GMT</pubDate>
    <dc:creator>Radoje_Stojisic</dc:creator>
    <dc:date>2016-06-29T19:07:00Z</dc:date>
    <item>
      <title>[Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33100#M6225</link>
      <description>I am trying to make a little python script which is able to update the switches. However I am little confused by the "Getting started Python guide". Is there any option to let the python script enter the password for the remote connection ? &lt;BR /&gt;
&lt;BR /&gt;
Thanks </description>
      <pubDate>Wed, 29 Jun 2016 19:03:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33100#M6225</guid>
      <dc:creator>Radoje_Stojisic</dc:creator>
      <dc:date>2016-06-29T19:03:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33101#M6226</link>
      <description>I've made this conversation "public" since there is no private information.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2016 19:05:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33101#M6226</guid>
      <dc:creator>Drew_C</dc:creator>
      <dc:date>2016-06-29T19:05:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33102#M6227</link>
      <description>Thanks!&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2016 19:05:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33102#M6227</guid>
      <dc:creator>Radoje_Stojisic</dc:creator>
      <dc:date>2016-06-29T19:05:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33103#M6228</link>
      <description>Something like below ? &lt;BR /&gt;
       host=host&lt;BR /&gt;
        user=user&lt;BR /&gt;
        password=password&lt;BR /&gt;
        prompt=re.compile(r'\S+\d+\s[#&amp;gt;]\s')&lt;BR /&gt;
        loginprompt=r"login"&lt;BR /&gt;
        passwordprompt=r"assword"&lt;BR /&gt;
        failedlogin = r"Login incorrect"&lt;BR /&gt;
        connected = True&lt;BR /&gt;
        try:&lt;BR /&gt;
            tn = telnetlib.Telnet(host)&lt;BR /&gt;
            tn.set_debuglevel(0)&lt;BR /&gt;
            tn.read_until(loginprompt,10)&lt;BR /&gt;
            tn.write(user + "\n")&lt;BR /&gt;
            tn.expect([passwordprompt],10)&lt;BR /&gt;
            tn.write(password + "\n")&lt;BR /&gt;
            loginresponse = tn.expect([prompt,failedlogin])&lt;BR /&gt;
            if loginresponse[0] == 1:&lt;BR /&gt;
                print "Login failed"&lt;BR /&gt;
                connected = False&lt;BR /&gt;
                tn.close()&lt;BR /&gt;
            else:&lt;BR /&gt;
                tn.write("disable clipaging\n")&lt;BR /&gt;
                tn.expect([prompt])&lt;BR /&gt;
        except:&lt;BR /&gt;
            print "Could not connect to switch "+host&lt;BR /&gt;
            connected = False&lt;BR /&gt;
&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Jun 2016 19:07:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33103#M6228</guid>
      <dc:creator>OscarK</dc:creator>
      <dc:date>2016-06-29T19:07:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33104#M6229</link>
      <description>No telnet allowed.  &lt;BR /&gt;
&lt;BR /&gt;
Here is what I've tried. &lt;BR /&gt;
&lt;BR /&gt;
getImage = "scp USER@XXXX:summitX-X.X.X-patchX.X.xos summitX-X.X.X-patchX.X.xos"&lt;BR /&gt;
&lt;BR /&gt;
exsh.clicmd(getImage)&lt;BR /&gt;
&lt;BR /&gt;
Now the switch starts the download. How do I get the PW propmpt or even give the script a password via an argument?</description>
      <pubDate>Wed, 29 Jun 2016 19:07:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33104#M6229</guid>
      <dc:creator>Radoje_Stojisic</dc:creator>
      <dc:date>2016-06-29T19:07:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33105#M6230</link>
      <description>Did you consider using SSH with key-based authentication? This way you can execute any command on the switch without the need to enter a password, as long as the private key is available to the SSH client (usually using ssh-agent).</description>
      <pubDate>Wed, 29 Jun 2016 22:52:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33105#M6230</guid>
      <dc:creator>Erik_Auerswald</dc:creator>
      <dc:date>2016-06-29T22:52:00Z</dc:date>
    </item>
    <item>
      <title>RE: [Python] Whats the best way to get the password prompt</title>
      <link>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33106#M6231</link>
      <description>Another way to skin a cat. Telnet session to control VR will open although telnet is globally disabled. &lt;BR /&gt;
&lt;BR /&gt;
import subprocess&lt;BR /&gt;
import time&lt;BR /&gt;
&lt;BR /&gt;
p = subprocess.Popen(['telnet', '-v', '1', '127.0.0.1'], stdin = subprocess.PIPE)&lt;BR /&gt;
print &amp;gt;&amp;gt; p.stdin, 'admin'&lt;BR /&gt;
print &amp;gt;&amp;gt; p.stdin, '\n'&lt;BR /&gt;
print &amp;gt;&amp;gt; p.stdin, 'scp2 scpuser@10.0.0.1:bd8800-15.7.2.9.xos bd8800-15.7.2.9.xos'&lt;BR /&gt;
time.sleep(3)&lt;BR /&gt;
print &amp;gt;&amp;gt; p.stdin, 'scppw'&lt;BR /&gt;
time.sleep(60)&lt;BR /&gt;
p.terminate()&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Jun 2016 02:53:00 GMT</pubDate>
      <guid>https://community.extremenetworks.com/t5/extremeswitching-exos-switch/python-whats-the-best-way-to-get-the-password-prompt/m-p/33106#M6231</guid>
      <dc:creator>Kevin_Kim</dc:creator>
      <dc:date>2016-06-30T02:53:00Z</dc:date>
    </item>
  </channel>
</rss>

