Skip to content

Commit cedfdc7

Browse files
committed
Adding escapequotes.py (utility tamper script)
1 parent 08aae2b commit cedfdc7

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/request/connect.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class WebSocketException(Exception):
8080
from lib.core.exception import SqlmapTokenException
8181
from lib.core.exception import SqlmapValueException
8282
from lib.core.settings import ASTERISK_MARKER
83+
from lib.core.settings import BOUNDARY_BACKSLASH_MARKER
8384
from lib.core.settings import CUSTOM_INJECTION_MARK_CHAR
8485
from lib.core.settings import DEFAULT_CONTENT_TYPE
8586
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
@@ -765,7 +766,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
765766

766767
value = agent.replacePayload(value, payload)
767768

768-
logger.log(CUSTOM_LOGGING.PAYLOAD, safecharencode(payload))
769+
logger.log(CUSTOM_LOGGING.PAYLOAD, safecharencode(payload.replace('\\', BOUNDARY_BACKSLASH_MARKER)).replace(BOUNDARY_BACKSLASH_MARKER, '\\'))
769770

770771
if place == PLACE.CUSTOM_POST and kb.postHint:
771772
if kb.postHint in (POST_HINT.SOAP, POST_HINT.XML):

tamper/escapequotes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
5+
See the file 'doc/COPYING' for copying permission
6+
"""
7+
8+
import base64
9+
10+
from lib.core.enums import PRIORITY
11+
from lib.core.settings import UNICODE_ENCODING
12+
13+
__priority__ = PRIORITY.LOWEST
14+
15+
def dependencies():
16+
pass
17+
18+
def tamper(payload, **kwargs):
19+
"""
20+
Slash escape quotes (' and ")
21+
22+
>>> tamper("1' AND SLEEP(5)#")
23+
'1\' AND SLEEP(5)#'
24+
"""
25+
26+
return payload.replace("'", "\\'").replace('"', '\\"')

0 commit comments

Comments
 (0)