Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- from flask import render_template, redirect, url_for, flash
- from buvr import app
- @app.route("/")
- def index1():
- return render_template('first.html')
- @app.route("/single_units")
- def index2():
- return render_template('second.html')
- @app.route("/start_all")
- def start_all():
- host = '16.10.155.2'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index1'))
- @app.route("/stop_all")
- def stop_all():
- host = '16.10.155.2'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index1'))
- @app.route("/start3")
- def start3():
- host = '16.10.155.3'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
- @app.route("/start4")
- def start4():
- host = '16.10.155.4'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
- @app.route("/start5")
- def start5():
- host = '16.10.155.5'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
- @app.route("/start6")
- def start6():
- host = '16.10.155.6'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
- @app.route("/start7")
- def start7():
- host = '16.10.155.7'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
- @app.route("/start8")
- def start8():
- host = '16.10.155.8'
- user = 'bkc'
- secret = 'buvr2016'
- port = 30022
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(hostname=host, username=user, password=secret, port=port)
- stdin, stdout, stderr = client.exec_command('vlc -vvv --play-and-exit /home/buvr/sirena8.mp3')
- data = stdout.read() + stderr.read()
- client.close()
- flash("ok")
- return redirect(url_for('index2'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement