mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-16 19:40:37 +03:00
minor fix for crawler and far less message overlaps in future
This commit is contained in:
parent
8968c708a0
commit
d6062e8fc9
|
@ -754,6 +754,8 @@ def readInput(message, default=None):
|
||||||
elif message[-1] == ']':
|
elif message[-1] == ']':
|
||||||
message += " "
|
message += " "
|
||||||
|
|
||||||
|
message = "\r%s" % message
|
||||||
|
|
||||||
if conf.batch:
|
if conf.batch:
|
||||||
if isinstance(default, (list, tuple, set)):
|
if isinstance(default, (list, tuple, set)):
|
||||||
options = ",".join([getUnicode(opt, UNICODE_ENCODING) for opt in default])
|
options = ",".join([getUnicode(opt, UNICODE_ENCODING) for opt in default])
|
||||||
|
|
|
@ -39,7 +39,7 @@ logging.addLevelName(7, "TRAFFIC IN")
|
||||||
|
|
||||||
LOGGER = logging.getLogger("sqlmapLog")
|
LOGGER = logging.getLogger("sqlmapLog")
|
||||||
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
|
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
|
||||||
FORMATTER = logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S")
|
FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S")
|
||||||
|
|
||||||
LOGGER_HANDLER.setFormatter(FORMATTER)
|
LOGGER_HANDLER.setFormatter(FORMATTER)
|
||||||
LOGGER.addHandler(LOGGER_HANDLER)
|
LOGGER.addHandler(LOGGER_HANDLER)
|
||||||
|
|
|
@ -51,30 +51,31 @@ class Crawler:
|
||||||
kb.locks.limits.release()
|
kb.locks.limits.release()
|
||||||
break
|
break
|
||||||
|
|
||||||
content = Request.getPage(url=current)[0]
|
content = Request.getPage(url=current, raise404=False)[0]
|
||||||
|
|
||||||
if not kb.threadContinue:
|
if not kb.threadContinue:
|
||||||
break
|
break
|
||||||
|
|
||||||
soup = BeautifulSoup(content)
|
if content:
|
||||||
for tag in soup('a'):
|
soup = BeautifulSoup(content)
|
||||||
if tag.get("href"):
|
for tag in soup('a'):
|
||||||
url = urlparse.urljoin(conf.url, tag.get("href"))
|
if tag.get("href"):
|
||||||
|
url = urlparse.urljoin(conf.url, tag.get("href"))
|
||||||
|
|
||||||
# flag to know if we are dealing with the same target host
|
# flag to know if we are dealing with the same target host
|
||||||
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
|
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
|
||||||
|
|
||||||
if conf.scope:
|
if conf.scope:
|
||||||
if not re.search(conf.scope, url, re.I):
|
if not re.search(conf.scope, url, re.I):
|
||||||
|
continue
|
||||||
|
elif not target:
|
||||||
continue
|
continue
|
||||||
elif not target:
|
|
||||||
continue
|
|
||||||
|
|
||||||
kb.locks.outputs.acquire()
|
kb.locks.outputs.acquire()
|
||||||
threadData.shared.deeper.add(url)
|
threadData.shared.deeper.add(url)
|
||||||
if re.search(r"(.*?)\?(.+)", url):
|
if re.search(r"(.*?)\?(.+)", url):
|
||||||
threadData.shared.outputs.add(url)
|
threadData.shared.outputs.add(url)
|
||||||
kb.locks.outputs.release()
|
kb.locks.outputs.release()
|
||||||
|
|
||||||
if conf.verbose in (1, 2):
|
if conf.verbose in (1, 2):
|
||||||
kb.locks.ioLock.acquire()
|
kb.locks.ioLock.acquire()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user