diff --git a/lib/core/common.py b/lib/core/common.py index 18a6459b7..92868633a 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -3110,6 +3110,17 @@ def findPageForms(content, url, raise_=False, addToTargets=False): if addToTargets and retVal: for target in retVal: + url = target[0] + + # flag to know if we are dealing with the same target host + _ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (response.geturl(), url))) + + if conf.scope: + if not re.search(conf.scope, url, re.I): + continue + elif not _: + continue + kb.targets.add(target) return retVal diff --git a/lib/utils/crawler.py b/lib/utils/crawler.py index 70f276720..fad86d007 100644 --- a/lib/utils/crawler.py +++ b/lib/utils/crawler.py @@ -70,12 +70,12 @@ class Crawler(object): url = urlparse.urljoin(conf.url, tag.get("href")) # 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])) + _ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (url, conf.url))) if conf.scope: if not re.search(conf.scope, url, re.I): continue - elif not target: + elif not _: continue if url.split('.')[-1].lower() not in CRAWL_EXCLUDE_EXTENSIONS: