@wrongstack/tools 0.307.1 → 0.308.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@
14
14
  * - Windows equivalents: taskkill, tskill
15
15
  * - PowerShell Stop-Process / kill alias: Stop-Process -Name node, kill -Id 12345
16
16
  * - WMIC process termination: wmic process where "name='node.exe'" delete
17
+ * or wmic process where "ProcessId=1234" delete
17
18
  * - Script-based kill (script is named kill*.sh, kill*.ps1, kill*.bat)
18
19
  *
19
20
  * Security contract: every "Handles" bullet must map to both a detector
package/dist/bash.js CHANGED
@@ -1501,6 +1501,18 @@ function parseKillCommand(command) {
1501
1501
  originalCommand: command
1502
1502
  };
1503
1503
  }
1504
+ const wmicPidMatch = normalized.match(
1505
+ /^wmic\s+process\s+where\s+['"]?processid\s*=\s*['"]?(\d+)/i
1506
+ );
1507
+ if (wmicPidMatch?.[1]) {
1508
+ return {
1509
+ pid: parseInt(wmicPidMatch[1], 10),
1510
+ signal: "FORCE",
1511
+ isGroupKill: false,
1512
+ isAllKill: false,
1513
+ originalCommand: command
1514
+ };
1515
+ }
1504
1516
  const killScriptMatch = normalized.match(SCRIPT_KILL_RE);
1505
1517
  if (killScriptMatch) {
1506
1518
  return {
@@ -1620,7 +1632,9 @@ async function isKillProtected(kill) {
1620
1632
  return protectedPids.length > 0;
1621
1633
  }
1622
1634
  if (kill.pid !== void 0) {
1623
- return registry.shouldBlockKill(kill.pid);
1635
+ if (await registry.shouldBlockKill(kill.pid)) return true;
1636
+ if (kill.pid === process.pid || kill.pid === process.ppid) return true;
1637
+ return false;
1624
1638
  }
1625
1639
  return false;
1626
1640
  }