This folder contains a sample file scanner written in Python that utilizes the SentinelOne Nexus SDK Python library.
- Prerequisite Steps
- Embedded SDK Container vs SDK-less Container
- Running the SDK-less Container
- Developing Your Own Application
- Additional References
- Ensure you have met all of the System Requirements
- Ensure you have completed the Initial Setup Steps
There are two ways utilize the SDK for this example application - the fastest way is to use the pre-built "SDK-less" container and simply mount the Python library from the SDK distribution files as a read-only volume within the container. If you wish to use this method, continue reading below.
The other choice is to clone this repository and build the container locally on your own machine. If you choose this method, please read the Building and Running a Local Container documentation.
The "SDK-less" container does not contain the Nexus SDK library within it, so you will need to mount the shared library file as a read-only volume when running it.
Making sure your current working directory is the root folder of the repository, create an alias for the Docker command to simplify typing:
Intel/AMD-based systems
alias s1scanner="docker run --rm -v $(pwd)/nexus-sdk/_distfiles_/SDK:/opt/s1scanner/nexus-sdk/SDK:ro -v /:/mnt:ro --platform linux/amd64 ghcr.io/s1integrations/nexus-sdk/python/s1scanner"ARM-based systems (eg: Apple Silicon)
alias s1scanner="docker run --rm -v $(pwd)/nexus-sdk/_distfiles_/SDK:/opt/s1scanner/nexus-sdk/SDK:ro -v /:/mnt:ro --platform linux/arm64 ghcr.io/s1integrations/nexus-sdk/python/s1scanner"-
To print a simple help screen use the
-hor--helpoption:s1scanner -h
-
To run a simple demo without scanning local files use the
--demooption:s1scanner --demo
-
To scan a file or directory:
s1scanner FULL_PATH_TO_FILE_OR_DIR
where
FULL_PATH_TO_FILE_OR_DIRis the absolute path to the file or directory to scanNOTE:
Relative file or directory paths will not work as the container has no context as to what your current working directory is.
Also be aware that running this within the Dev Containers environment will not work since it is already running inside a container. Be sure to run the command from an OS terminal window instead of through the Terminal window in VS Code.
Examples:
s1scanner /Users/joshhogle/s1-integration-examples/nexus-sdk/sample-files/NexusSDK.pdf s1scanner "/mnt/c/Users/Josh Hogle/s1-integration-examples/nexus-sdk/sample-files/NexusSDK.pdf" s1scanner /home/josh/s1-integration-examples/nexus-sdk/sample-files/NexusSDK.pdf -
To scan a directory recursively, use the
-ror--recurseoption:s1scanner -r FULL_PATH_TO_DIR
Example:
s1scanner -r $(pwd)/../sample-files
For information on using the code within the example to develop your own Go application, please click here.
- Developing Your Own Application using Python
- Building and Running a Local Container
- Developer Guide for Python Example (for making changes to this example itself)
- Back to Nexus SDK Examples