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


Python smb.SMB_DIALECT属性代码示例

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


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

示例1: login

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def login(self, user, password, domain = '', lmhash = '', nthash = '', ntlmFallback = True):
        """
        logins into the target system

        :param string user: username
        :param string password: password for the user
        :param string domain: domain where the account is valid for
        :param string lmhash: LMHASH used to authenticate using hashes (password is not used)
        :param string nthash: NTHASH used to authenticate using hashes (password is not used)
        :param bool ntlmFallback: If True it will try NTLMv1 authentication if NTLMv2 fails. Only available for SMBv1

        :return: None, raises a Session Error if error.
        """
        self._ntlmFallback = ntlmFallback
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash, ntlmFallback)
            else:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code()) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:23,代码来源:smbconnection.py

示例2: writeNamedPipe

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def writeNamedPipe(self, treeId, fileId, data, waitAnswer = True):
        """
        writes to a named pipe

        :param HANDLE treeId: a valid handle for the share where the pipe is
        :param HANDLE fileId: a valid handle for the pipe
        :param string data: buffer with the data to write
        :param boolean waitAnswer: whether or not to wait for an answer

        :return: None, raises a SessionError exception if error.

        """
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                return self._SMBConnection.write_andx(treeId, fileId, data, wait_answer = waitAnswer, write_pipe_mode = True)
            else:
                return self.writeFile(treeId, fileId, data, 0)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code()) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:21,代码来源:smbconnection.py

示例3: login

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def login(self, user, password, domain = '', lmhash = '', nthash = '', ntlmFallback = True):
        """
        logins into the target system

        :param string user: username
        :param string password: password for the user
        :param string domain: domain where the account is valid for
        :param string lmhash: LMHASH used to authenticate using hashes (password is not used)
        :param string nthash: NTHASH used to authenticate using hashes (password is not used)
        :param bool ntlmFallback: If True it will try NTLMv1 authentication if NTLMv2 fails. Only available for SMBv1

        :return: None, raises a Session Error if error.
        """
        self._ntlmFallback = ntlmFallback
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash, ntlmFallback)
            else:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code(), e.get_error_packet()) 
开发者ID:eth0izzle,项目名称:cracke-dit,代码行数:23,代码来源:smbconnection.py

示例4: writeNamedPipe

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def writeNamedPipe(self, treeId, fileId, data, waitAnswer = True):
        """
        writes to a named pipe

        :param HANDLE treeId: a valid handle for the share where the pipe is
        :param HANDLE fileId: a valid handle for the pipe
        :param string data: buffer with the data to write
        :param boolean waitAnswer: whether or not to wait for an answer

        :return: None, raises a SessionError exception if error.

        """
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                return self._SMBConnection.write_andx(treeId, fileId, data, wait_answer = waitAnswer, write_pipe_mode = True)
            else:
                return self.writeFile(treeId, fileId, data, 0)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code(), e.get_error_packet()) 
开发者ID:eth0izzle,项目名称:cracke-dit,代码行数:21,代码来源:smbconnection.py

示例5: getServerSupportedDialects

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def getServerSupportedDialects(self, ip, port = 445):
		'''Connects to the specified server on the provided port(445 default) and enumeratesSMBKey the supported dialects'''
		dialects = [SMB_DIALECT, SMB2_DIALECT_002, SMB2_DIALECT_21, SMB2_DIALECT_30, SMB2_DIALECT_302 ]#, SMB2_DIALECT_311]
		
		# Check SMBv1
		try:
			# Build a generic SMBv1 negotiate packet and only show support for SMBv1
			smb 	= NewSMBPacket(data = unhexlify("ff534d4272000000001845680000000000000000000000000000ed4300000100000e00024e54204c4d20302e3132000200"))
			rawData = str(smb)
			netbios = struct.pack('>i', len(str(rawData)))
			rpkt 	= str(netbios) + str(rawData)
			# Connect through
			client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			client.connect((ip, port))
			client.sendall(rpkt)
			response = client.recv(999999)
			client.close()
			del(client)
		except Exception, e:
			# It's not supported, bummer
			dialects.remove(SMB_DIALECT) 
开发者ID:quickbreach,项目名称:SMBetray,代码行数:23,代码来源:SMB_Core.py

示例6: login

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def login(self, user, password, domain = '', lmhash = '', nthash = '', ntlmFallback = True):
        """
        logins into the target system

        :param string user: username
        :param string password: password for the user
        :param string domain: domain where the account is valid for
        :param string lmhash: LMHASH used to authenticate using hashes (password is not used)
        :param string nthash: NTHASH used to authenticate using hashes (password is not used)
        :param bool ntlmFallback: If True it will try NTLMv1 authentication if NTLMv2 fails. Only available for SMBv1

        :return: None, raises a Session Error if error.
        """
        self._ntlmFallback = ntlmFallback
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash, ntlmFallback)
            else:
                return self._SMBConnection.login(user, password, domain, lmhash, nthash)
        except (smb.SessionError, smb3.SessionError) as e:
            raise SessionError(e.get_error_code(), e.get_error_packet()) 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:23,代码来源:smbconnection.py

