Minor bug fix to correctly deal with unicode queries with -d

This commit is contained in:
Bernardo Damele 2010-05-28 11:32:10 +00:00
parent 655bd79fc4
commit f26de89216
2 changed files with 8 additions and 0 deletions

View File

@ -100,3 +100,9 @@ def urlencode(string, safe=":/?%&=", convall=False):
result = urllib.quote(string, safe) result = urllib.quote(string, safe)
return result return result
def utf8encode(string):
return string.encode("utf-8")
def utf8decode(string):
return string.decode("utf-8")

View File

@ -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
@ -35,6 +36,7 @@ from lib.utils.timeout import timeout
def direct(query, content=True): def direct(query, content=True):
output = None output = None
select = False select = False
query = utf8decode(query)
query = agent.payloadDirect(query) query = agent.payloadDirect(query)
if kb.dbms == "Oracle" and query.startswith("SELECT ") and " FROM " not in query: if kb.dbms == "Oracle" and query.startswith("SELECT ") and " FROM " not in query: