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


Python smb3structs.FILE_READ_DATA属性代码示例

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


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

示例1: openFile

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def openFile(self, tid, fpath, timeout: int = 3):
        self._log.debug("Opening file {}".format(fpath))

        start = time.time()

        while True:
            try:
                fid = self._conn.openFile(tid, fpath, desiredAccess=FILE_READ_DATA)
                self._log.debug("File {} opened".format(fpath))
                return fid
            except Exception as e:
                if str(e).find('STATUS_SHARING_VIOLATION') >= 0 or str(e).find('STATUS_OBJECT_NAME_NOT_FOUND') >= 0:
                    # Output not finished, let's wait
                    if time.time() - start > timeout:
                        raise(Exception(e))
                    time.sleep(1)
                else:
                    raise Exception(e) 
开发者ID:Hackndo,项目名称:lsassy,代码行数:20,代码来源:impacketconnection.py

示例2: open

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def open(self):
        tries = 0
        while True:
            try:
                self.__fid = self.__smbConnection.openFile(self.__tid, self.__fileName, desiredAccess=FILE_READ_DATA,
                                                   shareMode=FILE_SHARE_READ)
            except Exception, e:
                if str(e).find('STATUS_SHARING_VIOLATION') >=0:
                    if tries >= 3:
                        raise e
                    # Stuff didn't finish yet.. wait more
                    time.sleep(5)
                    tries += 1
                    pass
                else:
                    raise e
            else:
                break 
开发者ID:eth0izzle,项目名称:cracke-dit,代码行数:20,代码来源:secretsdump.py

示例3: open

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def open(self):
        tries = 0
        while True:
            try:
                self.__fid = self.__smbConnection.openFile(self.__tid, self.__fileName, desiredAccess=FILE_READ_DATA,
                                                   shareMode=FILE_SHARE_READ)
            except Exception as e:
                if str(e).find('STATUS_SHARING_VIOLATION') >=0:
                    if tries >= 3:
                        raise e
                    # Stuff didn't finish yet.. wait more
                    time.sleep(5)
                    tries += 1
                    pass
                else:
                    raise e
            else:
                break 
开发者ID:Coalfire-Research,项目名称:Slackor,代码行数:20,代码来源:secretsdump.py

示例4: __init__

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def __init__(self, smbConnection, fileName, share='ADMIN$', access = FILE_READ_DATA | FILE_WRITE_DATA ):
        self.__smbConnection = smbConnection
        self.__share = share
        self.__access = access
        self.__fileName = fileName
        self.__tid = self.__smbConnection.connectTree(share)
        self.__fid = None
        self.__currentOffset = 0 
开发者ID:byt3bl33d3r,项目名称:CrackMapExec,代码行数:10,代码来源:remotefile.py

示例5: __init__

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def __init__(self, smbConnection, fileName, share, access = FILE_READ_DATA | FILE_WRITE_DATA ):
        self.__smbConnection = smbConnection
        self.__share = share
        self.__access = access
        self.__fileName = fileName
        self.__tid = self.__smbConnection.connectTree(share)
        self.__fid = None
        self.__currentOffset = 0 
开发者ID:m8r0wn,项目名称:ActiveReign,代码行数:10,代码来源:remotefile.py

示例6: search_content

# 需要导入模块: from impacket import smb3structs [as 别名]
# 或者: from impacket.smb3structs import FILE_READ_DATA [as 别名]
def search_content(self, path, result):
        path = path.replace('*', '')
        try:
            rfile = RemoteFile(self.smbconnection, path + result.get_longname(), self.share, access=FILE_READ_DATA)
            rfile.open()

            while True:
                try:
                    contents = rfile.read(4096)
                    if not contents:
                        break
                except SessionError as e:
                    if 'STATUS_END_OF_FILE' in str(e):
                        break

                except Exception:
                    traceback.print_exc()
                    break

                for pattern in self.pattern:
                    if contents.lower().find(pattern.lower()) != -1:
                        self.logger.highlight(u"//{}/{}/{}{} [lastm:'{}' size:{} offset:{} pattern:'{}']".format(self.smbconnection.getRemoteHost(), 
                                                                                                            self.share,
                                                                                                            path,
                                                                                                            result.get_longname(),
                                                                                                            'n\\a' if not self.get_lastm_time(result) else self.get_lastm_time(result),
                                                                                                            result.get_filesize(),
                                                                                                            rfile.tell(),
                                                                                                            pattern))
                        self.results.append('{}{}'.format(path, result.get_longname()))

                for regex in self.regex:
                    if regex.findall(contents):
                        self.logger.highlight(u"//{}/{}/{}{} [lastm:'{}' size:{} offset:{} regex:'{}']".format(self.smbconnection.getRemoteHost(),
                                                                                                          self.share,
                                                                                                          path,
                                                                                                          result.get_longname(),
                                                                                                          'n\\a' if not self.get_lastm_time(result) else self.get_lastm_time(result),
                                                                                                          result.get_filesize(),
                                                                                                          rfile.tell(),
                                                                                                          regex.pattern))
                        self.results.append('{}{}'.format(path, result.get_longname()))

            rfile.close()
            return

        except SessionError as e:
            if 'STATUS_SHARING_VIOLATION' in str(e):
                pass

        except Exception:
            traceback.print_exc() 
开发者ID:byt3bl33d3r,项目名称:CrackMapExec,代码行数:54,代码来源:smbspider.py


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