示例7: queryInfo

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def queryInfo(self, treeId, fileId):
        """
        queries basic information about an opened file/directory

        :param HANDLE treeId: a valid handle for the share where the file is to be opened
        :param HANDLE fileId: a valid handle for the file/directory to be closed

        :return: a smb.SMBQueryFileBasicInfo structure.  raises a SessionError exception if error.

        """
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                res = self._SMBConnection.query_file_info(treeId, fileId)
            else:
                res = self._SMBConnection.queryInfo(treeId, fileId)
            return smb.SMBQueryFileStandardInfo(res)
        except (smb.SessionError, smb3.SessionError) as e:
            raise SessionError(e.get_error_code(), e.get_error_packet()) 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:20,代码来源:smbconnection.py

示例8: queryInfo

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def queryInfo(self, treeId, fileId):
        """
        queries basic information about an opened file/directory

        :param HANDLE treeId: a valid handle for the share where the file is to be opened
        :param HANDLE fileId: a valid handle for the file/directory to be closed

        :return: a smb.SMBQueryFileBasicInfo structure.  raises a SessionError exception if error.

        """
        try:
            if self.getDialect() == smb.SMB_DIALECT:
                res = self._SMBConnection.query_file_info(treeId, fileId)
            else:
                res = self._SMBConnection.queryInfo(treeId, fileId)
            return smb.SMBQueryFileStandardInfo(res)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code()) 
开发者ID:tholum,项目名称:PiBunny,代码行数:20,代码来源:smbconnection.py

示例9: __init__

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def __init__(self, remoteName='', remoteHost='', myName=None, sess_port=nmb.SMB_SESSION_PORT, timeout=60, preferredDialect=None,
                 existingConnection=None, manualNegotiate=False):

        self._SMBConnection = 0
        self._dialect       = ''
        self._nmbSession    = 0
        self._sess_port     = sess_port
        self._myName        = myName
        self._remoteHost    = remoteHost
        self._remoteName    = remoteName
        self._timeout       = timeout
        self._preferredDialect = preferredDialect
        self._existingConnection = existingConnection
        self._manualNegotiate = manualNegotiate
        self._doKerberos = False
        self._kdcHost = None
        self._useCache = True
        self._ntlmFallback = True

        if existingConnection is not None:
            # Existing Connection must be a smb or smb3 instance
            assert ( isinstance(existingConnection,smb.SMB) or isinstance(existingConnection, smb3.SMB3))
            self._SMBConnection = existingConnection
            self._preferredDialect = self._SMBConnection.getDialect()
            self._doKerberos = self._SMBConnection.getKerberos()
            return

        ##preferredDialect = smb.SMB_DIALECT

        if manualNegotiate is False:
            self.negotiateSession(preferredDialect) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:33,代码来源:smbconnection.py

示例10: connectTree

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def connectTree(self,share):
        if self.getDialect() == smb.SMB_DIALECT:
            # If we already have a UNC we do nothing.
            if ntpath.ismount(share) is False:
                # Else we build it
                share = ntpath.basename(share)
                share = '\\\\' + self.getRemoteHost() + '\\' + share
        try:
            return self._SMBConnection.connect_tree(share)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code()) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:13,代码来源:smbconnection.py

示例11: getSessionKey

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def getSessionKey(self):
        if self.getDialect() == smb.SMB_DIALECT:
            return self._SMBConnection.get_session_key()
        else:
            return self._SMBConnection.getSessionKey() 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:7,代码来源:smbconnection.py

示例12: setSessionKey

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def setSessionKey(self, key):
        if self.getDialect() == smb.SMB_DIALECT:
            return self._SMBConnection.set_session_key(key)
        else:
            return self._SMBConnection.setSessionKey(key) 
开发者ID:joxeankoret,项目名称:CVE-2017-7494,代码行数:7,代码来源:smbconnection.py

示例13: create_smbv1_conn

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def create_smbv1_conn(self):
        try:
            self.conn = SMBConnection(self.host, self.host, None, 445, preferredDialect=SMB_DIALECT)
            self.smbv1 = True
        except socket.error as e:
            if str(e).find('Connection reset by peer') != -1:
                logging.debug('SMBv1 might be disabled on {}'.format(self.host))
            return False
        except Exception as e:
            logging.debug('Error creating SMBv1 connection to {}: {}'.format(self.host, e))
            return False

        return True 
开发者ID:byt3bl33d3r,项目名称:CrackMapExec,代码行数:15,代码来源:ldap.py

示例14: create_smbv1_conn

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def create_smbv1_conn(self):
        try:
            self.conn = SMBConnection(self.host, self.host, None, self.args.port, preferredDialect=SMB_DIALECT)
            self.smbv1 = True
        except socket.error as e:
            if str(e).find('Connection reset by peer') != -1:
                logging.debug('SMBv1 might be disabled on {}'.format(self.host))
            return False
        except Exception as e:
            logging.debug('Error creating SMBv1 connection to {}: {}'.format(self.host, e))
            return False

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

示例15: connectTree

# 需要导入模块: from impacket import smb [as 别名]
# 或者: from impacket.smb import SMB_DIALECT [as 别名]
def connectTree(self,share):
        if self.getDialect() == smb.SMB_DIALECT:
            # If we already have a UNC we do nothing.
            if ntpath.ismount(share) is False:
                # Else we build it
                share = ntpath.basename(share)
                share = '\\\\' + self.getRemoteHost() + '\\' + share
        try:
            return self._SMBConnection.connect_tree(share)
        except (smb.SessionError, smb3.SessionError), e:
            raise SessionError(e.get_error_code(), e.get_error_packet()) 
开发者ID:eth0izzle,项目名称:cracke-dit,代码行数:13,代码来源:smbconnection.py


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