本文整理汇总了Python中lib.core.common.getFileItems方法的典型用法代码示例。如果您正苦于以下问题:Python common.getFileItems方法的具体用法?Python common.getFileItems怎么用?Python common.getFileItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.core.common
的用法示例。
在下文中一共展示了common.getFileItems方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setCrawler
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _setCrawler():
if not conf.crawlDepth:
return
if not any((conf.bulkFile, conf.sitemapUrl)):
crawl(conf.url)
else:
if conf.bulkFile:
targets = getFileItems(conf.bulkFile)
else:
targets = parseSitemap(conf.sitemapUrl)
for i in xrange(len(targets)):
try:
target = targets[i]
crawl(target)
if conf.verbose in (1, 2):
status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except Exception, ex:
errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, ex)
logger.error(errMsg)
示例2: _setBulkMultipleTargets
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _setBulkMultipleTargets():
if not conf.bulkFile:
return
conf.bulkFile = safeExpandUser(conf.bulkFile)
infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile
logger.info(infoMsg)
if not os.path.isfile(conf.bulkFile):
errMsg = "the specified bulk file "
errMsg += "does not exist"
raise SqlmapFilePathException(errMsg)
found = False
for line in getFileItems(conf.bulkFile):
if re.match(r"[^ ]+\?(.+)", line, re.I) or CUSTOM_INJECTION_MARK_CHAR in line:
found = True
kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None))
if not found and not conf.forms and not conf.crawlDepth:
warnMsg = "no usable links found (with GET parameters)"
logger.warn(warnMsg)
示例3: _setCrawler
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _setCrawler():
if not conf.crawlDepth:
return
if not any((conf.bulkFile, conf.sitemapUrl)):
crawl(conf.url)
else:
if conf.bulkFile:
targets = getFileItems(conf.bulkFile)
else:
targets = parseSitemap(conf.sitemapUrl)
for i in xrange(len(targets)):
try:
target = targets[i]
crawl(target)
if conf.verbose in (1, 2):
status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except Exception, ex:
errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, getSafeExString(ex))
logger.error(errMsg)
示例4: _setBulkMultipleTargets
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _setBulkMultipleTargets():
if not conf.bulkFile:
return
conf.bulkFile = safeExpandUser(conf.bulkFile)
infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile
logger.info(infoMsg)
if not os.path.isfile(conf.bulkFile):
errMsg = "the specified bulk file "
errMsg += "does not exist"
raise SqlmapFilePathException(errMsg)
found = False
for line in getFileItems(conf.bulkFile):
if re.match(r"[^ ]+\?(.+)", line, re.I) or kb.customInjectionMark in line:
found = True
kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None))
if not found and not conf.forms and not conf.crawlDepth:
warnMsg = "no usable links found (with GET parameters)"
logger.warn(warnMsg)
示例5: _findPageForms
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _findPageForms():
if not conf.forms or conf.crawlDepth:
return
if conf.url and not checkConnection():
return
infoMsg = "searching for forms"
logger.info(infoMsg)
if not any((conf.bulkFile, conf.googleDork, conf.sitemapUrl)):
page, _ = Request.queryPage(content=True)
findPageForms(page, conf.url, True, True)
else:
if conf.bulkFile:
targets = getFileItems(conf.bulkFile)
elif conf.sitemapUrl:
targets = parseSitemap(conf.sitemapUrl)
elif conf.googleDork:
targets = [_[0] for _ in kb.targets]
kb.targets.clear()
for i in xrange(len(targets)):
try:
target = targets[i]
page, _, _ = Request.getPage(url=target.strip(), crawling=True, raise404=False)
findPageForms(page, target, False, True)
if conf.verbose in (1, 2):
status = '%d/%d links visited (%d%%)' % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except KeyboardInterrupt:
break
except Exception, ex:
errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, ex)
logger.error(errMsg)
示例6: _init_UAlist
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _init_UAlist(path):
# TODO
conf.RANDOM_UA = True
th.UA_LIST = getFileItems(path)
示例7: setMultipleTarget
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def setMultipleTarget():
#urlFile
if not conf.urlFile:
target_urls = []
if conf.url:
if conf.url.endswith('/24'):
try:
socket.inet_aton(conf.url.split('/')[0])
base_addr = conf.url[:conf.url.rfind('.') + 1]
target_urls = ['{}{}'.format(base_addr, i)
for i in xrange(1, 255 + 1)]
except socket.error:
errMsg = 'only id address acceptable'
log.error(errMsg)
else:
target_urls = conf.url.split(',')
for url in target_urls:
if url:
kb.targets.put((url))
else:
errMsg = 'the url needs to be set'
log.error(errMsg)
return
if paths.ZEROSCAN_TARGET_PATH in conf.urlFile:
conf.urlFile = safeExpandUser(conf.urlFile)
infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
log.process(infoMsg)
else:
conf.urlFile = paths.ZEROSCAN_TARGET_PATH +'/'+ conf.urlFile
conf.urlFile = safeExpandUser(conf.urlFile)
infoMsg = "parsing multiple targets list from '%s'" % conf.urlFile
log.process(infoMsg)
if not os.path.isfile(conf.urlFile):
errMsg = "the specified file does not exist"
raise ZEROScanFilePathException(errMsg)
for line in getFileItems(conf.urlFile):
kb.targets.put(line.strip())
示例8: _findPageForms
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _findPageForms():
if not conf.forms or conf.crawlDepth:
return
if conf.url and not checkConnection():
return
infoMsg = "searching for forms"
logger.info(infoMsg)
if not any((conf.bulkFile, conf.googleDork, conf.sitemapUrl)):
page, _, _ = Request.queryPage(content=True)
findPageForms(page, conf.url, True, True)
else:
if conf.bulkFile:
targets = getFileItems(conf.bulkFile)
elif conf.sitemapUrl:
targets = parseSitemap(conf.sitemapUrl)
elif conf.googleDork:
targets = [_[0] for _ in kb.targets]
kb.targets.clear()
for i in xrange(len(targets)):
try:
target = targets[i]
page, _, _ = Request.getPage(url=target.strip(), crawling=True, raise404=False)
findPageForms(page, target, False, True)
if conf.verbose in (1, 2):
status = '%d/%d links visited (%d%%)' % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
except KeyboardInterrupt:
break
except Exception, ex:
errMsg = "problem occurred while searching for forms at '%s' ('%s')" % (target, getSafeExString(ex))
logger.error(errMsg)
示例9: _init_UAlist
# 需要导入模块: from lib.core import common [as 别名]
# 或者: from lib.core.common import getFileItems [as 别名]
def _init_UAlist(path):
infoMsg = "loading HTTP User-Agent header(s) from "
infoMsg += "file '%s'" % path
logger.info(infoMsg)
# TODO 此处 conf.RANDOM_UA 在其他地方暂时没有用到
conf.RANDOM_UA = True
th.UA_LIST = getFileItems(path)
successMsg = "Total: %d" % len(th.UA_LIST)
logger.info(successMsg)