mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
parent
3663fa936b
commit
87ad11dffb
|
@ -413,14 +413,14 @@ def _doSearch():
|
||||||
else:
|
else:
|
||||||
conf.googlePage += 1
|
conf.googlePage += 1
|
||||||
|
|
||||||
def _setBulkMultipleTargets():
|
def _setStdinPipeTargets():
|
||||||
if not conf.bulkFile:
|
if isinstance(conf.stdinPipe, collections.Iterable):
|
||||||
return
|
infoMsg = "using 'STDIN' for parsing targets list"
|
||||||
|
logger.info(infoMsg)
|
||||||
|
|
||||||
if isinstance(conf.bulkFile, collections.Iterable):
|
|
||||||
class _(object):
|
class _(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__rest = set()
|
self.__rest = OrderedSet()
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
@ -429,43 +429,47 @@ def _setBulkMultipleTargets():
|
||||||
return self.next()
|
return self.next()
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
line = next(conf.bulkFile)
|
line = next(conf.stdinPipe)
|
||||||
if line:
|
if line:
|
||||||
match = re.search(r"\bhttps?://[^\s'\"]+", line, re.I)
|
match = re.search(r"\b(https?://[^\s'\"]+|[\w.]+\.\w{2,3}[/\w+]*\?[^\s'\"]+)", line, re.I)
|
||||||
if match:
|
if match:
|
||||||
return (match.group(0), conf.method, conf.data, conf.cookie, None)
|
return (match.group(0), conf.method, conf.data, conf.cookie, None)
|
||||||
elif self.__rest:
|
elif self.__rest:
|
||||||
return self.__rest.pop()
|
return self.__rest.pop()
|
||||||
else:
|
|
||||||
raise StopIteration()
|
raise StopIteration()
|
||||||
|
|
||||||
def add(self, elem):
|
def add(self, elem):
|
||||||
self.__rest.add(elem)
|
self.__rest.add(elem)
|
||||||
|
|
||||||
kb.targets = _()
|
kb.targets = _()
|
||||||
else:
|
|
||||||
conf.bulkFile = safeExpandUser(conf.bulkFile)
|
|
||||||
|
|
||||||
infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile
|
def _setBulkMultipleTargets():
|
||||||
logger.info(infoMsg)
|
if not conf.bulkFile:
|
||||||
|
return
|
||||||
|
|
||||||
if not checkFile(conf.bulkFile, False):
|
conf.bulkFile = safeExpandUser(conf.bulkFile)
|
||||||
errMsg = "the specified bulk file "
|
|
||||||
errMsg += "does not exist"
|
|
||||||
raise SqlmapFilePathException(errMsg)
|
|
||||||
|
|
||||||
found = False
|
infoMsg = "parsing multiple targets list from '%s'" % conf.bulkFile
|
||||||
for line in getFileItems(conf.bulkFile):
|
logger.info(infoMsg)
|
||||||
if conf.scope and not re.search(conf.scope, line, re.I):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if re.match(r"[^ ]+\?(.+)", line, re.I) or kb.customInjectionMark in line:
|
if not checkFile(conf.bulkFile, False):
|
||||||
found = True
|
errMsg = "the specified bulk file "
|
||||||
kb.targets.add((line.strip(), conf.method, conf.data, conf.cookie, None))
|
errMsg += "does not exist"
|
||||||
|
raise SqlmapFilePathException(errMsg)
|
||||||
|
|
||||||
if not found and not conf.forms and not conf.crawlDepth:
|
found = False
|
||||||
warnMsg = "no usable links found (with GET parameters)"
|
for line in getFileItems(conf.bulkFile):
|
||||||
logger.warn(warnMsg)
|
if conf.scope and not re.search(conf.scope, line, re.I):
|
||||||
|
continue
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
def _findPageForms():
|
def _findPageForms():
|
||||||
if not conf.forms or conf.crawlDepth:
|
if not conf.forms or conf.crawlDepth:
|
||||||
|
@ -2802,7 +2806,7 @@ def init():
|
||||||
|
|
||||||
parseTargetDirect()
|
parseTargetDirect()
|
||||||
|
|
||||||
if any((conf.url, conf.logFile, conf.bulkFile, conf.requestFile, conf.googleDork)):
|
if any((conf.url, conf.logFile, conf.bulkFile, conf.requestFile, conf.googleDork, conf.stdinPipe)):
|
||||||
_setHostname()
|
_setHostname()
|
||||||
_setHTTPTimeout()
|
_setHTTPTimeout()
|
||||||
_setHTTPExtraHeaders()
|
_setHTTPExtraHeaders()
|
||||||
|
@ -2816,6 +2820,7 @@ def init():
|
||||||
_setSocketPreConnect()
|
_setSocketPreConnect()
|
||||||
_setSafeVisit()
|
_setSafeVisit()
|
||||||
_doSearch()
|
_doSearch()
|
||||||
|
_setStdinPipeTargets()
|
||||||
_setBulkMultipleTargets()
|
_setBulkMultipleTargets()
|
||||||
_checkTor()
|
_checkTor()
|
||||||
_setCrawler()
|
_setCrawler()
|
||||||
|
|
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.4.10.9"
|
VERSION = "1.4.10.10"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -803,6 +803,9 @@ def cmdLineParser(argv=None):
|
||||||
parser.add_argument("--smoke-test", dest="smokeTest", action="store_true",
|
parser.add_argument("--smoke-test", dest="smokeTest", action="store_true",
|
||||||
help=SUPPRESS)
|
help=SUPPRESS)
|
||||||
|
|
||||||
|
parser.add_argument("--stdin-pipe", dest="stdinPipe",
|
||||||
|
help=SUPPRESS)
|
||||||
|
|
||||||
parser.add_argument("--vuln-test", dest="vulnTest", action="store_true",
|
parser.add_argument("--vuln-test", dest="vulnTest", action="store_true",
|
||||||
help=SUPPRESS)
|
help=SUPPRESS)
|
||||||
|
|
||||||
|
@ -1036,9 +1039,9 @@ def cmdLineParser(argv=None):
|
||||||
args.url = args.url or DUMMY_URL
|
args.url = args.url or DUMMY_URL
|
||||||
|
|
||||||
if hasattr(sys.stdin, "fileno") and not os.isatty(sys.stdin.fileno()) and '-' not in sys.argv:
|
if hasattr(sys.stdin, "fileno") and not os.isatty(sys.stdin.fileno()) and '-' not in sys.argv:
|
||||||
args.bulkFile = iter(sys.stdin.readline, None)
|
args.stdinPipe = iter(sys.stdin.readline, None)
|
||||||
|
|
||||||
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.vulnTest, args.bedTest, args.fuzzTest, args.wizard, args.dependencies, args.purge, args.listTampers, args.hashFile)):
|
if not any((args.direct, args.url, args.logFile, args.bulkFile, args.googleDork, args.configFile, args.requestFile, args.updateAll, args.smokeTest, args.vulnTest, args.bedTest, args.fuzzTest, args.wizard, args.dependencies, args.purge, args.listTampers, args.hashFile, args.stdinPipe)):
|
||||||
errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, --list-tampers, --wizard, --update, --purge or --dependencies). "
|
errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, --list-tampers, --wizard, --update, --purge or --dependencies). "
|
||||||
errMsg += "Use -h for basic and -hh for advanced help\n"
|
errMsg += "Use -h for basic and -hh for advanced help\n"
|
||||||
parser.error(errMsg)
|
parser.error(errMsg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user