mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
replaced third-party library python-mysql with python pymysql, http://code.google.com/p/pymysql/ (MIT license)
This commit is contained in:
parent
e76cb19e35
commit
1cb12ea659
|
@ -57,7 +57,7 @@ for the database management system that you are going to attack:
|
||||||
<item>Firebird: <htmlurl name="python-kinterbasdb" url="http://kinterbasdb.sourceforge.net/">.
|
<item>Firebird: <htmlurl name="python-kinterbasdb" url="http://kinterbasdb.sourceforge.net/">.
|
||||||
<item>Microsoft Access: <htmlurl name="python-pyodbc" url="http://pyodbc.googlecode.com/">.
|
<item>Microsoft Access: <htmlurl name="python-pyodbc" url="http://pyodbc.googlecode.com/">.
|
||||||
<item>Microsoft SQL Server: <htmlurl name="python-pymssql" url="http://pymssql.sourceforge.net/">.
|
<item>Microsoft SQL Server: <htmlurl name="python-pymssql" url="http://pymssql.sourceforge.net/">.
|
||||||
<item>MySQL: <htmlurl name="python-mysqldb" url="http://mysql-python.sourceforge.net/">.
|
<item>MySQL: <htmlurl name="python pymysql" url="http://code.google.com/p/pymysql/">.
|
||||||
<item>Oracle: <htmlurl name="python cx_Oracle" url="http://cx-oracle.sourceforge.net/">.
|
<item>Oracle: <htmlurl name="python cx_Oracle" url="http://cx-oracle.sourceforge.net/">.
|
||||||
<item>PostgreSQL: <htmlurl name="python-psycopg2" url="http://initd.org/psycopg/">.
|
<item>PostgreSQL: <htmlurl name="python-psycopg2" url="http://initd.org/psycopg/">.
|
||||||
<item>SQLite: <htmlurl name="python-pysqlite2" url="http://pysqlite.googlecode.com/">.
|
<item>SQLite: <htmlurl name="python-pysqlite2" url="http://pysqlite.googlecode.com/">.
|
||||||
|
|
|
@ -1036,7 +1036,7 @@ def parseTargetDirect():
|
||||||
raise sqlmapMissingDependence, errMsg
|
raise sqlmapMissingDependence, errMsg
|
||||||
|
|
||||||
elif dbmsName == DBMS.MYSQL:
|
elif dbmsName == DBMS.MYSQL:
|
||||||
import MySQLdb
|
import pymysql
|
||||||
elif dbmsName == DBMS.PGSQL:
|
elif dbmsName == DBMS.PGSQL:
|
||||||
import psycopg2
|
import psycopg2
|
||||||
elif dbmsName == DBMS.ORACLE:
|
elif dbmsName == DBMS.ORACLE:
|
||||||
|
|
|
@ -159,7 +159,7 @@ SUPPORTED_DBMS = MSSQL_ALIASES + MYSQL_ALIASES + PGSQL_ALIASES + ORACLE_ALIASES
|
||||||
SUPPORTED_OS = ( "linux", "windows" )
|
SUPPORTED_OS = ( "linux", "windows" )
|
||||||
|
|
||||||
DBMS_DICT = { DBMS.MSSQL: [MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"],
|
DBMS_DICT = { DBMS.MSSQL: [MSSQL_ALIASES, "python-pymssql", "http://pymssql.sourceforge.net/"],
|
||||||
DBMS.MYSQL: [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
|
DBMS.MYSQL: [MYSQL_ALIASES, "python pymysql", "http://code.google.com/p/pymysql/"],
|
||||||
DBMS.PGSQL: [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
|
DBMS.PGSQL: [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
|
||||||
DBMS.ORACLE: [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
|
DBMS.ORACLE: [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
|
||||||
DBMS.SQLITE: [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
|
DBMS.SQLITE: [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
|
||||||
|
|
|
@ -32,7 +32,7 @@ def checkDependencies():
|
||||||
warnMsg += "Download from %s" % data[2]
|
warnMsg += "Download from %s" % data[2]
|
||||||
logger.warn(warnMsg)
|
logger.warn(warnMsg)
|
||||||
elif dbmsName == DBMS.MYSQL:
|
elif dbmsName == DBMS.MYSQL:
|
||||||
import MySQLdb
|
import pymysql
|
||||||
elif dbmsName == DBMS.PGSQL:
|
elif dbmsName == DBMS.PGSQL:
|
||||||
import psycopg2
|
import psycopg2
|
||||||
elif dbmsName == DBMS.ORACLE:
|
elif dbmsName == DBMS.ORACLE:
|
||||||
|
|
|
@ -8,7 +8,7 @@ See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import MySQLdb
|
import pymysql
|
||||||
except ImportError, _:
|
except ImportError, _:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -20,11 +20,11 @@ from plugins.generic.connector import Connector as GenericConnector
|
||||||
|
|
||||||
class Connector(GenericConnector):
|
class Connector(GenericConnector):
|
||||||
"""
|
"""
|
||||||
Homepage: http://mysql-python.sourceforge.net/
|
Homepage: http://code.google.com/p/pymysql/
|
||||||
User guide: http://mysql-python.sourceforge.net/MySQLdb.html
|
User guide: http://code.google.com/p/pymysql/
|
||||||
API: http://mysql-python.sourceforge.net/MySQLdb-1.2.2/
|
API: http://code.google.com/p/pymysql/
|
||||||
Debian package: python-mysqldb
|
Debian package: <none>
|
||||||
License: GPL
|
License: MIT
|
||||||
|
|
||||||
Possible connectors: http://wiki.python.org/moin/MySQL
|
Possible connectors: http://wiki.python.org/moin/MySQL
|
||||||
"""
|
"""
|
||||||
|
@ -36,8 +36,8 @@ class Connector(GenericConnector):
|
||||||
self.initConnection()
|
self.initConnection()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.connector = MySQLdb.connect(host=self.hostname, user=self.user, passwd=self.password, db=self.db, port=self.port, connect_timeout=conf.timeout, use_unicode=True)
|
self.connector = pymysql.connect(host=self.hostname, user=self.user, passwd=self.password, db=self.db, port=self.port, connect_timeout=conf.timeout, use_unicode=True)
|
||||||
except MySQLdb.OperationalError, msg:
|
except pymysql.OperationalError, msg:
|
||||||
raise sqlmapConnectionException, msg[1]
|
raise sqlmapConnectionException, msg[1]
|
||||||
|
|
||||||
self.setCursor()
|
self.setCursor()
|
||||||
|
@ -46,16 +46,16 @@ class Connector(GenericConnector):
|
||||||
def fetchall(self):
|
def fetchall(self):
|
||||||
try:
|
try:
|
||||||
return self.cursor.fetchall()
|
return self.cursor.fetchall()
|
||||||
except MySQLdb.ProgrammingError, msg:
|
except pymysql.ProgrammingError, msg:
|
||||||
logger.warn(msg[1])
|
logger.warn(msg[1])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def execute(self, query):
|
def execute(self, query):
|
||||||
try:
|
try:
|
||||||
self.cursor.execute(query)
|
self.cursor.execute(query)
|
||||||
except (MySQLdb.OperationalError, MySQLdb.ProgrammingError), msg:
|
except (pymysql.OperationalError, pymysql.ProgrammingError), msg:
|
||||||
logger.warn(msg[1])
|
logger.warn(msg[1])
|
||||||
except MySQLdb.InternalError, msg:
|
except pymysql.InternalError, msg:
|
||||||
raise sqlmapConnectionException, msg[1]
|
raise sqlmapConnectionException, msg[1]
|
||||||
|
|
||||||
self.connector.commit()
|
self.connector.commit()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user