MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / checkSameHost

Function checkSameHost

lib/core/common.py:4791–4811  ·  view source on GitHub ↗

Returns True if all provided urls share that same host >>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target.com/images/page2.php') True >>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target2.com/images/page2.php') False

(*urls)

Source from the content-addressed store, hash-verified

4789 return retVal
4790
4791def checkSameHost(*urls):
4792 """
4793 Returns True if all provided urls share that same host
4794
4795 >>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target.com/images/page2.php')
4796 True
4797 >>> checkSameHost('http://www.target.com/page1.php?id=1', 'http://www.target2.com/images/page2.php')
4798 False
4799 """
4800
4801 if not urls:
4802 return None
4803 elif len(urls) == 1:
4804 return True
4805 else:
4806 def _(value):
4807 if value and not re.search(r"\A\w+://", value):
4808 value = "http://%s" % value
4809 return value
4810
4811 return all(re.sub(r"(?i)\Awww\.", "", _urllib.parse.urlparse(_(url) or "").netloc.split(':')[0]) == re.sub(r"(?i)\Awww\.", "", _urllib.parse.urlparse(_(urls[0]) or "").netloc.split(':')[0]) for url in urls[1:])
4812
4813def getHostHeader(url):
4814 """

Callers 3

crawlThreadFunction · 0.90
getPageMethod · 0.90
findPageFormsFunction · 0.85

Calls 1

_Function · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…