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

Skip to content

Commit 70e87d9

Browse files
committed
update of dynamicity engine
1 parent ee4e04e commit 70e87d9

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

lib/controller/checks.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from lib.core.common import randomStr
2222
from lib.core.common import readInput
2323
from lib.core.common import showStaticWords
24+
from lib.core.common import trimAlphaNum
2425
from lib.core.common import wasLastRequestDBMSError
2526
from lib.core.common import DynamicContentItem
2627
from lib.core.data import conf
@@ -435,11 +436,8 @@ def checkDynamicContent(firstPage, secondPage):
435436
if suffix is None and (blocks[i][0] + blocks[i][2] >= len(firstPage)):
436437
continue
437438

438-
while prefix and prefix[-1].isalnum():
439-
prefix = prefix[:-1]
440-
441-
while suffix and suffix[0].isalnum():
442-
suffix = suffix[1:]
439+
prefix = trimAlphaNum(prefix)
440+
suffix = trimAlphaNum(suffix)
443441

444442
kb.dynamicMarkings.append((re.escape(prefix[-conf.dynMarkLength:]) if prefix else None, re.escape(suffix[:conf.dynMarkLength]) if suffix else None))
445443

lib/core/common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,3 +1627,15 @@ def extractRegexResult(regex, content, flags=0):
16271627
retVal = match.group("result")
16281628

16291629
return retVal
1630+
1631+
def trimAlphaNum(value):
1632+
"""
1633+
Trims alpha numeric characters from start and ending of a given value
1634+
"""
1635+
while value and value[-1].isalnum():
1636+
value = value[:-1]
1637+
1638+
while value and value[0].isalnum():
1639+
value = value[1:]
1640+
1641+
return value

0 commit comments

Comments
 (0)