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

Skip to content

Commit d492291

Browse files
committed
working on issue #12
1 parent 57f2fcc commit d492291

36 files changed

Lines changed: 72 additions & 72 deletions

lib/core/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def payloadDirect(self, query):
4646

4747
if kb.tamperFunctions:
4848
for function in kb.tamperFunctions:
49-
query = function(query)
49+
query, _ = function(payload=query, headers=None)
5050

5151
return query
5252

lib/core/option.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def __setTamperingFunctions():
802802
priority = PRIORITY.NORMAL if not hasattr(module, '__priority__') else module.__priority__
803803

804804
for name, function in inspect.getmembers(module, inspect.isfunction):
805-
if name == "tamper" and function.func_code.co_argcount == 1:
805+
if name == "tamper" and function.func_code.co_argcount == 2:
806806
found = True
807807
kb.tamperFunctions.append(function)
808808

@@ -829,7 +829,9 @@ def __setTamperingFunctions():
829829
function()
830830

831831
if not found:
832-
raise sqlmapGenericException, "missing function 'tamper(value)' in tamper script '%s'" % tfile
832+
errMsg = "missing function 'tamper(payload, headers)' "
833+
errMsg += "in tamper script '%s'" % tfile
834+
raise sqlmapGenericException, errMsg
833835

834836
if resolve_priorities and priorities:
835837
priorities.sort(reverse=True)

lib/request/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
550550
if payload:
551551
if kb.tamperFunctions:
552552
for function in kb.tamperFunctions:
553-
payload = function(payload)
553+
payload, auxHeaders = function(payload=payload, headers=auxHeaders)
554554

555555
value = agent.replacePayload(value, payload)
556556

tamper/apostrophemask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def dependencies():
1313
pass
1414

15-
def tamper(payload):
15+
def tamper(payload, headers):
1616
"""
1717
Replaces apostrophe character with its UTF-8 full width counterpart
1818
@@ -27,4 +27,4 @@ def tamper(payload):
2727
* http://lukasz.pilorz.net/testy/full_width_utf/index.phps
2828
"""
2929

30-
return payload.replace('\'', "%EF%BC%87") if payload else payload
30+
return payload.replace('\'', "%EF%BC%87") if payload else payload, headers

tamper/apostrophenullencode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def dependencies():
1313
pass
1414

15-
def tamper(payload):
15+
def tamper(payload, headers):
1616
"""
1717
Replaces apostrophe character with its illegal double unicode counterpart
1818
@@ -21,4 +21,4 @@ def tamper(payload):
2121
* Output: AND %00%271%00%27=%00%271%00%27
2222
"""
2323

24-
return payload.replace('\'', "%00%27") if payload else payload
24+
return payload.replace('\'', "%00%27") if payload else payload, headers

tamper/appendnullbyte.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def dependencies():
1313
pass
1414

15-
def tamper(payload):
15+
def tamper(payload, headers):
1616
"""
1717
Appends encoded NULL byte character at the end of payload
1818
@@ -31,4 +31,4 @@ def tamper(payload):
3131
Reference: http://projects.webappsec.org/w/page/13246949/Null-Byte-Injection
3232
"""
3333

34-
return "%s%%00" % payload if payload else payload
34+
return "%s%%00" % payload if payload else payload, headers

tamper/base64encode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def dependencies():
1515
pass
1616

17-
def tamper(payload):
17+
def tamper(payload, headers):
1818
"""
1919
Base64 all characters in a given payload
2020
@@ -23,4 +23,4 @@ def tamper(payload):
2323
* Output: MScgQU5EIFNMRUVQKDUpIw==
2424
"""
2525

26-
return base64.b64encode(payload) if payload else payload
26+
return base64.b64encode(payload) if payload else payload, headers

tamper/between.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def dependencies():
1313
pass
1414

15-
def tamper(payload):
15+
def tamper(payload, headers):
1616
"""
1717
Replaces greater than operator ('>') with 'NOT BETWEEN 0 AND #'
1818
@@ -61,5 +61,4 @@ def tamper(payload):
6161

6262
retVal += payload[i]
6363

64-
return retVal
65-
64+
return retVal, headers

tamper/chardoubleencode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def dependencies():
1515
pass
1616

17-
def tamper(payload):
17+
def tamper(payload, headers):
1818
"""
1919
Double url-encodes all characters in a given payload (not processing
2020
already encoded)
@@ -43,4 +43,4 @@ def tamper(payload):
4343
retVal += '%%25%.2X' % ord(payload[i])
4444
i += 1
4545

46-
return retVal
46+
return retVal, headers

tamper/charencode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def dependencies():
1515
pass
1616

17-
def tamper(payload):
17+
def tamper(payload, headers):
1818
"""
1919
Url-encodes all characters in a given payload (not processing already
2020
encoded)
@@ -50,4 +50,4 @@ def tamper(payload):
5050
retVal += '%%%.2X' % ord(payload[i])
5151
i += 1
5252

53-
return retVal
53+
return retVal, headers

0 commit comments

Comments
 (0)