(command: str)
| 208 | |
| 209 | @staticmethod |
| 210 | def _looks_like_shell_command(command: str) -> bool: |
| 211 | if not command: |
| 212 | return False |
| 213 | |
| 214 | if re.search(r"[|&;<>]", command): |
| 215 | return True |
| 216 | |
| 217 | first_token = command.split()[0].strip().strip("`\"'") |
| 218 | if first_token in COMMON_SHELL_COMMANDS: |
| 219 | return True |
| 220 | if first_token.startswith(("./", "../", "/")): |
| 221 | return True |
| 222 | return False |
| 223 | |
| 224 | @classmethod |
| 225 | def _strip_natural_language_prefixes(cls, command: str) -> str: |
no outgoing calls
no test coverage detected