Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit baccbd6

Browse files
committed
Implementation for an Issue #283
1 parent ab67344 commit baccbd6

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3110,6 +3110,17 @@ def geturl(self):
31103110

31113111
if addToTargets and retVal:
31123112
for target in retVal:
3113+
url = target[0]
3114+
3115+
# flag to know if we are dealing with the same target host
3116+
_ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (response.geturl(), url)))
3117+
3118+
if conf.scope:
3119+
if not re.search(conf.scope, url, re.I):
3120+
continue
3121+
elif not _:
3122+
continue
3123+
31133124
kb.targets.add(target)
31143125

31153126
return retVal

lib/utils/crawler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def crawlThread():
7070
url = urlparse.urljoin(conf.url, tag.get("href"))
7171

7272
# flag to know if we are dealing with the same target host
73-
target = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], [url, conf.url]))
73+
_ = reduce(lambda x, y: x == y, map(lambda x: urlparse.urlparse(x).netloc.split(':')[0], (url, conf.url)))
7474

7575
if conf.scope:
7676
if not re.search(conf.scope, url, re.I):
7777
continue
78-
elif not target:
78+
elif not _:
7979
continue
8080

8181
if url.split('.')[-1].lower() not in CRAWL_EXCLUDE_EXTENSIONS:

0 commit comments

Comments
 (0)