FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlmap/lib/parse/payloads.py at master · baixiangcpp/sqlmap · GitHub
baixiangcpp
/
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
/
lib
/
parse
/
payloads.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
103 lines (79 loc) · 3.13 KB
Breadcrumbs
sqlmap
/
lib
/
parse
/
payloads.py
Copy path
File metadata and controls
103 lines (79 loc) · 3.13 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import
os
from
xml
.
etree
import
ElementTree
as
et
from
lib
.
core
.
data
import
conf
from
lib
.
core
.
data
import
logger
from
lib
.
core
.
data
import
paths
from
lib
.
core
.
datatype
import
AttribDict
from
lib
.
core
.
exception
import
SqlmapInstallationException
def
cleanupVals
(
text
,
tag
):
if
tag
in
(
"clause"
,
"where"
):
text
=
text
.
split
(
','
)
if
isinstance
(
text
,
basestring
):
text
=
int
(
text
)
if
text
.
isdigit
()
else
str
(
text
)
elif
isinstance
(
text
,
list
):
count
=
0
for
_
in
text
:
text
[
count
]
=
int
(
_
)
if
_
.
isdigit
()
else
str
(
_
)
count
+=
1
if
len
(
text
)
==
1
and
tag
not
in
(
"clause"
,
"where"
):
text
=
text
[
0
]
return
text
def
parseXmlNode
(
node
):
for
element
in
node
.
getiterator
(
'boundary'
):
boundary
=
AttribDict
()
for
child
in
element
.
getchildren
():
if
child
.
text
:
values
=
cleanupVals
(
child
.
text
,
child
.
tag
)
boundary
[
child
.
tag
]
=
values
else
:
boundary
[
child
.
tag
]
=
None
conf
.
boundaries
.
append
(
boundary
)
for
element
in
node
.
getiterator
(
'test'
):
test
=
AttribDict
()
for
child
in
element
.
getchildren
():
if
child
.
text
and
child
.
text
.
strip
():
values
=
cleanupVals
(
child
.
text
,
child
.
tag
)
test
[
child
.
tag
]
=
values
else
:
if
len
(
child
.
getchildren
())
==
0
:
test
[
child
.
tag
]
=
None
continue
else
:
test
[
child
.
tag
]
=
AttribDict
()
for
gchild
in
child
.
getchildren
():
if
gchild
.
tag
in
test
[
child
.
tag
]:
prevtext
=
test
[
child
.
tag
][
gchild
.
tag
]
test
[
child
.
tag
][
gchild
.
tag
]
=
[
prevtext
,
gchild
.
text
]
else
:
test
[
child
.
tag
][
gchild
.
tag
]
=
gchild
.
text
conf
.
tests
.
append
(
test
)
def
loadBoundaries
():
try
:
doc
=
et
.
parse
(
paths
.
BOUNDARIES_XML
)
except
Exception
,
ex
:
errMsg
=
"something seems to be wrong with "
errMsg
+=
"the file '%s' ('%s'). Please make "
%
(
paths
.
BOUNDARIES_XML
,
ex
)
errMsg
+=
"sure that you haven't made any changes to it"
raise
SqlmapInstallationException
,
errMsg
root
=
doc
.
getroot
()
parseXmlNode
(
root
)
def
loadPayloads
():
payloadFiles
=
os
.
listdir
(
paths
.
SQLMAP_XML_PAYLOADS_PATH
)
payloadFiles
.
sort
()
for
payloadFile
in
payloadFiles
:
payloadFilePath
=
os
.
path
.
join
(
paths
.
SQLMAP_XML_PAYLOADS_PATH
,
payloadFile
)
#logger.debug("Parsing payloads from file '%s'" % payloadFile)
try
:
doc
=
et
.
parse
(
payloadFilePath
)
except
Exception
,
ex
:
errMsg
=
"something seems to be wrong with "
errMsg
+=
"the file '%s' ('%s'). Please make "
%
(
payloadFilePath
,
ex
)
errMsg
+=
"sure that you haven't made any changes to it"
raise
SqlmapInstallationException
,
errMsg
root
=
doc
.
getroot
()
parseXmlNode
(
root
)
Back
|
FazBrowse Home
|
New Git URL