Skip to content

Commit

Permalink
Merge pull request #1469 from p-l-/add-view-plugins
Browse files Browse the repository at this point in the history
Support plugins for db2view
  • Loading branch information
p-l- committed Jan 11, 2023
2 parents c1d13bd + e78199f commit 8596003
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion ivre/view.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env python

# This file is part of IVRE.
# Copyright 2011 - 2022 Pierre LALET <pierre@droids-corp.org>
# Copyright 2011 - 2023 Pierre LALET <pierre@droids-corp.org>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
Expand All @@ -24,6 +24,14 @@
from datetime import datetime
from textwrap import wrap

try:
from importlib.metadata import entry_points
except ImportError:
HAS_PLUGINS = False
else:
HAS_PLUGINS = True


from ivre import utils
from ivre.active.cpe import add_cpe_values
from ivre.active.data import (
Expand All @@ -40,6 +48,12 @@
from ivre.xmlnmap import add_service_hostname


def load_plugins():
for entry_point in entry_points(group="ivre.plugins.view"):
if entry_point.name.startswith("_install_"):
entry_point.load()(globals())


def _extract_passive_HTTP_CLIENT_HEADER_SERVER(rec):
"""Handle http client header about server."""
return {
Expand Down Expand Up @@ -950,3 +964,7 @@ def prepare_record(rec):
cur_addr = min(next_addrs, key=utils.ip2int)
if cur_rec is not None:
yield prepare_record(cur_rec)


if HAS_PLUGINS:
load_plugins()

0 comments on commit 8596003

Please sign in to comment.