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


Python DB.glob2re方法代码示例

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


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

示例1: execute

# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import glob2re [as 别名]
    def execute(self):
        if len(self.args) < 2:
            yield self.help()
            return

        ## Try to glob the inode list:
        dbh = DB.DBO(self.environment._CASE)
        dbh.execute("select inode from inode where inode rlike %r", DB.glob2re(self.args[0]))
        pdbh = DB.DBO()
        pdbh.mass_insert_start("jobs")
        ## This is a cookie used to identify our requests so that we
        ## can check they have been done later.
        cookie = int(time.time())
        scanners = []
        for i in range(1, len(self.args)):
            scanners.extend(fnmatch.filter(Registry.SCANNERS.scanners, self.args[i]))

        scanners = ScannerUtils.fill_in_dependancies(scanners)

        for row in dbh:
            inode = row["inode"]
            pdbh.mass_insert(
                command="Scan", arg1=self.environment._CASE, arg2=row["inode"], arg3=",".join(scanners), cookie=cookie
            )

        pdbh.mass_insert_commit()

        ## Wait for the scanners to finish:
        if self.environment.interactive:
            self.wait_for_scan(cookie)

        yield "Scanning complete"
开发者ID:ntvis,项目名称:pyflag,代码行数:34,代码来源:AdvancedCommands.py

示例2: multiple_inode_reset

# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import glob2re [as 别名]
    def multiple_inode_reset(self, inode_glob):
        """ This method modifies the database to reset the scanners. It takes an argument which is a glob of the inodes to be reset. It does this for performance reasons. Each scanner is expected to clean up after itself. """

        ## Here we do the default (clear scanner_cache field) and hope that inherited classes either deal with it or call us
        sql = DB.glob2re(inode_glob)
        db = DB.DBO(self.case)
        db.execute(
            "update inode set scanner_cache = REPLACE(scanner_cache, %r, '') where inode rlike %r",
            (self.__class__.__name__, sql),
        )
开发者ID:ntvis,项目名称:pyflag,代码行数:12,代码来源:Scanner.py

示例3: reset_entire_path

# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import glob2re [as 别名]
    def reset_entire_path(self, path_glob):
        """ This method modifies the database to reset the scanners. It takes an argument which is a path under which all inodes will be reset. It does this for performance reasons. Each scanner is expected to clean up after itself. """

        ## The scanners should do their thing on their tables and then call this (the base class) method to allow us to handle the simple stuff (clear the scanner cache field. If they don't call us, it is up to them to clean it up themselves.
        path = path_glob
        if not path.endswith("*"):
            path = path + "*"
        db = DB.DBO(self.case)
        db.execute(
            "update inode join file on file.inode = inode.inode set scanner_cache = REPLACE(scanner_cache, %r, '') where file.path rlike %r",
            (self.__class__.__name__, DB.glob2re(path)),
        )
开发者ID:ntvis,项目名称:pyflag,代码行数:14,代码来源:Scanner.py

示例4: multiple_inode_reset

# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import glob2re [as 别名]
 def multiple_inode_reset(self, inode_glob):
     Scanner.GenScanFactory.multiple_inode_reset(self, inode_glob)
     dbh = DB.DBO(self.case)
     sql = DB.glob2re(inode_glob)
     dbh.delete("webmail_messages", where="inode_id in (select inode_id from inode where inode rlike %r)" % sql) 
开发者ID:arkem,项目名称:pyflag,代码行数:7,代码来源:LiveCom.py

示例5: reset_entire_path

# 需要导入模块: from pyflag import DB [as 别名]
# 或者: from pyflag.DB import glob2re [as 别名]
 def reset_entire_path(self, path_glob):
     path = path_glob
     if not path.endswith("*"): path = path + "*"  
     db = DB.DBO(self.case)
     db.execute("delete from type where inode_id in (select inode_id from file where file.path rlike %r)", DB.glob2re(path))
     Scanner.GenScanFactory.reset_entire_path(self, path_glob)
开发者ID:arkem,项目名称:pyflag,代码行数:8,代码来源:TypeScan.py


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