|
22 | 22 | from lib.core.settings import HTML_TITLE_REGEX
|
23 | 23 | from lib.core.settings import MIN_RATIO
|
24 | 24 | from lib.core.settings import MAX_RATIO
|
| 25 | +from lib.core.settings import REFLECTED_VALUE_MARKER |
25 | 26 | from lib.core.settings import LOWER_RATIO_BOUND
|
26 | 27 | from lib.core.settings import UPPER_RATIO_BOUND
|
27 | 28 | from lib.core.threads import getCurrentThreadData
|
@@ -114,16 +115,26 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
|
114 | 115 | seq1 = getFilteredPageContent(seqMatcher.a, True) if conf.textOnly else seqMatcher.a
|
115 | 116 | seq2 = getFilteredPageContent(page, True) if conf.textOnly else page
|
116 | 117 |
|
117 |
| - if seq1 is not None: |
118 |
| - seqMatcher.set_seq1(seq1) |
119 |
| - |
120 |
| - if seq2 is not None: |
121 |
| - seqMatcher.set_seq2(seq2) |
122 |
| - |
123 | 118 | if seq1 is None or seq2 is None:
|
124 | 119 | return None
|
125 |
| - else: |
126 |
| - ratio = round(seqMatcher.quick_ratio(), 3) |
| 120 | + |
| 121 | + seq1 = seq1.replace(REFLECTED_VALUE_MARKER, "") |
| 122 | + seq2 = seq2.replace(REFLECTED_VALUE_MARKER, "") |
| 123 | + |
| 124 | + count = 0 |
| 125 | + while count < min(len(seq1), len(seq2)): |
| 126 | + if seq1[count] == seq2[count]: |
| 127 | + count += 1 |
| 128 | + else: |
| 129 | + break |
| 130 | + if count: |
| 131 | + seq1 = seq1[count:] |
| 132 | + seq2 = seq2[count:] |
| 133 | + |
| 134 | + seqMatcher.set_seq1(seq1) |
| 135 | + seqMatcher.set_seq2(seq2) |
| 136 | + |
| 137 | + ratio = round(seqMatcher.quick_ratio(), 3) |
127 | 138 |
|
128 | 139 | # If the url is stable and we did not set yet the match ratio and the
|
129 | 140 | # current injected value changes the url page content
|
|
0 commit comments