def exec2():
child.expect('#')
if subprocess.getstatusoutput('id root >> /dev/null 2&1 && echo $?') != 0:
__newpasswd = 'edong&1310'
subprocess.getstatusoutput('useradd zach')
run('passwd zach',events={'(?i)password:':__newpasswd})
#TODO run EQUAL TO FOLLOW COMMIT!
'''
child.expect('password:')
child.sendline()
child.expect('password:')
child.sendline(__newpasswd)
'''
child.expect('#')
child.sendline('su - zach')
child.expect('$')
child.sendline('whomai')
评论列表
文章目录