예제 #1
0
def test_Token_unimpersonate():
    hToken = win32security.LogonUser("alice", "", "Passw0rd",
                                     win32security.LOGON32_LOGON_NETWORK,
                                     win32security.LOGON32_PROVIDER_DEFAULT)
    win32security.ImpersonateLoggedOnUser(_tokens.Token(hToken).pyobject())
    assert _tokens.token().Owner.pyobject() == alice
    win32security.RevertToSelf()
    assert _tokens.token().Owner.pyobject() == me
예제 #2
0
파일: test_tokens.py 프로젝트: hashar/WAPT
def test_Token_unimpersonate ():
  hToken = win32security.LogonUser (
    "alice",
    "",
    "Passw0rd",
    win32security.LOGON32_LOGON_NETWORK,
    win32security.LOGON32_PROVIDER_DEFAULT
  )
  win32security.ImpersonateLoggedOnUser (_tokens.Token (hToken).pyobject ())
  assert _tokens.token ().Owner.pyobject () == alice
  win32security.RevertToSelf ()
  assert _tokens.token ().Owner.pyobject () == me
예제 #3
0
 def test_Token_unimpersonate(self):
     hToken = win32security.LogonUser(
         "alice",
         "",
         "Passw0rd",
         win32security.LOGON32_LOGON_NETWORK,
         win32security.LOGON32_PROVIDER_DEFAULT
     )
     me = _tokens.token().Owner.pyobject()
     win32security.ImpersonateLoggedOnUser(_tokens.Token(hToken).pyobject())
     self.assertEquals(_tokens.token().Owner.pyobject(), self.alice)
     win32security.RevertToSelf()
     self.assertEquals(_tokens.token().Owner.pyobject(), me)
예제 #4
0
 def test_Token_dump(self):
     #
     # This is a bit crude, but we're hoping to exercise all of the
     # token attributes this way.
     #
     dumped = _tokens.token().dumped(0)
예제 #5
0
 def test_token_default(self):
     assert _tokens.token().Statistics['AuthenticationId'] == win32security.GetTokenInformation(self.token0, win32security.TokenStatistics)['AuthenticationId']
     assert _tokens.token().Origin == win32security.GetTokenInformation(self.token0, win32security.TokenOrigin)
예제 #6
0
 def test_token_None(self):
     assert _tokens.token(None) is None