Skip to content

Commit 1d053ac

Browse files
committed
style: Automatic code formatting
1 parent f236845 commit 1d053ac

File tree

5 files changed

+294
-194
lines changed

5 files changed

+294
-194
lines changed

modules/signatures/windows/disables_windefender.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def on_complete(self):
205205

206206
return False
207207

208+
208209
class AddWindowsDefenderExclusions(Signature):
209210
name = "add_windows_defender_exclusions"
210211
description = "Attempts to add Windows Defender Exclusions for specific file types by extension"
@@ -213,8 +214,9 @@ class AddWindowsDefenderExclusions(Signature):
213214
authors = ["@para0x0dise"]
214215
minimum = "1.2"
215216
ttps = ["T1562.001"]
216-
references = ["https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_windows_defender_exclusions_by_extension.toml",
217-
]
217+
references = [
218+
"https://github.com/elastic/protections-artifacts/blob/main/behavior/rules/windows/defense_evasion_windows_defender_exclusions_by_extension.toml",
219+
]
218220
evented = True
219221

220222
filter_apinames = set(["RegSetValueExA", "RegSetValueExW", "NtSetValueKey"])
@@ -228,14 +230,32 @@ def on_call(self, call, process):
228230
regKeyPath = self.get_argument(call, "FullName").lower()
229231
valueName = self.get_argument(call, "ValueName")
230232
buf = self.get_argument(call, "Buffer")
231-
if buf == '0' and ("software\\policies\\microsoft\\windows defender\\exclusions\\extensions\\" in regKeyPath and
232-
any(extension in valueName for extension in ("exe", "pif", "scr", "js", "vbs",
233-
"wsh", "hta", "cpl", "jse", "vbe",
234-
"bat", "cmd", "dll", "ps1"))):
233+
if buf == "0" and (
234+
"software\\policies\\microsoft\\windows defender\\exclusions\\extensions\\" in regKeyPath
235+
and any(
236+
extension in valueName
237+
for extension in (
238+
"exe",
239+
"pif",
240+
"scr",
241+
"js",
242+
"vbs",
243+
"wsh",
244+
"hta",
245+
"cpl",
246+
"jse",
247+
"vbe",
248+
"bat",
249+
"cmd",
250+
"dll",
251+
"ps1",
252+
)
253+
)
254+
):
235255
self.data.append({"regkey": regKeyPath})
236256
self.detected = True
237257

238258
def on_complete(self):
239259
if self.detected:
240260
return True
241-
return False
261+
return False

modules/signatures/windows/lolbas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ def run(self):
111111
cmdlines = self.results.get("behavior", {}).get("summary", {}).get("executed_commands", [])
112112
for cmdline in cmdlines:
113113
lower = cmdline.lower()
114-
if ("conhost.exe" in lower and
115-
any(process in lower for process in ("cmd /c", "powershell", "script", "mshta", "curl"))):
114+
if "conhost.exe" in lower and any(process in lower for process in ("cmd /c", "powershell", "script", "mshta", "curl")):
116115
self.data.append({"command": cmdline})
117116
return True
118117
return False
@@ -614,6 +613,7 @@ def run(self):
614613

615614
return False
616615

616+
617617
class LOLBAS_ExecutePSViaSyncappvpublishingserver(Signature):
618618
name = "execute_ps_via_syncappvpublishingserver"
619619
description = "Attempts to execute a PowerShell commands via Microsoft signed Visual Basic script (Syncappvpublishingserver)"
@@ -651,6 +651,7 @@ def on_complete(self):
651651
return True
652652
return False
653653

654+
654655
class LOLBAS_ExecuteRemoteMSIViaDevinit(Signature):
655656
name = "execute_remote_msi"
656657
description = "Attempts to download and execute a remote msi file via Visual Studio tool (devinit.exe)"
@@ -670,4 +671,4 @@ def run(self):
670671
self.data.append({"command": cmdline})
671672
return True
672673

673-
return False
674+
return False

0 commit comments

Comments
 (0)