FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlmap/lib/parse/handler.py at master · codeinpeace/sqlmap · GitHub
codeinpeace
/
sqlmap
Public
forked from
sqlmapproject/sqlmap
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
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
/
handler.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
78 lines (60 loc) · 2.6 KB
Breadcrumbs
sqlmap
/
lib
/
parse
/
handler.py
Copy path
File metadata and controls
78 lines (60 loc) · 2.6 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
#!/usr/bin/env python
"""
Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import
re
from
xml
.
sax
.
handler
import
ContentHandler
from
lib
.
core
.
common
import
sanitizeStr
class
FingerprintHandler
(
ContentHandler
):
"""
This class defines methods to parse and extract information from
the given DBMS banner based upon the data in XML file
"""
def
__init__
(
self
,
banner
,
info
):
ContentHandler
.
__init__
(
self
)
self
.
_banner
=
sanitizeStr
(
banner
)
self
.
_regexp
=
None
self
.
_match
=
None
self
.
_dbmsVersion
=
None
self
.
_techVersion
=
None
self
.
_info
=
info
def
_feedInfo
(
self
,
key
,
value
):
value
=
sanitizeStr
(
value
)
if
value
in
(
None
,
"None"
):
return
if
key
==
"dbmsVersion"
:
self
.
_info
[
key
]
=
value
else
:
if
key
not
in
self
.
_info
.
keys
():
self
.
_info
[
key
]
=
set
()
for
_
in
value
.
split
(
"|"
):
self
.
_info
[
key
].
add
(
_
)
def
startElement
(
self
,
name
,
attrs
):
if
name
==
"regexp"
:
self
.
_regexp
=
sanitizeStr
(
attrs
.
get
(
"value"
))
_
=
re
.
match
(
"\A[A-Za-z0-9]+"
,
self
.
_regexp
)
# minor trick avoiding compiling of large amount of regexes
if
_
and
_
.
group
(
0
).
lower
()
in
self
.
_banner
.
lower
()
or
not
_
:
self
.
_match
=
re
.
search
(
self
.
_regexp
,
self
.
_banner
,
re
.
I
|
re
.
M
)
else
:
self
.
_match
=
None
if
name
==
"info"
and
self
.
_match
:
self
.
_feedInfo
(
"type"
,
attrs
.
get
(
"type"
))
self
.
_feedInfo
(
"distrib"
,
attrs
.
get
(
"distrib"
))
self
.
_feedInfo
(
"release"
,
attrs
.
get
(
"release"
))
self
.
_feedInfo
(
"codename"
,
attrs
.
get
(
"codename"
))
self
.
_dbmsVersion
=
sanitizeStr
(
attrs
.
get
(
"dbms_version"
))
self
.
_techVersion
=
sanitizeStr
(
attrs
.
get
(
"tech_version"
))
self
.
_sp
=
sanitizeStr
(
attrs
.
get
(
"sp"
))
if
self
.
_dbmsVersion
.
isdigit
():
self
.
_feedInfo
(
"dbmsVersion"
,
self
.
_match
.
group
(
int
(
self
.
_dbmsVersion
)))
if
self
.
_techVersion
.
isdigit
():
self
.
_feedInfo
(
"technology"
,
"%s %s"
%
(
attrs
.
get
(
"technology"
),
self
.
_match
.
group
(
int
(
self
.
_techVersion
))))
else
:
self
.
_feedInfo
(
"technology"
,
attrs
.
get
(
"technology"
))
if
self
.
_sp
.
isdigit
():
self
.
_feedInfo
(
"sp"
,
"Service Pack %s"
%
self
.
_match
.
group
(
int
(
self
.
_sp
)))
self
.
_regexp
=
None
self
.
_match
=
None
self
.
_dbmsVersion
=
None
self
.
_techVersion
=
None
Back
|
FazBrowse Home
|
New Git URL