mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Major enhancement to directly connect to the dbms without passing via a sql injection: adapted code accordingly - see #158. This feature relies on python third-party libraries to be able to connect to the database. For the moment it has been implemented for MySQL (with python-mysqldb module) and PostgreSQL (with python-psycopg2 module).
Minor layout adjustments.
This commit is contained in:
parent
4ca1adba2c
commit
1416cd0d86
32 changed files with 791 additions and 122 deletions
|
|
@ -44,12 +44,25 @@ class Agent:
|
|||
temp.start = randomStr(6)
|
||||
temp.stop = randomStr(6)
|
||||
|
||||
def payloadDirect(self, query):
|
||||
if query.startswith(" AND "):
|
||||
query = query.replace(" AND ", "SELECT ")
|
||||
elif query.startswith(" UNION ALL "):
|
||||
query = query.replace(" UNION ALL ", "")
|
||||
elif query.startswith("; "):
|
||||
query = query.replace("; ", "")
|
||||
|
||||
return query
|
||||
|
||||
def payload(self, place=None, parameter=None, value=None, newValue=None, negative=False, falseCond=False):
|
||||
"""
|
||||
This method replaces the affected parameter with the SQL
|
||||
injection statement to request
|
||||
"""
|
||||
|
||||
if conf.direct:
|
||||
return self.payloadDirect(newValue)
|
||||
|
||||
falseValue = ""
|
||||
negValue = ""
|
||||
retValue = ""
|
||||
|
|
@ -83,6 +96,9 @@ class Agent:
|
|||
return retValue
|
||||
|
||||
def fullPayload(self, query):
|
||||
if conf.direct:
|
||||
return self.payloadDirect(query)
|
||||
|
||||
query = self.prefixQuery(query)
|
||||
query = self.postfixQuery(query)
|
||||
payload = self.payload(newValue=query)
|
||||
|
|
@ -96,6 +112,9 @@ class Agent:
|
|||
identified as valid
|
||||
"""
|
||||
|
||||
if conf.direct:
|
||||
return self.payloadDirect(string)
|
||||
|
||||
query = ""
|
||||
|
||||
if conf.prefix:
|
||||
|
|
@ -123,6 +142,9 @@ class Agent:
|
|||
SQL injection request
|
||||
"""
|
||||
|
||||
if conf.direct:
|
||||
return self.payloadDirect(string)
|
||||
|
||||
randInt = randomInt()
|
||||
randStr = randomStr()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue