|
15 | 15 | from lib.core.common import clearConsoleLine |
16 | 16 | from lib.core.common import dataToStdout |
17 | 17 | from lib.core.common import findPageForms |
| 18 | +from lib.core.common import getSafeExString |
18 | 19 | from lib.core.common import openFile |
19 | 20 | from lib.core.common import readInput |
20 | 21 | from lib.core.common import safeCSValue |
@@ -127,20 +128,26 @@ def crawlThread(): |
127 | 128 | message += "site's sitemap(.xml) [y/N] " |
128 | 129 | test = readInput(message, default="n") |
129 | 130 | if test[0] in ("y", "Y"): |
| 131 | + found = True |
130 | 132 | items = None |
131 | 133 | url = urlparse.urljoin(target, "/sitemap.xml") |
132 | 134 | try: |
133 | 135 | items = parseSitemap(url) |
| 136 | + except SqlmapConnectionException, ex: |
| 137 | + if "page not found" in getSafeExString(ex): |
| 138 | + found = False |
| 139 | + logger.warn("'sitemap.xml' not found") |
134 | 140 | except: |
135 | 141 | pass |
136 | 142 | finally: |
137 | | - if items: |
138 | | - for item in items: |
139 | | - if re.search(r"(.*?)\?(.+)", item): |
140 | | - threadData.shared.value.add(item) |
141 | | - if conf.crawlDepth > 1: |
142 | | - threadData.shared.unprocessed.update(items) |
143 | | - logger.info("%s links found" % ("no" if not items else len(items))) |
| 143 | + if found: |
| 144 | + if items: |
| 145 | + for item in items: |
| 146 | + if re.search(r"(.*?)\?(.+)", item): |
| 147 | + threadData.shared.value.add(item) |
| 148 | + if conf.crawlDepth > 1: |
| 149 | + threadData.shared.unprocessed.update(items) |
| 150 | + logger.info("%s links found" % ("no" if not items else len(items))) |
144 | 151 |
|
145 | 152 | infoMsg = "starting crawler" |
146 | 153 | if conf.bulkFile: |
|
0 commit comments