mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
Added unicode support also to PostgreSQL connector - see #184.
This commit is contained in:
parent
89c721a451
commit
e98b049e7f
|
@ -26,6 +26,7 @@ from lib.core.agent import agent
|
|||
from lib.core.common import dataToSessionFile
|
||||
from lib.core.convert import base64pickle
|
||||
from lib.core.convert import base64unpickle
|
||||
from lib.core.convert import utf8decode
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
|
@ -67,7 +68,10 @@ def direct(query, content=True):
|
|||
|
||||
if len(output) == 1:
|
||||
if len(output[0]) == 1:
|
||||
return unicode(list(output)[0][0])
|
||||
out = list(output)[0][0]
|
||||
if isinstance(out, str):
|
||||
out = utf8decode(out)
|
||||
return out
|
||||
else:
|
||||
return list(output)
|
||||
else:
|
||||
|
|
|
@ -24,6 +24,9 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
try:
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
|
||||
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
|
||||
except ImportError, _:
|
||||
pass
|
||||
|
||||
|
@ -54,6 +57,8 @@ class Connector(GenericConnector):
|
|||
except psycopg2.OperationalError, msg:
|
||||
raise sqlmapConnectionException, msg
|
||||
|
||||
self.connector.set_client_encoding('UNICODE')
|
||||
|
||||
self.setCursor()
|
||||
self.connected()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user