After upgrading to Splunk 9.x the fix of reverting back to python 2 was no longer applicable so we dug into the code and made a few modifications to get the whois_lookup working with Python version 3.7. A big disclaimer on this as the code isn't thoroughly tested and my Python development skills are limited. network_tools/bin/network_tools_app/__init__.py # import configparser instead of ConfigParser for Python 3 compatibility
#try:
# import ConfigParser
#except ModuleNotFoundError:
# from configparser import ConfigParser
import configparser
...
# use configparser.ConfigParser() instead of ConfigParser.SafeConfigParser() for Python 3 Compatibility
# conf = ConfigParser.SafeConfigParser()
conf = configparser.ConfigParser()
... network_toolkit/networktools_app/custom_lookup.py ...
from logging import handlers
import threading
# Added for Python 3 compatibility
from builtins import str
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
...
# Use str instead of basestring for Python 3 compatibility
# if isinstance(value, (list, tuple)) and not isinstance(value, basestring):
if isinstance(value, (list, tuple)) and not isinstance(value, str):
... We also made some modification to network_toolkit/bin/whois_lookup.py to parse more fields for IP address lookups and populate the raw field.
... View more