mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 19:13:48 +03:00
Minor refactoring
This commit is contained in:
parent
75d1dab895
commit
c0946ce2c9
|
@ -49,6 +49,7 @@ from lib.core.unescaper import unescaper
|
|||
from lib.request.connect import Connect as Request
|
||||
from lib.request.direct import direct
|
||||
from lib.techniques.blind.inference import bisection
|
||||
from lib.techniques.dns.test import dnsTest
|
||||
from lib.techniques.dns.use import dnsUse
|
||||
from lib.techniques.error.use import errorUse
|
||||
from lib.techniques.union.use import unionUse
|
||||
|
@ -85,19 +86,7 @@ def __goDns(payload, expression):
|
|||
|
||||
if conf.dnsDomain and kb.dnsTest is not False:
|
||||
if kb.dnsTest is None:
|
||||
logger.info("testing for data retrieval through DNS channel")
|
||||
|
||||
randInt = randomInt()
|
||||
kb.dnsTest = dnsUse(payload, "SELECT %d%s" % (randInt, FROM_DUMMY_TABLE.get(Backend.getIdentifiedDbms(), ""))) == str(randInt)
|
||||
|
||||
if not kb.dnsTest:
|
||||
errMsg = "data retrieval through DNS channel failed. Turning off DNS exfiltration support"
|
||||
logger.error(errMsg)
|
||||
|
||||
conf.dnsDomain = None
|
||||
else:
|
||||
infoMsg = "data retrieval through DNS channel was successful"
|
||||
logger.info(infoMsg)
|
||||
dnsTest(payload)
|
||||
|
||||
if kb.dnsTest:
|
||||
value = dnsUse(payload, expression)
|
||||
|
|
32
lib/techniques/dns/test.py
Normal file
32
lib/techniques/dns/test.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
$Id$
|
||||
|
||||
Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/)
|
||||
See the file 'doc/COPYING' for copying permission
|
||||
"""
|
||||
|
||||
from lib.core.common import Backend
|
||||
from lib.core.common import randomInt
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import kb
|
||||
from lib.core.data import logger
|
||||
from lib.core.settings import FROM_DUMMY_TABLE
|
||||
from lib.techniques.dns.use import dnsUse
|
||||
|
||||
|
||||
def dnsTest(payload):
|
||||
logger.info("testing for data retrieval through DNS channel")
|
||||
|
||||
randInt = randomInt()
|
||||
kb.dnsTest = dnsUse(payload, "SELECT %d%s" % (randInt, FROM_DUMMY_TABLE.get(Backend.getIdentifiedDbms(), ""))) == str(randInt)
|
||||
|
||||
if not kb.dnsTest:
|
||||
errMsg = "data retrieval through DNS channel failed. Turning off DNS exfiltration support"
|
||||
logger.error(errMsg)
|
||||
|
||||
conf.dnsDomain = None
|
||||
else:
|
||||
infoMsg = "data retrieval through DNS channel was successful"
|
||||
logger.info(infoMsg)
|
|
@ -34,11 +34,29 @@ from lib.core.data import logger
|
|||
from lib.core.data import queries
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.settings import FROM_DUMMY_TABLE
|
||||
from lib.core.settings import MAX_DNS_LABEL
|
||||
from lib.core.settings import PARTIAL_VALUE_MARKER
|
||||
from lib.core.unescaper import unescaper
|
||||
from lib.request.connect import Connect as Request
|
||||
|
||||
|
||||
def dnsTest(payload):
|
||||
logger.info("testing for data retrieval through DNS channel")
|
||||
|
||||
randInt = randomInt()
|
||||
kb.dnsTest = dnsUse(payload, "SELECT %d%s" % (randInt, FROM_DUMMY_TABLE.get(Backend.getIdentifiedDbms(), ""))) == str(randInt)
|
||||
|
||||
if not kb.dnsTest:
|
||||
errMsg = "data retrieval through DNS channel failed. Turning off DNS exfiltration support"
|
||||
logger.error(errMsg)
|
||||
|
||||
conf.dnsDomain = None
|
||||
else:
|
||||
infoMsg = "data retrieval through DNS channel was successful"
|
||||
logger.info(infoMsg)
|
||||
|
||||
|
||||
def dnsUse(payload, expression):
|
||||
"""
|
||||
Retrieve the output of a SQL query taking advantage of the DNS
|
||||
|
|
Loading…
Reference in New Issue
Block a user