Python
If you have chosen to make use of Orbital's Script feature, Python will be installed alongside the Orbital node. This Orbital installation of Python is secure and completely independent of any prior or subsequent Python installations, it is only available to Orbital. Orbital uses Python version 3.10 or later.
Python Libraries Included With Script
The following Python libraries are provided for use with Orbital scripts:
-
certifi - https://pypi.org/project/certifi/
-
chardet - https://pypi.org/project/chardet/
-
iptools - https://pypi.org/project/iptools/
-
requests - https://pypi.org/project/requests/
-
scapy - https://scapy.readthedocs.io/en/latest/introduction.html
-
urllib3 - https://pypi.org/project/urllib3/
Script Limits
The following limits govern the creation of Orbital scripts:
-
Scripts can be up to 64KB in size.
-
Script execution will time out after 10 minutes.
-
Script output will be capped at 16MB each for stdout and stderr.
-
Any child processes spawned by a script will not be terminated by Orbital. It must exit on its own.
Script Parameters
Orbital scripts may use any number of named parameters. The parameter values must be typed directly into the script, rather than being passed as an argument or a script variable.
The parameter syntax takes the format {{ .parameter_name }}.
For example, if you have the value Wile E. Coyote for the parameter name and the value Genius for the parameter occupation, the raw script will take the form, as follows:
print("Hi, my name is {{ .name }}, and my occupation is {{ .occupation }}.")
The script will first perform the inline substitution, as follows:
print("Hi, my name is Wile E. Coyote, and my occupation is Genius.")
This substitution will return the following output:
Hi, my name is Wile E. Coyote, and my occupation is Genius.
Escaping Special Characters
The following special Python characters are automatically escaped by Orbital: ', ", \. There is no need to consider special handling of these characters when authoring a script.
For example, if the parameter filename has the value C:\program files\some application\program name.exe, the raw script will take the form:
print("the filename is: {{.filename}}")
The script will first perform the inline substitution, as follows:
print("The filename is: \"C:\\program files\\some application\\program name.exe\"")
This substitution will return the following output:
The filename is: "C:\program files\some application\program name.exe"
Examples of Using Script's Parameters in Python
Note: | It is recommended that you first set Orbital's Script parameters as Python variables, then use the Python variables instead of the Script parameters. |
An example of using a Script parameter as an int input for a Python function is displayed in the figure below:
pid = {{ .orbital_param_pid }}
print("killing pid: %d" % pid) os.kill(pid, SIGKILL) |
An example of using a Script parameter as a string input for a Python function is displayed in the figure below:
Important Note: | Quotation marks must fully enclose the Script parameter before it is passed to Python, as it is passed directly inline. |
# use quotes to create a python string filename = "{{ .orbital_param_filename }}"
print("opening file: %s" % filename) file = open(filename) |
Script Parameter Definition Through the Orbital User Interface
When you are writing your script, using the Orbital Interface, make certain you define the parameter values for the script before you save the script to the Catalog. This will inform future users of the values needed to run the script.
For example, if your are creating the following script:
print("hello, my name is {{ .name }} and my occupation is {{ .occupation }}")
Make certain you add the name and occupation parameters to the Parameters field or fields of the Orbital Builder, as shown in the figure below.