Dec-29-2018, 10:45 AM
So far i've this:
So far i've this: sudopass = Responder(pattern=r'Password:', response='admin__password\n') def su(connection, command) -> int: return connection.run(f"su -c '{command}'", pty=True, watchers=[sudopass]) with Connection('192.168.0.106', user="dssadmin", port=22, connect_kwargs={"password": "password"}) as ssh_connection: command = "uname -s" print("Response on {} is: {}".format(command, ssh_connection.run(command))) command = "whoami" print("Response on {} is: {}".format(command, ssh_connection.run(command))) command = "opkg update" print("Response on {} is after executing su command: {}".format(command, su(ssh_connection, command))) command = "opkg install rescue-utils" print("Response on {} is after executing su command: {}".format(command, su(ssh_connection, command))) command = "whoami" print("Response on {} is: {}".format(command, su(dss, command))) print("Script end")Not exactly what i needed but working fine