mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +03:00
added support for reusing connections
This commit is contained in:
parent
f0729565a9
commit
1973024ebf
|
@ -45,7 +45,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
|
@ -89,4 +92,5 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
|
@ -83,3 +86,4 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
|
|
@ -47,7 +47,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
|
@ -87,3 +90,4 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
|
|
@ -46,7 +46,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
self.__dsn = cx_Oracle.makedsn(self.hostname, self.port, self.db)
|
||||
|
||||
|
@ -91,3 +94,4 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
|
|
@ -46,7 +46,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
|
@ -86,3 +89,4 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
|
|
@ -47,7 +47,10 @@ class Connector(GenericConnector):
|
|||
def __init__(self):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
def connect(self):
|
||||
def connect(self, reuse=True):
|
||||
if reuse and self.connector:
|
||||
return
|
||||
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
|
@ -87,3 +90,4 @@ class Connector(GenericConnector):
|
|||
def close(self):
|
||||
self.cursor.close()
|
||||
self.connector.close()
|
||||
self.closed()
|
||||
|
|
|
@ -46,6 +46,13 @@ class Connector:
|
|||
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname)
|
||||
infoMsg += ":%d established" % self.port
|
||||
logger.info(infoMsg)
|
||||
|
||||
def closed(self):
|
||||
self.connector = None
|
||||
self.cursor = None
|
||||
infoMsg = "connection to %s server %s" % (conf.dbms, self.hostname)
|
||||
infoMsg += ":%d closed" % self.port
|
||||
logger.info(infoMsg)
|
||||
|
||||
def connect(self):
|
||||
errMsg = "'connect' method must be defined "
|
||||
|
|
Loading…
Reference in New Issue
Block a user