from ssh.session import Session from ssh import options # Username für Login USERNAME= 'schueler' # Zielmaschine hier mikrotik HOST = '192.168.33.80' # Aufbau der ssh-Session s = Session() s.options_set(options.HOST, HOST) s.connect() # Login mit USERNAME s.userauth_agent(USERNAME) chan = s.channel_new() chan.open_session() chan.request_exec('ip address print') """ # Ausgabe der Antwort size, data = chan.read() while size > 0: print(data.strip()) size, data = chan.read() """ chan.request_exec('ip address add address=30.0.0.1/24 interface=ether3') chan.request_exec('ip address print') # Ausgabe der Antwort size, data = chan.read() while size > 0: print(data.strip()) size, data = chan.read() chan.close()