Skip to content

Commit 0aecbab

Browse files
committed
Update export_sentinel.py
1 parent 21de9f9 commit 0aecbab

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

misp_modules/modules/action_mod/export_sentinel.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,28 @@
4141
"output": "",
4242
}
4343

44+
4445
def export_to_sentinel(request, event_uuid):
4546
params = request["params"]
4647
misp2_venv = params["misp2_venv"]
47-
misp2_script = params["misp2_script"]
48-
48+
misp2_script = params["misp2_script"]
49+
4950
script_dir = os.path.dirname(misp2_script)
5051
python_executable = os.path.join(misp2_venv, "bin", "python")
51-
52+
5253
if not os.path.exists(python_executable):
5354
print(f"Error: Python executable not found at {python_executable}")
5455
return False
55-
56+
5657
if not os.path.exists(misp2_script):
5758
print(f"Error: Script not found at {misp2_script}")
5859
return False
59-
60+
6061
print(f"Exporting event {event_uuid} to Sentinel or Defender...")
6162
print(f"Using Python: {python_executable}")
6263
print(f"Running script: {misp2_script}")
6364
print(f"Working directory: {script_dir}")
64-
65+
6566
try:
6667
result = subprocess.run(
6768
[python_executable, misp2_script, event_uuid],
@@ -70,7 +71,7 @@ def export_to_sentinel(request, event_uuid):
7071
text=True,
7172
timeout=300
7273
)
73-
74+
7475
if result.returncode == 0:
7576
print(f"Successfully exported event {event_uuid}")
7677
if result.stdout:
@@ -83,18 +84,19 @@ def export_to_sentinel(request, event_uuid):
8384
if result.stdout:
8485
print(f"Output: {result.stdout}")
8586
return False
86-
87+
8788
except subprocess.TimeoutExpired:
88-
print(f"Export timed out after 300 seconds")
89+
print("Export timed out")
8990
return False
9091
except Exception as e:
9192
print(f"Error executing script: {str(e)}")
9293
return False
9394

95+
9496
def handler(q=False):
9597
if q is False:
9698
return False
97-
99+
98100
request = json.loads(q)
99101
success = False
100102

0 commit comments

Comments
 (0)