Professional Documents
Culture Documents
App Permettant D'arrêter Ou Démarrer Ou Redémarrer Les Équipements Réseaux Avec Python
App Permettant D'arrêter Ou Démarrer Ou Redémarrer Les Équipements Réseaux Avec Python
import getpass
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
return ssh_client
output = stdout.read().decode()
error = stderr.read().decode()
if error:
print(f"Error: {error}")
else:
print(output)
def main():
while True:
if choice == "1":
execute_command(ssh_client, "start_command_here")
elif choice == "2":
execute_command(ssh_client, "stop_command_here")
execute_command(ssh_client, "restart_command_here")
break
else:
ssh_client.close()
if __name__ == "__main__":
main()