hawat.blueprints.whois package
This pluggable module provides access to local WHOIS service. It is implemented
upon custom mentat.services.whois
module. The main purpose of the WHOIS
service in Mentat system is to resolve abuse contacts for event sources to enable
automated event reporting capabilities. Another use case is data access management
directed by abuse group memberships in web interface.
This module enables access to internal WHOIS database and enables users to input queries. The main use case scenario is a validation of target abuse contact for particular source address/network.
Provided endpoints
/whois/search
Endpoint providing search form for querying local WHOIS service and formating result as HTML page.
Authentication: login required
Methods:
GET
/api/whois/search
Endpoint providing API search form for querying local WHOIS service and formating result as JSON document.
Authentication: login required
Authorization: any role
Methods:
GET
,POST
/snippet/whois/search
Endpoint providing API search form for querying local WHOIS service and formating result as JSON document containing HTML snippets.
Authentication: login required
Authorization: any role
Methods:
GET
,POST
- class hawat.blueprints.whois.APISearchView[source]
Bases:
AJAXMixin
,AbstractSearchView
View responsible for querying local WHOIS service and presenting the results in the form of JSON document.
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.whois.AbstractSearchView[source]
Bases:
RenderableView
Application view providing base search capabilities for local WHOIS service.
The querying is implemented using
mentat.services.whois
module.- authentication = True
Similar to the
decorators
mechanism in Flask pluggable views, you may use this class variable to specify, that the view is protected by authentication. During the process of registering the view into the blueprint inhawat.app.hawatBlueprint.register_view_class()
the view will be automatically decorated withflask_login.login_required()
decorator.The advantage of using this in favor of
decorators
is that the application menu can automatically hide/show items inaccessible to current user.This is a scalar variable that must contain boolean
True
orFalse
.
- dispatch_request()[source]
Mandatory interface required by the
flask.views.View.dispatch_request()
. Will be called by the Flask framework to service the request.
Return menu entry title for the view.
Default implementation returns the return value of
hawat.view.BaseView.get_view_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Menu entry title for the view.
- Return type
str
- classmethod get_view_title(**kwargs)[source]
Return title for the view, that will be displayed in the
title
tag of HTMLhead
element and also as the content of page header inh2
tag.Default implementation returns the return value of
hawat.view.BaseView.get_menu_title()
method by default.- Parameters
kwargs (dict) – Optional parameters.
- Returns
Title for the view.
- Return type
str
- hawat.blueprints.whois.BLUEPRINT_NAME = 'whois'
Name of the blueprint as module global constant.
- class hawat.blueprints.whois.SearchView[source]
Bases:
HTMLMixin
,AbstractSearchView
View responsible for querying local WHOIS service and presenting the results in the form of HTML page.
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- class hawat.blueprints.whois.SnippetSearchView[source]
Bases:
SnippetMixin
,AbstractSearchView
View responsible for querying local WHOIS service and presenting the results in the form of JSON document containing ready to use HTML page snippets.
- classmethod get_view_name()[source]
Return unique name for the view. Name must be unique in the namespace of parent blueprint/module and should contain only characters
[a-z0-9]
. It will be used for generating endpoint name for the view.This method does not have any default implementation and must be overridden by a subclass.
- Returns
Name for the view.
- Return type
str
- methods: ClassVar[Optional[Collection[str]]] = ['GET', 'POST']
The methods this view is registered for. Uses the same default (
["GET", "HEAD", "OPTIONS"]
) asroute
andadd_url_rule
by default.
- renders = ['label', 'full']
- snippets = [{'name': 'abuse', 'condition': <function SnippetSearchView.<lambda>>}]
- class hawat.blueprints.whois.WhoisBlueprint(name, import_name, **kwargs)[source]
Bases:
HawatBlueprint
Pluggable module - Local WHOIS service (whois).
- hawat.blueprints.whois.get_blueprint()[source]
Mandatory interface for
hawat.Hawat
and factory function. This function must return a valid instance ofhawat.app.HawatBlueprint
orflask.Blueprint
.