Шрек
Шрек

Reputation: 1

Wexpect ssh authorization script

I have this code and it is not outputing anything and is not running the script

import wexpect
import sys



child = wexpect.spawn("ssh user@ip")
child.logfile = sys.stdout
child.expect("user@ip's password:")
child.logfile = sys.stdout
child.sendline('user_password')
child.logfile = sys.stdout
child.expect('$')
child.logfile = sys.stdout
child.sendline('sudo su')
child.logfile = sys.stdout

I have tried everything, red the docs, but it is still not working

Upvotes: 0

Views: 39

Answers (0)

Related Questions