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

Skip to content

Commit baf9ada

Browse files
committed
Fix for an Issue #889
1 parent 4e0e64d commit baf9ada

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/parse/sitemap.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8+
import httplib
89
import re
910

1011
from lib.core.common import readInput
1112
from lib.core.data import kb
1213
from lib.core.data import logger
14+
from lib.core.exception import SqlmapSyntaxException
1315
from lib.request.connect import Connect as Request
1416
from thirdparty.oset.pyoset import oset
1517

@@ -26,8 +28,13 @@ def parseSitemap(url, retVal=None):
2628
abortedFlag = False
2729
retVal = oset()
2830

29-
content = Request.getPage(url=url, raise404=True)[0] if not abortedFlag else ""
30-
for match in re.finditer(r"<loc>\s*([^<]+)", content):
31+
try:
32+
content = Request.getPage(url=url, raise404=True)[0] if not abortedFlag else ""
33+
except httplib.InvalidURL:
34+
errMsg = "invalid URL given for sitemap ('%s')" % url
35+
raise SqlmapSyntaxException, errMsg
36+
37+
for match in re.finditer(r"<loc>\s*([^<]+)", content or ""):
3138
if abortedFlag:
3239
break
3340
url = match.group(1).strip()

0 commit comments

Comments
 (0)