当前位置: 首页>>代码示例>>Python>>正文


Python epm.MSRPC_UUID_PORTMAP属性代码示例

本文整理汇总了Python中impacket.dcerpc.v5.epm.MSRPC_UUID_PORTMAP属性的典型用法代码示例。如果您正苦于以下问题:Python epm.MSRPC_UUID_PORTMAP属性的具体用法?Python epm.MSRPC_UUID_PORTMAP怎么用?Python epm.MSRPC_UUID_PORTMAP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在impacket.dcerpc.v5.epm的用法示例。


在下文中一共展示了epm.MSRPC_UUID_PORTMAP属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectDCE

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def connectDCE(self, username, password, domain, lm='', nt='', aesKey='', TGT=None, TGS=None, tfragment=0,
                   dceFragment=0,
                   auth_type=RPC_C_AUTHN_WINNT, auth_level=RPC_C_AUTHN_LEVEL_NONE, dceAuth=True, doKerberos=False,
                   bind=epm.MSRPC_UUID_PORTMAP):
        rpctransport = transport.DCERPCTransportFactory(self.stringBinding)

        if hasattr(rpctransport, 'set_credentials'):
            # This method exists only for selected protocol sequences.
            rpctransport.set_credentials(username, password, domain, lm, nt, aesKey, TGT, TGS)
            rpctransport.set_kerberos(doKerberos)

        rpctransport.set_max_fragment_size(tfragment)
        dce = rpctransport.get_dce_rpc()
        dce.set_max_fragment_size(dceFragment)
        if dceAuth is True:
            dce.set_credentials(*(rpctransport.get_credentials()))
        dce.connect()
        dce.set_auth_type(auth_type)
        dce.set_auth_level(auth_level)
        dce.bind(bind)

        return dce 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:24,代码来源:test_rpcrt.py

示例2: get_os_arch

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def get_os_arch(self):
        try:
            stringBinding = r'ncacn_ip_tcp:{}[135]'.format(self.host)
            transport = DCERPCTransportFactory(stringBinding)
            transport.set_connect_timeout(5)
            dce = transport.get_dce_rpc()
            if self.args.kerberos:
                dce.set_auth_type(RPC_C_AUTHN_GSS_NEGOTIATE)
            dce.connect()
            try:
                dce.bind(MSRPC_UUID_PORTMAP, transfer_syntax=('71710533-BEBA-4937-8319-B5DBEF9CCC36', '1.0'))
            except (DCERPCException, e):
                if str(e).find('syntaxes_not_supported') >= 0:
                    dce.disconnect()
                    return 32
            else:
                dce.disconnect()
                return 64

        except Exception as e:
            logging.debug('Error retrieving os arch of {}: {}'.format(self.host, str(e)))

        return 0 
开发者ID:byt3bl33d3r,项目名称:CrackMapExec,代码行数:25,代码来源:smb.py

示例3: connectDCE

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def connectDCE(self, username, password, domain, lm='', nt='', aesKey='', TGT=None, TGS=None, tfragment=0,
                   dceFragment=0,
                   auth_type=RPC_C_AUTHN_WINNT, auth_level=RPC_C_AUTHN_LEVEL_NONE, dceAuth=True, doKerberos=False,
                   bind=epm.MSRPC_UUID_PORTMAP):
        rpctransport = transport.DCERPCTransportFactory(self.stringBinding)

        if hasattr(rpctransport, 'set_credentials'):
            # This method exists only for selected protocol sequences.
            rpctransport.set_credentials(username, password, domain, lm, nt, aesKey, TGT, TGS)
            rpctransport.set_kerberos(doKerberos, kdcHost=self.machine)

        rpctransport.set_max_fragment_size(tfragment)
        rpctransport.setRemoteName(self.serverName)
        rpctransport.setRemoteHost(self.machine)
        dce = rpctransport.get_dce_rpc()
        dce.set_max_fragment_size(dceFragment)
        if dceAuth is True:
            dce.set_credentials(*(rpctransport.get_credentials()))
        dce.connect()
        dce.set_auth_type(auth_type)
        dce.set_auth_level(auth_level)
        dce.bind(bind)

        return dce 
开发者ID:eth0izzle,项目名称:cracke-dit,代码行数:26,代码来源:test_rpcrt.py

示例4: get_os_arch

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def get_os_arch(target):
    try:
        stringBinding = r'ncacn_ip_tcp:{}[135]'.format(target)
        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:
                return 32
            else:
                pass
        else:
            return 64
        dce.disconnect()
    except Exception as e:
        logging.warning('%sErr with get_os_arch for %s: %s' % (warningRed, target, str(e))) 
开发者ID:aas-n,项目名称:spraykatz,代码行数:22,代码来源:Arch.py

示例5: __fetchList

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def __fetchList(self, rpctransport):
        dce = rpctransport.get_dce_rpc()

        dce.connect()
        #dce.set_auth_level(ntlm.NTLM_AUTH_PKT_INTEGRITY)
        #dce.bind(epm.MSRPC_UUID_PORTMAP)
        #rpcepm = epm.DCERPCEpm(dce)

        resp = epm.hept_lookup(None, dce=dce)

        dce.disconnect()

        return resp


# Process command-line arguments. 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:18,代码来源:rpcdump.py

示例6: get_os_arch

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [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

示例7: connect

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def connect(self):
        rpctransport = transport.DCERPCTransportFactory(self.stringBinding)
        if len(self.hashes) > 0:
            lmhash, nthash = self.hashes.split(':')
        else:
            lmhash = ''
            nthash = ''
        if hasattr(rpctransport, 'set_credentials'):
            # This method exists only for selected protocol sequences.
            rpctransport.set_credentials(self.username,self.password, self.domain, lmhash, nthash)
        dce = rpctransport.get_dce_rpc()
        dce.connect()
        dce.bind(epm.MSRPC_UUID_PORTMAP, transfer_syntax = self.ts)

        return dce, rpctransport 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:17,代码来源:test_epm.py

示例8: run

# 需要导入模块: from impacket.dcerpc.v5 import epm [as 别名]
# 或者: from impacket.dcerpc.v5.epm import MSRPC_UUID_PORTMAP [as 别名]
def run(self):
        if self.__options.targets is not None:
            for line in self.__options.targets.readlines():
                self.__machinesList.append(line.strip(' \r\n'))
        else:
            self.__machinesList.append(self.__options.target)

        logging.info('Gathering OS architecture for %d machines' % len(self.__machinesList))
        logging.info('Socket connect timeout set to %s secs' % self.__options.timeout)

        for machine in self.__machinesList:
            try:
                stringBinding = r'ncacn_ip_tcp:%s[135]' % machine
                transport = DCERPCTransportFactory(stringBinding)
                transport.set_connect_timeout(int(self.__options.timeout))
                dce = transport.get_dce_rpc()
                dce.connect()
                try:
                    dce.bind(MSRPC_UUID_PORTMAP, transfer_syntax=self.NDR64Syntax)
                except DCERPCException as e:
                    if str(e).find('syntaxes_not_supported') >= 0:
                        print('%s is 32-bit' % machine)
                    else:
                        logging.error(str(e))
                        pass
                else:
                    print('%s is 64-bit' % machine)

                dce.disconnect()
            except Exception as e:
                #import traceback
                #traceback.print_exc()
                logging.error('%s: %s' % (machine, str(e)))

# Process command-line arguments. 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:37,代码来源:getArch.py


注:本文中的impacket.dcerpc.v5.epm.MSRPC_UUID_PORTMAP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。