RC 1.1.1
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
sys.path.append(project_root)
|
||||
|
||||
|
||||
from services.API import AirlockAPIWrapper
|
||||
from services.security import getAPI
|
||||
|
||||
logger = logging.getLogger()
|
||||
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
def main():
|
||||
try:
|
||||
url = "https://172.17.22.240:3129"
|
||||
username = os.getenv("USERNAME")
|
||||
|
||||
if not url:
|
||||
raise ValueError("Missing URL in environment variables.")
|
||||
if not username:
|
||||
raise ValueError("Missing USERNAME in environment variables.")
|
||||
|
||||
logger.debug(f"Retrieved URL: {url}")
|
||||
logger.debug(f"Retrieved Username: {username}")
|
||||
|
||||
except ValueError as e:
|
||||
logger.error(f"Configuration error: {e}", exc_info=True)
|
||||
raise
|
||||
|
||||
|
||||
if username:
|
||||
api = AirlockAPIWrapper(
|
||||
base_url= url,
|
||||
api_key = getAPI(username, "AirlockTools"), # pyright: ignore[reportArgumentType]
|
||||
)
|
||||
"""
|
||||
Available script types are:
|
||||
|
||||
"batch",
|
||||
"powershell",
|
||||
"command",
|
||||
"vbscript",
|
||||
"javascript"
|
||||
,"windowsinstaller",
|
||||
"htmlapplication",
|
||||
"javaapplication",
|
||||
"windowsscriptcomponent",
|
||||
"compiledhtml",
|
||||
"shellscript",
|
||||
"dylib",
|
||||
"python"
|
||||
|
||||
"""
|
||||
groupid = "5aebf6a0-1d67-47b4-9c5f-2866ffca5671" #AT Testing
|
||||
script_custom = 1
|
||||
scripts_audit = [
|
||||
"batch",
|
||||
"powershell",
|
||||
"command",
|
||||
"vbscript",
|
||||
"javascript",
|
||||
"windowsinstaller",
|
||||
"javaapplication",
|
||||
"python"
|
||||
]
|
||||
|
||||
scripts_disabled = ["compiledhtml", "htmlapplication", "shellscript", "dylib","windowsscriptcomponent"]
|
||||
scripts_respect = []
|
||||
|
||||
response = api.policy_set_script_custom(groupid, script_custom, scripts_audit, scripts_disabled, scripts_respect)
|
||||
print(response)
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user