-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring back CommFound from the dead for roblox autokill
- Loading branch information
1 parent
9a08887
commit 5deb2e8
Showing
3 changed files
with
48 additions
and
4 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
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,24 @@ | ||
//go:build linux | ||
|
||
package util | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func CommFound(query string) bool { | ||
comms, _ := filepath.Glob("/proc/*/comm") | ||
|
||
for _, comm := range comms { | ||
c, err := os.ReadFile(comm) | ||
// The 'comm' file contains a new line, we remove it, as it will mess up | ||
// the query. hence 'minus'ing the length by 1 removes the newline. | ||
if err == nil && strings.Contains(string(c)[:len(c)-1], query) { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} |