Skip to content

Commit 5337a4f

Browse files
authored
Python 3 Script - SDK Automation prep (#3232) (#3260)
* python sdk prep * Adding troubleshooting in * Update docs for new Python version
1 parent 73e2421 commit 5337a4f

File tree

6 files changed

+99
-74
lines changed

6 files changed

+99
-74
lines changed

plugins/python_3_script/.CHECKSUM

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"spec": "d74feb6cdde500a37a7414d8c39128aa",
3-
"manifest": "198a4816b6cbcac35ae4afc65ae39233",
4-
"setup": "d5da76fdda30a43de6394b72654e81d0",
2+
"spec": "b6863960ae347236c119ef8966bcebec",
3+
"manifest": "1ee46020582db6256c522c7a10909175",
4+
"setup": "f58303ad136ad0292857cd4f2edf3fa7",
55
"schemas": [
66
{
77
"identifier": "run/schema.py",

plugins/python_3_script/Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.1.4
1+
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.2.5
22

33
LABEL organization=rapid7
44
LABEL sdk=python
@@ -7,17 +7,17 @@ RUN apt-get update && apt-get install libxslt-dev libxml2-dev gcc g++ -y
77

88
WORKDIR /python/src
99

10-
ADD ./plugin.spec.yaml /plugin.spec.yaml
11-
ADD ./requirements.txt /python/src/requirements.txt
12-
1310
ENV PYTHONUSERBASE=/var/cache/python_dependencies
1411
ENV PYTHONPATH=/var/cache/python_dependencies
1512

13+
ADD ./plugin.spec.yaml /plugin.spec.yaml
14+
ADD ./requirements.txt /python/src/requirements.txt
15+
1616
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
1717

1818
ADD . /python/src
1919

20-
RUN python setup.py build && python setup.py install
20+
RUN pip install .
2121

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

plugins/python_3_script/bin/icon_python_3_script

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ from sys import argv
66

77
Name = "Python 3 Script"
88
Vendor = "rapid7"
9-
Version = "5.1.0"
10-
Description = "[Python](https://www.python.org/) is a programming language that lets you work quickly and integrate systems more effectively. This plugin allows you to run Python 3 code. It includes Python 3.9.19 and its standard library as well as the following 3rd party libraries:"
9+
Version = "5.1.1"
10+
Description = "[Python](https://www.python.org/) is a language for fast development and system integration. This plugin runs Python 3.12.8 with its standard library and other libraries such as:* [requests](https://requests.readthedocs.io/en/latest/)* [arrow](https://pypi.org/project/arrow/)* [lxml](http://lxml.de/)* [beautifulsoup](https://www.crummy.com/software/BeautifulSoup/)It supports loading custom modules and passing credentials (`username`, `password`, `secret_key`)"
1111

1212

1313
def main():

plugins/python_3_script/help.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
# Description
22

3-
[Python](https://www.python.org/) is a programming language that lets you work quickly and integrate systems more effectively. This plugin allows you to run Python 3 code. It includes Python 3.9.19 and its standard library as well as the following 3rd party libraries:
3+
[Python](https://www.python.org/) is a language for fast development and system integration. This plugin runs Python 3.12.8 with its standard library and other libraries such as:
44

5-
* [requests 2.32.2](https://requests.readthedocs.io/en/latest/)
6-
* [arrow 1.3.0](https://pypi.org/project/arrow/)
7-
* [lxml 5.3.0](http://lxml.de/)
8-
* [beautifulsoup 4.12.3](https://www.crummy.com/software/BeautifulSoup/)
9-
* [pyyaml 6.0.2](http://pyyaml.org/)
10-
* [parameterized 0.8.1](https://pypi.org/project/parameterized/)
11-
* [setuptools 75.1.0](https://pypi.org/project/setuptools/)
12-
* [datetime 5.5](https://pypi.org/project/DateTime/)
5+
* [requests](https://requests.readthedocs.io/en/latest/)
6+
* [arrow](https://pypi.org/project/arrow/)
7+
* [lxml](http://lxml.de/)
8+
* [beautifulsoup](https://www.crummy.com/software/BeautifulSoup/)
139

14-
The Python 3 Script plugin also allows you to load custom modules via its connection parameters.
15-
16-
Also, this plugin allows you to provide additional credentials in the connection such as username, password, secret_key available in the script as Python variables (`username`, `password`, `secret_key`)
10+
It supports loading custom modules and passing credentials (`username`, `password`, `secret_key`)
1711

1812
# Key Features
1913

@@ -25,7 +19,7 @@ Also, this plugin allows you to provide additional credentials in the connection
2519

2620
# Supported Product Versions
2721

28-
* Python 3.9.18
22+
* Python 3.12.8
2923

3024
# Documentation
3125

@@ -116,10 +110,11 @@ Example output:
116110

117111
## Troubleshooting
118112

119-
Some third-party modules defined in the Modules connection input (such as pandas) can take a long time to install. If installation fails, try increasing the Timeout connection input to 900 (15 minutes)
113+
* Some third-party modules defined in the Modules connection input (such as pandas) can take a long time to install. If installation fails, try increasing the Timeout connection input to 900 (15 minutes)
120114

121115
# Version History
122116

117+
* 5.1.1 - Updated SDK to the latest version (6.2.5)
123118
* 5.1.0 - Action `Run`: Added `timeout` optional parameter | Updated SDK to the latest version
124119
* 5.0.1 - Updated SDK to the latest version | Initial updates for fedramp compliance
125120
* 5.0.0 - Updated SDK to the latest version | Removing records as its not maintained | Replacing maya with arrow (maya not maintained)

plugins/python_3_script/plugin.spec.yaml

+78-48
Original file line numberDiff line numberDiff line change
@@ -6,72 +6,98 @@ title: Python 3 Script
66
vendor: rapid7
77
support: rapid7
88
status: []
9-
description: "[Python](https://www.python.org/) is a programming language that lets you work quickly and integrate systems more effectively. This plugin allows you to run Python 3 code. It includes Python 3.9.19 and its standard library as well as the following 3rd party libraries:"
10-
version: 5.1.0
9+
description: "[Python](https://www.python.org/) is a language for fast development\
10+
\ and system integration. This plugin runs Python 3.12.8 with its standard library\
11+
\ and other libraries such as:\n\n* [requests](https://requests.readthedocs.io/en/latest/)\n\
12+
* [arrow](https://pypi.org/project/arrow/)\n* [lxml](http://lxml.de/)\n* [beautifulsoup](https://www.crummy.com/software/BeautifulSoup/)\n\
13+
\nIt supports loading custom modules and passing credentials (`username`, `password`,\
14+
\ `secret_key`)"
15+
version: 5.1.1
1116
connection_version: 4
12-
supported_versions: ["Python 3.9.18"]
17+
supported_versions: [Python 3.12.8]
1318
fedramp_ready: true
1419
sdk:
1520
type: slim
16-
version: 6.1.4
21+
version: 6.2.5
1722
user: root
1823
packages:
19-
- libxslt-dev
20-
- libxml2-dev
21-
- gcc
22-
- g++
24+
- libxslt-dev
25+
- libxml2-dev
26+
- gcc
27+
- g++
28+
custom_cmd:
29+
- ENV PYTHONUSERBASE=/var/cache/python_dependencies
30+
- ENV PYTHONPATH=/var/cache/python_dependencies
2331
enable_cache: true
24-
troubleshooting: "Some third-party modules defined in the Modules connection input (such as pandas) can take a long time to install. If installation fails, try increasing the Timeout connection input to 900 (15 minutes)"
32+
troubleshooting:
33+
- Some third-party modules defined in the Modules connection input (such as pandas)
34+
can take a long time to install. If installation fails, try increasing the Timeout
35+
connection input to 900 (15 minutes)
2536
resources:
2637
source_url: https://github.com/rapid7/insightconnect-plugins/tree/master/plugins/python_3_script
2738
license_url: https://github.com/rapid7/insightconnect-plugins/blob/master/LICENSE
2839
docs_url: https://docs.rapid7.com/insightconnect/python-2-or-3-script/
2940
tags:
30-
- python
31-
- python3
32-
- scripting
33-
- utilities
41+
- python
42+
- python3
43+
- scripting
44+
- utilities
3445
hub_tags:
3546
use_cases: [data_utility]
3647
keywords: [python, scripting]
3748
features: []
38-
key_features: ["Run a Python 3 Script to securely orchestrate, automate, and respond to (almost) anything"]
39-
references: ["[Python 3 Language Reference](https://docs.python.org/3/reference/index.html)", "[InsightConnect Python Plugin Guide](https://docs.rapid7.com/insightconnect/python-2-or-3-script/)"]
49+
key_features: ['Run a Python 3 Script to securely orchestrate, automate, and respond
50+
to (almost) anything']
51+
references: ['[Python 3 Language Reference](https://docs.python.org/3/reference/index.html)',
52+
'[InsightConnect Python Plugin Guide](https://docs.rapid7.com/insightconnect/python-2-or-3-script/)']
4053
links:
41-
- "[Python](https://www.python.org/)"
54+
- '[Python](https://www.python.org/)'
4255
version_history:
43-
- "5.1.0 - Action `Run`: Added `timeout` optional parameter | Updated SDK to the latest version"
44-
- "5.0.1 - Updated SDK to the latest version | Initial updates for fedramp compliance"
45-
- "5.0.0 - Updated SDK to the latest version | Removing records as its not maintained | Replacing maya with arrow (maya not maintained)"
46-
- "4.0.10 - Updated the SDK to the latest version | Updated Python version to `3.9.19` | Fixed issue with invalid unicode character"
47-
- "4.0.9 - Updated the SDK to the latest version to address memory usage issues"
48-
- "4.0.8 - Updated the SDK to latest version | Fix issue where input argument was too long"
49-
- "4.0.7 - Updated the SDK | Updated Python version to `3.9.18` | Added handler to run function separately"
50-
- "4.0.6 - Added empty `__init__.py` file to `unit_test` folder | Refreshed with new tooling"
51-
- "4.0.5 - Updated the SDK version to include output masking | Updated all dependencies to the newest versions"
52-
- "4.0.4 - Update Pyyaml to version 6.0.0"
53-
- "4.0.3 - Run: Fix logging issue"
54-
- "4.0.2 - Run: Fix issue with indentation where users have non-empty credentials for input function"
55-
- "4.0.1 - Resolve issue where users experience issues with installing Python packages, and indentation for input function"
56-
- "4.0.0 - Add custom script credentials in Connection"
57-
- "3.0.0 - Add custom credentials in Run action"
58-
- "2.0.4 - Update help documentation for installing third-party modules"
59-
- "2.0.3 - Update `docs_url` in plugin spec with a new link to [plugin setup guide](https://docs.rapid7.com/insightconnect/python-2-or-3-script/)"
60-
- "2.0.2 - Add `docs_url` to plugin spec with link to [plugin setup guide](https://insightconnect.help.rapid7.com/docs/python-2-or-3-script)"
61-
- "2.0.1 - New spec and help.md format for the Extension Library"
62-
- "2.0.0 - Add the ability to download and install third-party libraries for use while configuring the plugin Connection"
63-
- "1.0.6 - Fix issue where undefined output exceptions were not being handled correctly"
64-
- "1.0.5 - Add `utilities` plugin tag for Marketplace searchability"
65-
- "1.0.4 - Fix issue where run action was excluded from plugin on build"
66-
- "1.0.3 - Update to v2 Python plugin architecture | Support web server mode | Add and pin 3rd party libraries: lxml, beautifulsoup, pyyaml, maya, and records;"
67-
- "1.0.2 - SDK update"
68-
- "1.0.1 - SSL bug fix in SDK"
69-
- "0.1.0 - Initial plugin"
56+
- 5.1.1 - Updated SDK to the latest version (6.2.5)
57+
- '5.1.0 - Action `Run`: Added `timeout` optional parameter | Updated SDK to the latest
58+
version'
59+
- 5.0.1 - Updated SDK to the latest version | Initial updates for fedramp compliance
60+
- 5.0.0 - Updated SDK to the latest version | Removing records as its not maintained
61+
| Replacing maya with arrow (maya not maintained)
62+
- 4.0.10 - Updated the SDK to the latest version | Updated Python version to `3.9.19`
63+
| Fixed issue with invalid unicode character
64+
- 4.0.9 - Updated the SDK to the latest version to address memory usage issues
65+
- 4.0.8 - Updated the SDK to latest version | Fix issue where input argument was too
66+
long
67+
- 4.0.7 - Updated the SDK | Updated Python version to `3.9.18` | Added handler to
68+
run function separately
69+
- 4.0.6 - Added empty `__init__.py` file to `unit_test` folder | Refreshed with new
70+
tooling
71+
- 4.0.5 - Updated the SDK version to include output masking | Updated all dependencies
72+
to the newest versions
73+
- 4.0.4 - Update Pyyaml to version 6.0.0
74+
- '4.0.3 - Run: Fix logging issue'
75+
- '4.0.2 - Run: Fix issue with indentation where users have non-empty credentials
76+
for input function'
77+
- 4.0.1 - Resolve issue where users experience issues with installing Python packages,
78+
and indentation for input function
79+
- 4.0.0 - Add custom script credentials in Connection
80+
- 3.0.0 - Add custom credentials in Run action
81+
- 2.0.4 - Update help documentation for installing third-party modules
82+
- 2.0.3 - Update `docs_url` in plugin spec with a new link to [plugin setup guide](https://docs.rapid7.com/insightconnect/python-2-or-3-script/)
83+
- 2.0.2 - Add `docs_url` to plugin spec with link to [plugin setup guide](https://insightconnect.help.rapid7.com/docs/python-2-or-3-script)
84+
- 2.0.1 - New spec and help.md format for the Extension Library
85+
- 2.0.0 - Add the ability to download and install third-party libraries for use while
86+
configuring the plugin Connection
87+
- 1.0.6 - Fix issue where undefined output exceptions were not being handled correctly
88+
- 1.0.5 - Add `utilities` plugin tag for Marketplace searchability
89+
- 1.0.4 - Fix issue where run action was excluded from plugin on build
90+
- '1.0.3 - Update to v2 Python plugin architecture | Support web server mode | Add
91+
and pin 3rd party libraries: lxml, beautifulsoup, pyyaml, maya, and records;'
92+
- 1.0.2 - SDK update
93+
- 1.0.1 - SSL bug fix in SDK
94+
- 0.1.0 - Initial plugin
7095
connection:
7196
modules:
7297
title: Third-Party Modules
73-
description: List of third-party modules to install for use in the supplied Python script
74-
type: "[]string"
98+
description: List of third-party modules to install for use in the supplied Python
99+
script
100+
type: '[]string'
75101
required: false
76102
example: '["pandas", "numpy"]'
77103
timeout:
@@ -89,7 +115,8 @@ connection:
89115
example: '{"secretKey": "9de5069c5afe602b2ea0a04b66beb2c0"}'
90116
script_username_and_password:
91117
title: Script Username and Password
92-
description: Username and password available in script as python variables (`username`, `password`)
118+
description: Username and password available in script as python variables (`username`,
119+
`password`)
93120
type: credential_username_password
94121
required: false
95122
example: '{"username": "user", "password": "mypassword"}'
@@ -99,11 +126,14 @@ actions:
99126
description: Run a Python 3 function
100127
input:
101128
function:
102-
description: Function definition. Must be named `run`. Accepts the `input` object as params. Returns the dict as output. In this action you can use `username`, `password`, `secret_key` variables if defined in connection
129+
description: Function definition. Must be named `run`. Accepts the `input`
130+
object as params. Returns the dict as output. In this action you can use
131+
`username`, `password`, `secret_key` variables if defined in connection
103132
type: python
104133
required: true
105134
default: def run(params={}):\n return {}
106-
example: def run(params={}):\n\tprint(params.get('some_input'))\n\tprint(username, password)\n\treturn {}
135+
example: def run(params={}):\n\tprint(params.get('some_input'))\n\tprint(username,
136+
password)\n\treturn {}
107137
input:
108138
description: Input object to be passed as `params={}` to the `run` function
109139
type: object

plugins/python_3_script/setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44

55
setup(name="python_3_script-rapid7-plugin",
6-
version="5.1.0",
7-
description="[Python](https://www.python.org/) is a programming language that lets you work quickly and integrate systems more effectively. This plugin allows you to run Python 3 code. It includes Python 3.9.19 and its standard library as well as the following 3rd party libraries:",
6+
version="5.1.1",
7+
description="[Python](https://www.python.org/) is a language for fast development and system integration. This plugin runs Python 3.12.8 with its standard library and other libraries such as:* [requests](https://requests.readthedocs.io/en/latest/)* [arrow](https://pypi.org/project/arrow/)* [lxml](http://lxml.de/)* [beautifulsoup](https://www.crummy.com/software/BeautifulSoup/)It supports loading custom modules and passing credentials (`username`, `password`, `secret_key`)",
88
author="rapid7",
99
author_email="",
1010
url="",

0 commit comments

Comments
 (0)