-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add script to install Rapid7 Insight Agent
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import glob | ||
import subprocess | ||
|
||
# Get the current directory | ||
current_directory = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Search for the installer files in the current directory | ||
installer_files = glob.glob(os.path.join(current_directory, "agent_installer-*.sh")) | ||
|
||
if not installer_files: | ||
# Prompt the user to provide the location of the installer file | ||
installer_file = input("Please enter the location of the installer file: ") | ||
else: | ||
# Use the first found installer file | ||
installer_file = installer_files[0] | ||
|
||
# Make the installer file executable | ||
os.chmod(installer_file, 0o755) | ||
|
||
# Prompt the user to input the token | ||
token = input("Please enter the token: ") | ||
|
||
# Continue with the installation | ||
print("Installing Rapid7 Insight Agent...") | ||
subprocess.run(["sudo", installer_file, "install_start", "--token", token], check=True) | ||
|
||
print("Installation completed successfully!") |