FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlmap/tamper/charencode.py at master · sql9/sqlmap · GitHub
sql9
/
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
/
charencode.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (39 loc) · 1.35 KB
Breadcrumbs
sqlmap
/
tamper
/
charencode.py
Copy path
File metadata and controls
52 lines (39 loc) · 1.35 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
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import
string
from
lib
.
core
.
enums
import
PRIORITY
__priority__
=
PRIORITY
.
LOWEST
def
dependencies
():
pass
def
tamper
(
payload
,
**
kwargs
):
"""
Url-encodes all characters in a given payload (not processing already
encoded)
Tested against:
* Microsoft SQL Server 2005
* MySQL 4, 5.0 and 5.5
* Oracle 10g
* PostgreSQL 8.3, 8.4, 9.0
Notes:
* Useful to bypass very weak web application firewalls that do not
url-decode the request before processing it through their ruleset
* The web server will anyway pass the url-decoded version behind,
hence it should work against any DBMS
>>> tamper('SELECT FIELD FROM%20TABLE')
'%53%45%4C%45%43%54%20%46%49%45%4C%44%20%46%52%4F%4D%20%54%41%42%4C%45'
"""
retVal
=
payload
if
payload
:
retVal
=
""
i
=
0
while
i
<
len
(
payload
):
if
payload
[
i
]
==
'%'
and
(
i
<
len
(
payload
)
-
2
)
and
payload
[
i
+
1
:
i
+
2
]
in
string
.
hexdigits
and
payload
[
i
+
2
:
i
+
3
]
in
string
.
hexdigits
:
retVal
+=
payload
[
i
:
i
+
3
]
i
+=
3
else
:
retVal
+=
'%%%.2X'
%
ord
(
payload
[
i
])
i
+=
1
return
retVal
Back
|
FazBrowse Home
|
New Git URL