Example #1
0
def test_user_from_binary(user_bin):
    assert user_bin.username == "naota"
    assert user_bin.user_rid == 1000
    assert user_bin.pass_last_set_time == datetime(2013, 12, 29, 1, 17, 28)
    assert user_bin.domain == "KEYAKI"
    assert user_bin.group_rid == 513
    assert user_bin.lm_pw == ""
    assert user_bin.nt_pw == nthash('hoge').decode("hex")
Example #2
0
def test_change_password():
    copyfile(DB_ORIGIN, DB_FILE)
    pdb = PassDB(DB_FILE)
    user = pdb["naota"]
    user.set_password("hogefuga")
    pdb["naota"] = user
    pdb.close()
    db = tdb.open(DB_FILE)
    assert unpack_user(db["USER_naota\x00"]).nt_pw == \
        nthash("hogefuga").decode("hex")
    db.close()
Example #3
0
def test_user_passwd(user):
    user.set_password("hogefuga")
    assert user.nt_pw == nthash("hogefuga").decode("hex")
Example #4
0
def test_hash_is_same():
    assert nthash("hoge") == smbpasswd.nthash("hoge")