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.common import dataToSessionFile
|
||||||
from lib.core.convert import base64pickle
|
from lib.core.convert import base64pickle
|
||||||
from lib.core.convert import base64unpickle
|
from lib.core.convert import base64unpickle
|
||||||
|
from lib.core.convert import utf8decode
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
|
@ -67,7 +68,10 @@ def direct(query, content=True):
|
||||||
|
|
||||||
if len(output) == 1:
|
if len(output) == 1:
|
||||||
if len(output[0]) == 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:
|
else:
|
||||||
return list(output)
|
return list(output)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -24,6 +24,9 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
import psycopg2.extensions
|
||||||
|
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
|
||||||
|
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
|
||||||
except ImportError, _:
|
except ImportError, _:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -54,6 +57,8 @@ class Connector(GenericConnector):
|
||||||
except psycopg2.OperationalError, msg:
|
except psycopg2.OperationalError, msg:
|
||||||
raise sqlmapConnectionException, msg
|
raise sqlmapConnectionException, msg
|
||||||
|
|
||||||
|
self.connector.set_client_encoding('UNICODE')
|
||||||
|
|
||||||
self.setCursor()
|
self.setCursor()
|
||||||
self.connected()
|
self.connected()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user