test_pam.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pam-typopw 作者: rchatterjee 项目源码 文件源码
def pytest_sessionstart(request):
    """ before session.main() is called. """
    import crypt, shutil
    pw = crypt.crypt(pws[0], 'ab')
    dbpath = os.path.join(SEC_DB_PATH, user)
    thisdir = os.path.dirname(os.path.abspath(__file__))
    if os.path.exists(dbpath):
        subprocess.Popen("sudo rm -rf {}".format(dbpath), shell=True)
    if DISTRO == 'darwin':
        subprocess.Popen(
            "sudo {2}/create_mac_user.sh {0} {1}"
            .format(user, pws[0], thisdir),
            shell=True
        )
    elif DISTRO == 'windows':
        print("WINDOWS: Ignoring!!")
    else:
        cmd = "sudo {2}/create_linux_user.sh {0} {1}".format(user, pw, thisdir),
        subprocess.Popen(
            cmd,
            shell=True
        )
        print("LINUX: {}".format(cmd))
    assert check(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号