Python impacket.dcerpc.v5.epm.MSRPC_UUID_PORTMAP Examples
The following are 14
code examples of impacket.dcerpc.v5.epm.MSRPC_UUID_PORTMAP().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
impacket.dcerpc.v5.epm
, or try the search function
.
Example #1
Source File: test_rpcrt.py From CVE-2017-7494 with GNU General Public License v3.0 | 6 votes |
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
Example #2
Source File: smb.py From CrackMapExec with BSD 2-Clause "Simplified" License | 6 votes |
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
Example #3
Source File: test_rpcrt.py From cracke-dit with MIT License | 6 votes |
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
Example #4
Source File: Arch.py From spraykatz with MIT License | 6 votes |
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)))
Example #5
Source File: rpcdump.py From Slackor with GNU General Public License v3.0 | 6 votes |
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.
Example #6
Source File: test_rpcrt.py From Slackor with GNU General Public License v3.0 | 6 votes |
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
Example #7
Source File: smb.py From ActiveReign with GNU General Public License v3.0 | 6 votes |
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
Example #8
Source File: rpcdump.py From PiBunny with MIT License | 6 votes |
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.
Example #9
Source File: test_rpcrt.py From PiBunny with MIT License | 6 votes |
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
Example #10
Source File: test_epm.py From CVE-2017-7494 with GNU General Public License v3.0 | 5 votes |
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
Example #11
Source File: test_epm.py From cracke-dit with MIT License | 5 votes |
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
Example #12
Source File: getArch.py From Slackor with GNU General Public License v3.0 | 5 votes |
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.
Example #13
Source File: test_epm.py From Slackor with GNU General Public License v3.0 | 5 votes |
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
Example #14
Source File: test_epm.py From PiBunny with MIT License | 5 votes |
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