def rotate(record, newpassword):
    user = record.login
    oldpassword = record.password

    result = False

    host = record.get('cmdr:host')

    try:
        s = pxssh.pxssh()
        s.login(host, user, oldpassword)
        s.sendline('passwd')
        i = s.expect(['[Oo]ld [Pp]assword', '.current.*password', '[Nn]ew [Pp]assword'])
        if i == 0 or i == 1:
            s.sendline(oldpassword)
            s.expect('[Nn]ew [Pp]assword')
        s.sendline(newpassword)
        s.expect("Retype New Password:")
        s.sendline(newpassword)
        s.prompt()

        pass_result = s.before

        if pass_result == b'\r\n':
            print('Password changed successfully')

            record.password = newpassword
            result = True
        else:
            print('Password change failed:')
            print(pass_result)

        s.logout()
    except exceptions.TIMEOUT as t:
        print("Timed out waiting for response.")
    except pxssh.ExceptionPxssh as e:
        print("Failed to login with ssh.")

    return result
Grab any required fields from the record
dataset/ETHPy150Open Keeper-Security/Commander/keepercommander/plugins/ssh/ssh.py/rotate