This function checks for the dynamic content in the provided pages
(firstPage, secondPage)
| 1185 | return result |
| 1186 | |
| 1187 | def checkDynamicContent(firstPage, secondPage): |
| 1188 | """ |
| 1189 | This function checks for the dynamic content in the provided pages |
| 1190 | """ |
| 1191 | |
| 1192 | if kb.nullConnection: |
| 1193 | debugMsg = "dynamic content checking skipped " |
| 1194 | debugMsg += "because NULL connection used" |
| 1195 | logger.debug(debugMsg) |
| 1196 | return |
| 1197 | |
| 1198 | if any(page is None for page in (firstPage, secondPage)): |
| 1199 | warnMsg = "can't check dynamic content " |
| 1200 | warnMsg += "because of lack of page content" |
| 1201 | logger.critical(warnMsg) |
| 1202 | return |
| 1203 | |
| 1204 | if firstPage and secondPage and any(len(_) > MAX_DIFFLIB_SEQUENCE_LENGTH for _ in (firstPage, secondPage)): |
| 1205 | ratio = None |
| 1206 | else: |
| 1207 | try: |
| 1208 | seqMatcher = getCurrentThreadData().seqMatcher |
| 1209 | seqMatcher.set_seq1(firstPage) |
| 1210 | seqMatcher.set_seq2(secondPage) |
| 1211 | ratio = seqMatcher.quick_ratio() |
| 1212 | except MemoryError: |
| 1213 | ratio = None |
| 1214 | |
| 1215 | if ratio is None: |
| 1216 | kb.skipSeqMatcher = True |
| 1217 | |
| 1218 | # In case of an intolerable difference turn on dynamicity removal engine |
| 1219 | elif ratio <= UPPER_RATIO_BOUND: |
| 1220 | findDynamicContent(firstPage, secondPage) |
| 1221 | |
| 1222 | count = 0 |
| 1223 | while not Request.queryPage(): |
| 1224 | count += 1 |
| 1225 | |
| 1226 | if count > conf.retries: |
| 1227 | warnMsg = "target URL content appears to be too dynamic. " |
| 1228 | warnMsg += "Switching to '--text-only' " |
| 1229 | logger.warning(warnMsg) |
| 1230 | |
| 1231 | conf.textOnly = True |
| 1232 | return |
| 1233 | |
| 1234 | warnMsg = "target URL content appears to be heavily dynamic. " |
| 1235 | warnMsg += "sqlmap is going to retry the request(s)" |
| 1236 | singleTimeLogMessage(warnMsg, logging.CRITICAL) |
| 1237 | |
| 1238 | kb.heavilyDynamic = True |
| 1239 | |
| 1240 | secondPage, _, _ = Request.queryPage(content=True) |
| 1241 | findDynamicContent(firstPage, secondPage) |
| 1242 | |
| 1243 | def checkStability(): |
| 1244 | """ |
no test coverage detected
searching dependent graphs…