本文整理匯總了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
示例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
示例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
示例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)))
示例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.
示例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
示例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
示例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.