Created
October 10, 2022 21:58
-
-
Save tstromberg/e31349d33f5e17c0b8fe35e240edbde6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Find ssh sessions that are hiding from 'w'/'who' | |
SELECT * FROM ( | |
SELECT p.pid,p.name,p.cmdline,GROUP_CONCAT(DISTINCT pof.path) AS open_files | |
FROM processes p | |
LEFT JOIN process_open_files pof ON p.pid = pof.pid | |
WHERE p.name = "sshd" | |
GROUP BY p.pid | |
) | |
WHERE cmdline LIKE "%@notty%" | |
OR | |
INSTR(open_files, "/dev/ptmx") = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment