That fixed it! Here were the steps:
(1) def extractIPs(fileContent):
pattern = r"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([ (\[]?(\.|dot)[ )\]]?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})"
ips = [each[0] for each in re.findall(pattern, fileContent)]
for item in ips:
location = ips.index(item)
ip = re.sub("[ ()\[\]]", "", item)
ip = re.sub("dot", ".", ip)
ips.remove(item)
ips.insert(location, ip)
return ips
#SCANNER_IP=SCANNER_SANE_NAME.split(' ')[-1]
try:
SCANNER_IP = extractIPs(SCANNER_SANE_NAME)[0]
except IndexError: # regex failed?
sys.exit(1)
(2) change the conf file like you said
Would it not make more sense to define SIZE2SANE in the python script rather than in the conf - depending on the sane scanner id, it could be set dynamically?
(1) def extractIPs(fileContent):
pattern = r"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([ (\[]?(\.|dot)[ )\]]?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})"
ips = [each[0] for each in re.findall(pattern, fileContent)]
for item in ips:
location = ips.index(item)
ip = re.sub("[ ()\[\]]", "", item)
ip = re.sub("dot", ".", ip)
ips.remove(item)
ips.insert(location, ip)
return ips
#SCANNER_IP=SCANNER_SANE_NAME.split(' ')[-1]
try:
SCANNER_IP = extractIPs(SCANNER_SANE_NAME)[0]
except IndexError: # regex failed?
sys.exit(1)
(2) change the conf file like you said
Would it not make more sense to define SIZE2SANE in the python script rather than in the conf - depending on the sane scanner id, it could be set dynamically?