Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import spur
- import spur.ssh
- ip="162.248.73.66"
- user="tiger"
- passwd="123"
- try:
- shell = spur.SshShell(
- hostname=ip,
- username=user,
- password=passwd,
- missing_host_key=spur.ssh.MissingHostKey.accept,
- shell_type=spur.ssh.ShellTypes.minimal
- )
- with shell:
- result = shell.run(["sh", "-c", "killall x-terminal-emulator"])
- print(result.return_code)
- result = shell.run(["sh", "-c", "rm -rf /home/tiger/scoops"])
- print(result.return_code)
- result = shell.run(["sh", "-c", "git clone https://github.com/antfuentes87/scoops.git"])
- print(result.return_code)
- result = shell.run(["sh", "-c", "chmod u+x /home/tiger/scoops/scoop.sh"])
- print(result.return_code)
- result = shell.spawn(["sh", "-c", "export DISPLAY=:0; x-terminal-emulator -e /home/tiger/scoops/scoop.sh"])
- # print(result.return_code)
- except spur.ssh.ConnectionError as error:
- print error.original_traceback
- raise
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement