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

Skip to content

Commit 304c982

Browse files
committed
Patch for an Issue #545
1 parent 7cb7c63 commit 304c982

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/core/agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,14 +961,16 @@ def extractPayload(self, inpStr):
961961
Extracts payload from inside of the input string
962962
"""
963963

964-
return extractRegexResult("(?s)%s(?P<result>.*?)%s" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), inpStr)
964+
_ = re.escape(PAYLOAD_DELIMITER)
965+
return extractRegexResult("(?s)%s(?P<result>.*?)%s" % (_, _), inpStr)
965966

966967
def replacePayload(self, inpStr, payload):
967968
"""
968969
Replaces payload inside the input string with a given payload
969970
"""
970971

971-
return re.sub("(%s.*?%s)" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER), ("%s%s%s" % (PAYLOAD_DELIMITER, payload, PAYLOAD_DELIMITER)).replace("\\", r"\\"), inpStr) if inpStr else inpStr
972+
_ = re.escape(PAYLOAD_DELIMITER)
973+
return re.sub("(%s.*?%s)" % (_, _), ("%s%s%s" % (PAYLOAD_DELIMITER, payload, PAYLOAD_DELIMITER)).replace("\\", r"\\"), inpStr) if inpStr else inpStr
972974

973975
def runAsDBMSUser(self, query):
974976
if conf.dbmsCred and "Ad Hoc Distributed Queries" not in query:

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
ASTERISK_MARKER = "__ASTERISK_MARK__"
4444
REPLACEMENT_MARKER = "__REPLACEMENT_MARK__"
4545

46-
PAYLOAD_DELIMITER = "\x00"
46+
PAYLOAD_DELIMITER = "\x00\x00\x00"
4747
CHAR_INFERENCE_MARK = "%c"
4848
PRINTABLE_CHAR_REGEX = r"[^\x00-\x1f\x7f-\xff]"
4949

0 commit comments

Comments
 (0)