Skip to content

Commit b60fafb

Browse files
authored
fixed bug with form_powershell_command (demisto#38655)
* fixed bug with form_powershell_command * added release notes * added pack-ignore on unrelated warning
1 parent 7a3c66b commit b60fafb

File tree

9 files changed

+34
-9
lines changed

9 files changed

+34
-9
lines changed

Packs/ApiModules/Scripts/CoreIRApiModule/CoreIRApiModule.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,7 @@ def form_powershell_command(unescaped_string: str) -> str:
24592459
else:
24602460
escaped_string += char
24612461

2462-
return f"powershell -Command '{escaped_string}'"
2462+
return f"powershell -Command \"{escaped_string}\""
24632463

24642464

24652465
def run_script_execute_commands_command(client: CoreClient, args: Dict) -> CommandResults:

Packs/ApiModules/Scripts/CoreIRApiModule/CoreIRApiModule_test.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
POWERSHELL_COMMAND_CASES = [
2525
pytest.param(
2626
"Write-Output 'Hello, world, it`s me!'",
27-
"powershell -Command 'Write-Output ''Hello, world, it`s me!'''",
27+
"powershell -Command \"Write-Output ''Hello, world, it`s me!''\"",
2828
id='Hello World message',
2929
),
3030
pytest.param(
3131
r"New-Item -Path 'C:\Users\User\example.txt' -ItemType 'File'",
32-
"powershell -Command 'New-Item -Path ''C:\\Users\\User\\example.txt'' -ItemType ''File'''",
32+
"powershell -Command \"New-Item -Path ''C:\\Users\\User\\example.txt'' -ItemType ''File''\"",
3333
id='New file in path with backslashes',
3434
),
3535
pytest.param(
3636
"$message = 'This is a test with special chars: `&^%$#@!'; Write-Output $message",
37-
"powershell -Command '$message = ''This is a test with special chars: `&^%$#@!''; Write-Output $message'",
37+
"powershell -Command \"$message = ''This is a test with special chars: `&^%$#@!''; Write-Output $message\"",
3838
id='Special characters message',
3939
),
4040
pytest.param(
@@ -46,11 +46,11 @@
4646
"$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }"
4747
),
4848
(
49-
"powershell -Command '$users = @(JohnDoe) -split '';''; query user | Select-Object -Skip 1 | "
49+
"powershell -Command \"$users = @(JohnDoe) -split '';''; query user | Select-Object -Skip 1 | "
5050
"ForEach-Object { $sessionInfo = $_ -split ''\\s+'' | "
5151
"Where-Object { $_ -ne '''' -and $_ -notlike ''Disc'' }; "
5252
"if ($sessionInfo.Length -ge 6) { $username = $sessionInfo[0].TrimStart(''>''); "
53-
"$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }'"
53+
"$sessionId = $sessionInfo[2]; if ($users -contains $username) { logoff $sessionId } } }\""
5454
),
5555
id='End RDP session for users',
5656
),

Packs/Core/ReleaseNotes/3_2_25.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
#### Integrations
3+
4+
##### Indicators detection
5+
6+
- Updated the Cortex Core - fixed bug with powershell commands on *!core-run-script-execute-commands*.
7+
8+
##### Investigation & Response
9+
10+
- Updated the Cortex Core - fixed bug with powershell commands on *!core-run-script-execute-commands*.

Packs/Core/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Core - Investigation and Response",
33
"description": "Automates incident response",
44
"support": "xsoar",
5-
"currentVersion": "3.2.24",
5+
"currentVersion": "3.2.25",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Palo Alto Networks Cortex XDR - Investigation and Response
5+
6+
- Updated the Cortex XDR - fixed bug with powershell commands on *!core-run-script-execute-commands*.

Packs/CortexXDR/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Cortex XDR by Palo Alto Networks",
33
"description": "Automates Cortex XDR incident response, and includes custom Cortex XDR incident views and layouts to aid analyst investigations.",
44
"support": "xsoar",
5-
"currentVersion": "6.2.12",
5+
"currentVersion": "6.2.13",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Packs/ctf01/.pack-ignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ CTF
2222
# GR103 is temporary, see CIAC-11705
2323
[file:playbook-Cortex_XDR_Alerts_Handling_CTF.yml]
2424
ignore=GR103,GR107
25+
26+
[file:README.md]
27+
ignore=RM108

Packs/ctf01/ReleaseNotes/1_0_38.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Cortex XDR - IR CTF
5+
6+
- Updated the Cortex XDR - fixed bug with powershell commands on *!core-run-script-execute-commands*.

Packs/ctf01/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Capture The Flag - 01",
33
"description": "XSOAR's Capture the flag (CTF)",
44
"support": "xsoar",
5-
"currentVersion": "1.0.37",
5+
"currentVersion": "1.0.38",
66
"serverMinVersion": "8.2.0",
77
"author": "Cortex XSOAR",
88
"url": "https://www.paloaltonetworks.com/cortex",

0 commit comments

Comments
 (0)