Skip to content

Commit

Permalink
update all action outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bradchiappetta committed Nov 14, 2024
1 parent b61a794 commit cd13900
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import CommunityLookupInput, CommunityLookupOutput, Input, Component
from .schema import CommunityLookupInput, CommunityLookupOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -41,4 +41,13 @@ def run(self, params={}):
assistance="Please provide a valid public IPv4 address.",
)

return resp
return {
Output.CLASSIFICATION: resp.get("classification"),
Output.IP: resp.get("ip"),
Output.LAST_SEEN: resp.get("last_seen"),
Output.LINK: resp.get("link"),
Output.MESSAGE: resp.get("message"),
Output.NAME: resp.get("name"),
Output.NOISE: resp.get("noise"),
Output.RIOT: resp.get("riot"),
}
20 changes: 18 additions & 2 deletions plugins/greynoise/icon_greynoise/actions/context_lookup/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import ContextLookupInput, ContextLookupOutput, Input, Component
from .schema import ContextLookupInput, ContextLookupOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -37,4 +37,20 @@ def run(self, params={}):
assistance="Please provide a valid public IPv4 address.",
)

return resp
return {
Output.ACTOR: get.resp("actor"),
Output.BOT: get.resp("bot"),
Output.CLASSIFICATION: get.resp("classification"),
Output.CVE: get.resp("cve"),
Output.FIRST_SEEN: get.resp("first_seen"),
Output.IP: get.resp("ip"),
Output.LAST_SEEN: get.resp("last_seen"),
Output.METADATA: get.resp("metadata"),
Output.RAW_DATA: get.resp("raw_data"),
Output.SEEN: get.resp("seen"),
Output.SPOOFABLE: get.resp("spoofable"),
Output.TAGS: get.resp("tags"),
Output.VIZ_URL: get.resp("viz_url"),
Output.VPN: get.resp("vpn"),
Output.VPN_SERVICE: get.resp("vpn_service"),
}
23 changes: 18 additions & 5 deletions plugins/greynoise/icon_greynoise/actions/get_tag_details/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import GetTagDetailsInput, GetTagDetailsOutput, Input, Component
from .schema import GetTagDetailsInput, GetTagDetailsOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -29,7 +29,20 @@ def run(self, params={}):
assistance="Please check error and try again.",
)

if output:
return output
else:
return {"name": params.get(Input.TAG_NAME), "description": "Tag Not Found"}
if not output:
output = {"name": params.get(Input.TAG_NAME), "description": "Tag Not Found"}

return {
Output.CATEGORY: output.get("category"),
Output.CREATED_A: output.get("created_at"),
Output.CVES: output.get("cves"),
Output.DESCRIPTION: output.get("description"),
Output.ID: output.get("id"),
Output.INTENTION: output.get("intention"),
Output.LABEL: output.get("label"),
Output.NAME: output.get("name"),
Output.RECOMMEND_BLOCK: output.get("recommend_block"),
Output.REFERENCES: output.get("references"),
Output.RELATED_TAGS: output.get("related_tags"),
Output.SLUG: output.get("slug"),
}
10 changes: 8 additions & 2 deletions plugins/greynoise/icon_greynoise/actions/gnql_query/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import GnqlQueryInput, GnqlQueryOutput, Input, Component
from .schema import GnqlQueryInput, GnqlQueryOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -29,4 +29,10 @@ def run(self, params={}):
assistance="Please check error and try again.",
)

return resp
return {
Output.QUERY: resp.get("query"),
Output.DATA: resp.get("data"),
Output.COUNT: resp.get("count"),
Output.MESSAGE: resp.get("message"),
Output.COMPLETE: resp.get("complete"),
}
10 changes: 8 additions & 2 deletions plugins/greynoise/icon_greynoise/actions/quick_lookup/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import QuickLookupInput, QuickLookupOutput, Input, Component
from .schema import QuickLookupInput, QuickLookupOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -32,4 +32,10 @@ def run(self, params={}):
assistance="Please provide a valid public IPv4 address.",
)

return resp_out
return {
Output.IP: resp_out.get("ip"),
Output.CODE: resp_out.get("code"),
Output.NOISE: resp_out.get("noise"),
Output.RIOT: resp_out.get("riot"),
Output.CODE: resp_out.get("code"),
}
15 changes: 13 additions & 2 deletions plugins/greynoise/icon_greynoise/actions/riot_lookup/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import RiotLookupInput, RiotLookupOutput, Input, Component
from .schema import RiotLookupInput, RiotLookupOutput, Input, Output, Component

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException
Expand Down Expand Up @@ -31,4 +31,15 @@ def run(self, params={}):
assistance="Please provide a valid public IPv4 address.",
)

return resp
return {
Output.IP: resp.get("ip"),
Output.RIOT: resp.get("riot"),
Output.DESCRIPTION: resp.get("description"),
Output.VIZ_URL: resp.get("viz_url"),
Output.NAME: resp.get("name"),
Output.CATEGORY: resp.get("category"),
Output.EXPLANATION: resp.get("explanation"),
Output.LAST_UPDATED: resp.get("last_updated"),
Output.REFERENCE: resp.get("reference"),
Output.TRUST_LEVEL: resp.get("trust_level"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def run(self, params={}):
assistance="Please provide a valid IPv4 Address.",
)

return resp
return {Output.IP: resp.get("ip"), Output.SIMILAR_IPS: resp.get("similar_ips"), Output.TOTAL: resp.get("total")}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def run(self, params={}):
assistance="Please provide a valid IPv4 Address.",
)

return resp
return {Output.IP: resp.get("ip"), Output.ACTIVITY: resp.get("activity"), Output.METADATA: resp.get("metadata")}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ def run(self, params={}):
assistance="Please provide a valid CVE ID.",
)

return resp
return {
Output.DETAILS: resp.get("details"),
Output.ID: resp.get("id"),
Output.TIMELINE: resp.get("timeline"),
Output.EXPLOITATION_STATS: resp.get("exploitation_stats"),
Output.EXPLOITATION_DETAILS: resp.get("exploitation_details"),
Output.EXPLOITATION_ACTIVITY: resp.get("exploitation_activity"),
}

0 comments on commit cd13900

Please sign in to comment.