GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ssh_python/ssh_python.py at main · camara94/ssh_python Expand file tree/ Copy pathssh_python.pyMore file actions 31 lines (27 loc) · 954 Bytes / Copy pathssh_python.pyFile metadata and controls31 lines (27 loc) · 954 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #! /usr/local/Python_envs/Python3/bin/python3 import paramiko import time from getpass import getpass import re host = "ip or hostname" username = "your username" password = "your password" print(f"\n{'#' * 55}\nConnecting to the Device {host}\n{'#' * 55} ") SESSION = paramiko.SSHClient() SESSION.set_missing_host_key_policy(paramiko.AutoAddPolicy()) SESSION.connect(host, port=22, username=username, password=password, look_for_keys=False, allow_agent=False) DEVICE_ACCESS = SESSION.invoke_shell() # somme command to execute on my server # I change current directory to monapi directory on my server DEVICE_ACCESS.send(b'cd /var/www/monapi\n') # I print all files and sub directory to monapi DEVICE_ACCESS.send(b'ls -la\n') time.sleep(1) output = (DEVICE_ACCESS.recv(65000).decode('ascii')) print(output) print(f"\n{'#' * 55}\nFinished Executing Script\n{'#' * 55} ") SESSION.close() |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |