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
c80e0de
commit 455601f
Showing
11 changed files
with
565 additions
and
32 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
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
2 changes: 2 additions & 0 deletions
2
plugins/greynoise/icon_greynoise/actions/similar_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 SimilarLookup |
35 changes: 35 additions & 0 deletions
35
plugins/greynoise/icon_greynoise/actions/similar_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 SimilarLookupInput, SimilarLookupOutput, Input, Output, Component | ||
# Custom imports below | ||
|
||
|
||
class SimilarLookup(insightconnect_plugin_runtime.Action): | ||
|
||
def __init__(self): | ||
super(self.__class__, self).__init__( | ||
name="similar_lookup", | ||
description=Component.DESCRIPTION, | ||
input=SimilarLookupInput(), | ||
output=SimilarLookupOutput()) | ||
|
||
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.similar(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.