本文整理汇总了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"
示例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),
)
示例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)),
)
示例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)
示例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)