Пример #1
0
    if script_dir not in sys.path:
        sys.path.insert(0, script_dir)
else:
    script_dir, script_name = os.path.split(os.path.realpath(__file__))
os.chdir(script_dir)

# Now we can import our custom modules
import securecrt_tools.sessions as sessions
import securecrt_tools.settings as settings
import securecrt_tools.utilities as utils

# ################################################  LOAD SETTINGS   ###################################################

session_set_filename = os.path.join(script_dir, "settings",
                                    settings.global_settings_filename)
session_settings = settings.SettingsImporter(session_set_filename,
                                             settings.global_defs)

local_set_filename = os.path.join(script_dir, "settings",
                                  script_name.replace(".py", ".json"))
local_settings_default = {
    '__version':
    "1.0",
    '_session_path_comment':
    "session_path roots in the SecureCRT Sessions directory.  USE "
    "FORWARD SLASHES OR DOUBLE-BACKSLASHES IN SESSION PATHS! SINGLE "
    "BACKSLASHES WILL ERROR.",
    'session_path':
    "_imports",
    '_strip_domains_comment':
    "A list of strings to remove if found in the device ID of CDP "
    "output",
Пример #2
0
    if script_dir not in sys.path:
        sys.path.insert(0, script_dir)
else:
    script_dir, script_name = os.path.split(os.path.realpath(__file__))
os.chdir(script_dir)

# Now we can import our custom modules
import securecrt_tools.sessions as sessions
import securecrt_tools.settings as settings
import securecrt_tools.utilities as utils

# ################################################  LOAD SETTINGS   ###################################################

session_set_filename = os.path.join(script_dir, "settings",
                                    settings.global_settings_filename)
session_settings = settings.SettingsImporter(session_set_filename,
                                             settings.global_defs)

# Set logger variable -- this won't be used unless debug setting is True
logger = logging.getLogger("securecrt")

# ################################################     SCRIPT       ###################################################


def script_main(session):
    supported_os = ["IOS", "NXOS"]
    if session.os not in supported_os:
        logger.debug("Unsupported OS: {0}.  Exiting program.".format(
            session.os))
        session.message_box(
            "{0} is not a supported OS for this script.".format(session.os),
            "Unsupported OS",