Skip to content

Commit

Permalink
Advanced Regex - 17800 - Initial updates for fedramp compliance | Upd…
Browse files Browse the repository at this point in the history
…ated SDK to the latest version (#2839)
  • Loading branch information
igorski-r7 authored Oct 2, 2024
1 parent 61ed197 commit d360b8c
Show file tree
Hide file tree
Showing 27 changed files with 367 additions and 179 deletions.
14 changes: 7 additions & 7 deletions plugins/advanced_regex/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"spec": "1597e3e99fd21c971252e259b55c408e",
"manifest": "920394614e046a1d693e5afdbff8a98d",
"setup": "b2e9d09a906562d3b847cff92bfadbdd",
"spec": "6bee222090075470d4cf287e74857113",
"manifest": "a4a60a936d84bf95984315779ecdf960",
"setup": "a05182f1000be90d1e136294814df647",
"schemas": [
{
"identifier": "data_extraction/schema.py",
"hash": "2a9633a1fe24c27a03869a911e4df8d3"
"hash": "428193756350c4a3e660d57c649bab94"
},
{
"identifier": "replace/schema.py",
"hash": "e4b51ece64173491ad2e38a495f81f97"
"hash": "793ff3f4125e53e89df7fd4d213b2662"
},
{
"identifier": "split/schema.py",
"hash": "1769bb4540172952e3e840f64cb0ad43"
"hash": "849599e481893215ec4e4c1d01e65bca"
},
{
"identifier": "connection/schema.py",
"hash": "da5382221ca2a33a2f854e17b068d502"
"hash": "bd524b567f9638ba1c6f7e0c9e45ff2e"
}
]
}
18 changes: 6 additions & 12 deletions plugins/advanced_regex/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
FROM rapid7/insightconnect-python-3-38-slim-plugin:4
# Refer to the following documentation for available SDK parent images: https://docs.rapid7.com/insightconnect/sdk-guide/#sdk-guide
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.1.3

LABEL organization=rapid7
LABEL sdk=python

# Add any custom package dependencies here
# NOTE: Add pip packages to requirements.txt

# End package dependencies

# Add source code
WORKDIR /python/src

ADD ./plugin.spec.yaml /plugin.spec.yaml
ADD . /python/src
ADD ./requirements.txt /python/src/requirements.txt

# Install pip dependencies
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

# Install plugin
ADD . /python/src

RUN python setup.py build && python setup.py install

# User to run plugin code. The two supported users are: root, nobody
USER root
USER nobody

ENTRYPOINT ["/usr/local/bin/icon_advanced_regex"]
50 changes: 32 additions & 18 deletions plugins/advanced_regex/bin/icon_advanced_regex
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
#!/usr/bin/env python
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
from icon_advanced_regex import connection, actions, triggers

# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
import os
import json
from sys import argv

Name = "Advanced Regex"
Vendor = "rapid7"
Version = "1.0.3"
Version = "1.0.4"
Description = "Perform advanced regular expression operations on a string using Python regex"


class ICONAdvancedRegex(insightconnect_plugin_runtime.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
name=Name,
vendor=Vendor,
def main():
if 'http' in argv:
if os.environ.get("GUNICORN_CONFIG_FILE"):
with open(os.environ.get("GUNICORN_CONFIG_FILE")) as gf:
gunicorn_cfg = json.load(gf)
if gunicorn_cfg.get("worker_class", "sync") == "gevent":
from gevent import monkey
monkey.patch_all()
elif 'gevent' in argv:
from gevent import monkey
monkey.patch_all()

import insightconnect_plugin_runtime
from icon_advanced_regex import connection, actions, triggers, tasks

class ICONAdvancedRegex(insightconnect_plugin_runtime.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
name=Name,
vendor=Vendor,
version=Version,
description=Description,
connection=connection.Connection()
)
self.add_action(actions.DataExtraction())

self.add_action(actions.Replace())
)
self.add_action(actions.DataExtraction())

self.add_action(actions.Replace())

self.add_action(actions.Split())


self.add_action(actions.Split())


def main():
"""Run plugin"""
cli = insightconnect_plugin_runtime.CLI(ICONAdvancedRegex())
cli.run()
Expand Down
Loading

0 comments on commit d360b8c

Please sign in to comment.