mirror of
https://github.com/allthingslinux/tux.git
synced 2024-10-03 00:53:12 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
1b4d0749a5
commit
161ebd88a0
1 changed files with 4 additions and 1 deletions
|
@ -14,9 +14,12 @@ harmful_command_pattern = (
|
|||
r"|format\s+([A-Z]:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:)"
|
||||
)
|
||||
|
||||
|
||||
def is_harmful(command: str) -> bool:
|
||||
first_test: bool = re.search(harmful_command_pattern, command) is not None
|
||||
second_test: bool = re.search(r"rm.{0,5}[rfRF]", command) is not None or re.search(r"del\s+/[qsf]", command) is not None
|
||||
second_test: bool = (
|
||||
re.search(r"rm.{0,5}[rfRF]", command) is not None or re.search(r"del\s+/[qsf]", command) is not None
|
||||
)
|
||||
return first_test and second_test
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue