-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
salt: Add a module function to list listening process
Add a simple salt function that use `psutil` to list all listening processes on every ports Sees: #3092
- Loading branch information
1 parent
554a9a3
commit 3782e6d
Showing
5 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ etcd3 != 0.11.0 | |
kubernetes | ||
urllib3 | ||
pyfakefs | ||
psutil |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
get_listening_processes: | ||
- result: {} | ||
- net_conns_ret: | ||
# `::` will be replaced with `0.0.0.0` | ||
- laddr: ["::", 6443] | ||
pid: 111 | ||
# `::1` will be replaced with `127.0.0.1` | ||
- laddr: ["::1", 456] | ||
pid: 123 | ||
- laddr: ["1.2.3.4", 123] | ||
pid: 222 | ||
- laddr: ["2.3.4.5", 123] | ||
pid: 333 | ||
# Ignored as status != LISTEN | ||
- laddr: ["127.0.0.1", 12345] | ||
status: ESTABILISHED | ||
pid: 456 | ||
process_ret: | ||
111: apiserver | ||
123: likely-something | ||
222: my-process | ||
333: my-second-process | ||
456: do-we-care | ||
result: | ||
123: | ||
1.2.3.4: | ||
pid: 222 | ||
name: my-process | ||
2.3.4.5: | ||
pid: 333 | ||
name: my-second-process | ||
6443: | ||
0.0.0.0: | ||
pid: 111 | ||
name: apiserver | ||
456: | ||
127.0.0.1: | ||
pid: 123 | ||
name: likely-something |
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