Advertisement
Guest User

Untitled

a guest
Jan 8th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import spur
  2. import spur.ssh
  3.  
  4. ip="162.248.73.66"
  5. user="tiger"
  6. passwd="123"
  7.  
  8. try:
  9. shell = spur.SshShell(
  10. hostname=ip,
  11. username=user,
  12. password=passwd,
  13. missing_host_key=spur.ssh.MissingHostKey.accept,
  14. shell_type=spur.ssh.ShellTypes.minimal
  15. )
  16. with shell:
  17. result = shell.run(["sh", "-c", "killall x-terminal-emulator"])
  18. print(result.return_code)
  19.  
  20. result = shell.run(["sh", "-c", "rm -rf /home/tiger/scoops"])
  21. print(result.return_code)
  22.  
  23. result = shell.run(["sh", "-c", "git clone https://github.com/antfuentes87/scoops.git"])
  24. print(result.return_code)
  25.  
  26. result = shell.run(["sh", "-c", "chmod u+x /home/tiger/scoops/scoop.sh"])
  27. print(result.return_code)
  28.  
  29. result = shell.spawn(["sh", "-c", "export DISPLAY=:0; x-terminal-emulator -e /home/tiger/scoops/scoop.sh"])
  30. # print(result.return_code)
  31. except spur.ssh.ConnectionError as error:
  32. print error.original_traceback
  33. raise
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement