當前位置: 首頁>>代碼示例>>Python>>正文


Python lsat.hLsarLookupNames方法代碼示例

本文整理匯總了Python中impacket.dcerpc.v5.lsat.hLsarLookupNames方法的典型用法代碼示例。如果您正苦於以下問題:Python lsat.hLsarLookupNames方法的具體用法?Python lsat.hLsarLookupNames怎麽用?Python lsat.hLsarLookupNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在impacket.dcerpc.v5.lsat的用法示例。


在下文中一共展示了lsat.hLsarLookupNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_hLsarLookupSids

# 需要導入模塊: from impacket.dcerpc.v5 import lsat [as 別名]
# 或者: from impacket.dcerpc.v5.lsat import hLsarLookupNames [as 別名]
def test_hLsarLookupSids(self):
        dce, rpctransport, policyHandle = self.connect()

        resp = lsat.hLsarLookupNames(dce, policyHandle, ('Administrator',))
        resp.dump()
        domainSid = resp['ReferencedDomains']['Domains'][0]['Sid'].formatCanonical()

        sids = list()
        for i in range(1000):
            sids.append(domainSid + '-%d' % (500+i))
        try:
            resp = lsat.hLsarLookupSids(dce, policyHandle, sids )
            resp.dump()
        except Exception, e:
            if str(e).find('STATUS_SOME_NOT_MAPPED') < 0:
                raise
            else:
                resp = e.get_packet()
                resp.dump() 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:21,代碼來源:test_lsat.py

示例2: get_sid

# 需要導入模塊: from impacket.dcerpc.v5 import lsat [as 別名]
# 或者: from impacket.dcerpc.v5.lsat import hLsarLookupNames [as 別名]
def get_sid(self, name):
		self.log.info('[*] Looking up SID for {0}..'.format(name))
		stringbinding = r'ncacn_np:{0}[\pipe\lsarpc]'.format(self.target)
		logging.debug('StringBinding {0}'.format(stringbinding))
		rpctransport = transport.DCERPCTransportFactory(stringbinding)
		rpctransport.set_dport(self.port)
		rpctransport.setRemoteHost(self.target)

		if hasattr(rpctransport, 'set_credentials'):
			rpctransport.set_credentials(self.username, self.password, self.domain)

		dce = rpctransport.get_dce_rpc()
		dce.connect()
		dce.bind(lsat.MSRPC_UUID_LSAT)
		resp = lsad.hLsarOpenPolicy2(dce, MAXIMUM_ALLOWED | lsad.POLICY_LOOKUP_NAMES)
		policyHandle = resp['PolicyHandle']
		resp = lsat.hLsarLookupNames(dce, policyHandle, (name,))
		self.rid = resp['TranslatedSids']['Sids'][0]['RelativeId']
		dce.disconnect()
		return 
開發者ID:Gilks,項目名稱:enumerid,代碼行數:22,代碼來源:enumerid.py

示例3: test_hLsarLookupSids

# 需要導入模塊: from impacket.dcerpc.v5 import lsat [as 別名]
# 或者: from impacket.dcerpc.v5.lsat import hLsarLookupNames [as 別名]
def test_hLsarLookupSids(self):
        dce, rpctransport, policyHandle = self.connect()

        resp = lsat.hLsarLookupNames(dce, policyHandle, ('Administrator',))
        resp.dump()
        domainSid = resp['ReferencedDomains']['Domains'][0]['Sid'].formatCanonical()

        sids = list()
        for i in range(1000):
            sids.append(domainSid + '-%d' % (500+i))
        try:
            resp = lsat.hLsarLookupSids(dce, policyHandle, sids )
            resp.dump()
        except Exception as e:
            if str(e).find('STATUS_SOME_NOT_MAPPED') < 0:
                raise
            else:
                resp = e.get_packet()
                resp.dump() 
開發者ID:Coalfire-Research,項目名稱:Slackor,代碼行數:21,代碼來源:test_lsat.py

示例4: test_hLsarLookupNames

# 需要導入模塊: from impacket.dcerpc.v5 import lsat [as 別名]
# 或者: from impacket.dcerpc.v5.lsat import hLsarLookupNames [as 別名]
def test_hLsarLookupNames(self):
        dce, rpctransport, policyHandle = self.connect()

        resp = lsat.hLsarLookupNames(dce, policyHandle, ('Administrator', 'Guest'))
        resp.dump() 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:7,代碼來源:test_lsat.py

示例5: test_hLsarLookupSids2

# 需要導入模塊: from impacket.dcerpc.v5 import lsat [as 別名]
# 或者: from impacket.dcerpc.v5.lsat import hLsarLookupNames [as 別名]
def test_hLsarLookupSids2(self):
        dce, rpctransport, policyHandle = self.connect()

        resp = lsat.hLsarLookupNames(dce, policyHandle, ('Administrator',))
        resp.dump()
        domainSid = resp['ReferencedDomains']['Domains'][0]['Sid'].formatCanonical()
        sids = list()
        sids.append(domainSid + '-500')
        sids.append(domainSid + '-501')
        resp = lsat.hLsarLookupSids2(dce, policyHandle, sids)
        resp.dump() 
開發者ID:joxeankoret,項目名稱:CVE-2017-7494,代碼行數:13,代碼來源:test_lsat.py


注:本文中的impacket.dcerpc.v5.lsat.hLsarLookupNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。