FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlmap/plugins/dbms/sqlite/syntax.py at master · kxcode/sqlmap · GitHub
kxcode
/
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
/
plugins
/
dbms
/
sqlite
/
syntax.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (32 loc) · 1.25 KB
Breadcrumbs
sqlmap
/
plugins
/
dbms
/
sqlite
/
syntax.py
Copy path
File metadata and controls
41 lines (32 loc) · 1.25 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
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import
binascii
from
lib
.
core
.
common
import
Backend
from
lib
.
core
.
common
import
isDBMSVersionAtLeast
from
lib
.
core
.
settings
import
UNICODE_ENCODING
from
plugins
.
generic
.
syntax
import
Syntax
as
GenericSyntax
class
Syntax
(
GenericSyntax
):
def
__init__
(
self
):
GenericSyntax
.
__init__
(
self
)
@
staticmethod
def
escape
(
expression
,
quote
=
True
):
"""
>>> Backend.setVersion('2')
['2']
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar")
"SELECT 'abcdefgh' FROM foobar"
>>> Backend.setVersion('3')
['3']
>>> Syntax.escape("SELECT 'abcdefgh' FROM foobar")
"SELECT CAST(X'6162636465666768' AS TEXT) FROM foobar"
"""
def
escaper
(
value
):
# Reference: http://stackoverflow.com/questions/3444335/how-do-i-quote-a-utf-8-string-literal-in-sqlite3
return
"CAST(X'%s' AS TEXT)"
%
binascii
.
hexlify
(
value
.
encode
(
UNICODE_ENCODING
)
if
isinstance
(
value
,
unicode
)
else
value
)
retVal
=
expression
if
isDBMSVersionAtLeast
(
'3'
):
retVal
=
Syntax
.
_escape
(
expression
,
quote
,
escaper
)
return
retVal
Back
|
FazBrowse Home
|
New Git URL