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


Python scmr.DCERPCException方法代碼示例

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


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

示例1: isAdmin

# 需要導入模塊: from impacket.dcerpc.v5 import scmr [as 別名]
# 或者: from impacket.dcerpc.v5.scmr import DCERPCException [as 別名]
def isAdmin(self):
        rpctransport = SMBTransport(self.session.getRemoteHost(), 445, r'\svcctl', smb_connection=self.session)
        dce = rpctransport.get_dce_rpc()
        try:
            dce.connect()
        except:
            pass
        else:
            dce.bind(scmr.MSRPC_UUID_SCMR)
            try:
                # 0xF003F - SC_MANAGER_ALL_ACCESS
                # http://msdn.microsoft.com/en-us/library/windows/desktop/ms685981(v=vs.85).aspx
                ans = scmr.hROpenSCManagerW(dce,'{}\x00'.format(self.target.hostname),'ServicesActive\x00', 0xF003F)
                return "TRUE"
            except scmr.DCERPCException as e:
                pass
        return "FALSE" 
開發者ID:Ridter,項目名稱:GhostPotato,代碼行數:19,代碼來源:smbrelayclient.py

示例2: get_os_arch

# 需要導入模塊: from impacket.dcerpc.v5 import scmr [as 別名]
# 或者: from impacket.dcerpc.v5.scmr import DCERPCException [as 別名]
def get_os_arch(self):
        # Credit: https://github.com/byt3bl33d3r/CrackMapExec/blob/master/cme/protocols/smb.py
        # Credit: https://github.com/SecureAuthCorp/impacket/blob/impacket_0_9_19/examples/getArch.py
        try:
            stringBinding = r'ncacn_ip_tcp:{}[135]'.format(self.host)
            transport = DCERPCTransportFactory(stringBinding)
            transport.set_connect_timeout(5)
            dce = transport.get_dce_rpc()
            dce.connect()
            try:
                dce.bind(MSRPC_UUID_PORTMAP, transfer_syntax=('71710533-BEBA-4937-8319-B5DBEF9CCC36', '1.0'))
            except DCERPCException as e:
                if str(e).find('syntaxes_not_supported') >= 0:
                    dce.disconnect()
                    return 32
            else:
                dce.disconnect()
                return 64
        except:
            return 0 
開發者ID:m8r0wn,項目名稱:ActiveReign,代碼行數:22,代碼來源:smb.py

示例3: finish

# 需要導入模塊: from impacket.dcerpc.v5 import scmr [as 別名]
# 或者: from impacket.dcerpc.v5.scmr import DCERPCException [as 別名]
def finish(self):
        # Just in case the service is still created
        try:
           self.__scmr = self.__rpc.get_dce_rpc()
           self.__scmr.connect() 
           self.__scmr.bind(scmr.MSRPC_UUID_SCMR)
           resp = scmr.hROpenSCManagerW(self.__scmr)
           self.__scHandle = resp['lpScHandle']
           resp = scmr.hROpenServiceW(self.__scmr, self.__scHandle, self.__serviceName)
           service = resp['lpServiceHandle']
           scmr.hRDeleteService(self.__scmr, service)
           scmr.hRControlService(self.__scmr, service, scmr.SERVICE_CONTROL_STOP)
           scmr.hRCloseServiceHandle(self.__scmr, service)
        except scmr.DCERPCException:
           pass 
開發者ID:3ndG4me,項目名稱:AutoBlue-MS17-010,代碼行數:17,代碼來源:mysmb.py

示例4: isAdmin

# 需要導入模塊: from impacket.dcerpc.v5 import scmr [as 別名]
# 或者: from impacket.dcerpc.v5.scmr import DCERPCException [as 別名]
def isAdmin(self):
        try:
            rpctransport = SMBTransport(self.host, self.port, r'\svcctl', smb_connection=self.con)
            dce = rpctransport.get_dce_rpc()
            try:
                dce.connect()
            except:
                pass
            else:
                dce.bind(scmr.MSRPC_UUID_SCMR)
                try:
                    # 0xF003F - SC_MANAGER_ALL_ACCESS
                    # http://msdn.microsoft.com/en-us/library/windows/desktop/ms685981(v=vs.85).aspx
                    ans = scmr.hROpenSCManagerW(dce, '{}\x00'.format(self.host), 'ServicesActive\x00', 0xF003F)
                    self.admin = True
                    return True
                except scmr.DCERPCException as e:
                    pass
        except Exception as e:
            print(e)
        return False

    ################################
    # Dump SAM / LSA
    #   Methods were modified from:
    #     https://github.com/byt3bl33d3r/CrackMapExec/blob/master/cme/protocols/smb.py
    #     https://github.com/SecureAuthCorp/impacket/blob/master/examples/secretsdump.py
    ################################ 
開發者ID:m8r0wn,項目名稱:ActiveReign,代碼行數:30,代碼來源:smb.py


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