forked from rapid7/insightconnect-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a0f01a
commit c80e0de
Showing
11 changed files
with
773 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
|
||
from .vulnerability_lookup.action import VulnerabilityLookup | ||
|
||
from .timeline_lookup.action import TimelineLookup |
2 changes: 2 additions & 0 deletions
2
plugins/greynoise/icon_greynoise/actions/timeline_lookup/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT | ||
from .action import TimelineLookup |
35 changes: 35 additions & 0 deletions
35
plugins/greynoise/icon_greynoise/actions/timeline_lookup/action.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import insightconnect_plugin_runtime | ||
from .schema import TimelineLookupInput, TimelineLookupOutput, Input, Output, Component | ||
# Custom imports below | ||
|
||
|
||
class TimelineLookup(insightconnect_plugin_runtime.Action): | ||
|
||
def __init__(self): | ||
super(self.__class__, self).__init__( | ||
name="timeline_lookup", | ||
description=Component.DESCRIPTION, | ||
input=TimelineLookupInput(), | ||
output=TimelineLookupOutput()) | ||
|
||
def run(self, params={}): | ||
# START INPUT BINDING - DO NOT REMOVE - ANY INPUTS BELOW WILL UPDATE WITH YOUR PLUGIN SPEC AFTER REGENERATION | ||
ip_address = params.get(Input.IP_ADDRESS) | ||
# END INPUT BINDING - DO NOT REMOVE | ||
|
||
try: | ||
resp = self.connection.gn_client.timelinedaily(ip_address) | ||
|
||
except RequestFailure as e: | ||
raise PluginException( | ||
cause=f"API responded with ERROR: {e.args[0]} - {e.args[1]}.", | ||
assistance="Please check error and try again.", | ||
) | ||
|
||
except ValueError as e: | ||
raise PluginException( | ||
cause=f"Input does not appear to be valid: {ip_address}. Error Message: {e.args[0]}", | ||
assistance="Please provide a valid IPv4 Address.", | ||
) | ||
|
||
return resp |
Oops, something went wrong.