Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
002067d3ac
|
19
chkplat.sh
Executable file
19
chkplat.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# go tool dist list for all valid GOOS/GOARCH targets.
|
||||
|
||||
for tgt in $(go tool dist list);
|
||||
do
|
||||
o="$(echo ${tgt} | cut -f1 -d '/')"
|
||||
a="$(echo ${tgt} | cut -f2 -d '/')"
|
||||
out="$(env GOOS=${o} GOARCH=${a} go build ./... 2>&1)"
|
||||
ret=${?}
|
||||
if [ $ret -ne 0 ];
|
||||
then
|
||||
echo "OS: ${o}"
|
||||
echo "ARCH: ${a}"
|
||||
echo "${out}"
|
||||
echo
|
||||
echo
|
||||
fi
|
||||
done
|
||||
@@ -19,9 +19,9 @@ func GetIDState() (ids IDState) {
|
||||
|
||||
var err error
|
||||
|
||||
ids.RUID, ids.EUID, ids.SUID = unix.Getresuid()
|
||||
ids.RUID, ids.EUID, ids.SUID = getresuid()
|
||||
ids.uidsChecked = true
|
||||
ids.RGID, ids.EGID, ids.SGID = unix.Getresgid()
|
||||
ids.RGID, ids.EGID, ids.SGID = getresgid()
|
||||
ids.gidsChecked = true
|
||||
|
||||
ids.SudoEnvCmd = envs.HasEnv(envSudoCmd)
|
||||
@@ -59,7 +59,7 @@ func GetIDState() (ids IDState) {
|
||||
func GetIDStateProc(pid uint32) (ids IDState, err error) {
|
||||
|
||||
var i32 int32
|
||||
var ints []int32
|
||||
var ints []uint32
|
||||
var sudoUid bool
|
||||
var sudoUname bool
|
||||
var proc *process.Process
|
||||
|
||||
31
funcs_nix_noresuid.go
Normal file
31
funcs_nix_noresuid.go
Normal file
@@ -0,0 +1,31 @@
|
||||
//go:build !(windows || plan9 || wasip1 || js || ios) && (aix || darwin || dragonfly || freebsd || illumos || netbsd || solaris)
|
||||
|
||||
package sysutils
|
||||
|
||||
import (
|
||||
`golang.org/x/sys/unix`
|
||||
)
|
||||
|
||||
// getresgid spoofs unix.Getresgid, as this file targets platforms that do not support it.
|
||||
func getresgid() (rgid, egid, sgid int) {
|
||||
|
||||
// rgid, egid, sgid = unix.Getresgid()
|
||||
|
||||
rgid = unix.Getgid()
|
||||
egid = unix.Getegid()
|
||||
sgid = -1
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// getresuid spoofs unix.Getresuid, as this file targets platforms that do not support it.
|
||||
func getresuid() (ruid, euid, suid int) {
|
||||
|
||||
// ruid, euid, suid = unix.Getresuid()
|
||||
|
||||
ruid = unix.Getuid()
|
||||
euid = unix.Geteuid()
|
||||
suid = -1
|
||||
|
||||
return
|
||||
}
|
||||
23
funcs_nix_resuid.go
Normal file
23
funcs_nix_resuid.go
Normal file
@@ -0,0 +1,23 @@
|
||||
//go:build !(windows || plan9 || wasip1 || js || ios) && !(aix || darwin || dragonfly || freebsd || illumos || netbsd || solaris)
|
||||
|
||||
package sysutils
|
||||
|
||||
import (
|
||||
`golang.org/x/sys/unix`
|
||||
)
|
||||
|
||||
// getresgid wraps unix.Getresgid, as this file targets platforms that fully support it.
|
||||
func getresgid() (rgid, egid, sgid int) {
|
||||
|
||||
rgid, egid, sgid = unix.Getresgid()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// getresuid wraps unix.Getresuid, as this file targets platforms that fully support it.
|
||||
func getresuid() (ruid, euid, suid int) {
|
||||
|
||||
ruid, euid, suid = unix.Getresuid()
|
||||
|
||||
return
|
||||
}
|
||||
2
go.mod
2
go.mod
@@ -10,7 +10,7 @@ require (
|
||||
golang.org/x/sync v0.19.0
|
||||
golang.org/x/sys v0.40.0
|
||||
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8
|
||||
r00t2.io/goutils v1.16.3
|
||||
r00t2.io/goutils v1.16.4
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
4
go.sum
4
go.sum
@@ -39,5 +39,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8 h1:FW42yWB1sGClqswyHIB68wo0+oPrav1IuQ+Tdy8Qp8E=
|
||||
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8/go.mod h1:44w9OfBSQ9l3o59rc2w3AnABtE44bmtNnRMNC7z+oKE=
|
||||
r00t2.io/goutils v1.16.2 h1:aJtAD+t1pCaM9cpO1o1S7UDDh7fxBPT7CTYuGHJsVVo=
|
||||
r00t2.io/goutils v1.16.2/go.mod h1:h+XtmWIvgm5S/liSJYFw3N09r5J7cjZ+Z5+aoYGw67k=
|
||||
r00t2.io/goutils v1.16.4 h1:pzF2JcejcbIBeCpvE2yVwXfIlUs0yL2TKMB8sBl1xJc=
|
||||
r00t2.io/goutils v1.16.4/go.mod h1:57B9wDCUgR5+sE02Nwk9DHG76Sgrt9EinCY10SSw6ac=
|
||||
|
||||
11
types_nix.go
11
types_nix.go
@@ -11,7 +11,16 @@ IDState collects information about the current running process.
|
||||
It should only be used as returned from GetIDState().
|
||||
Its methods WILL return false information if any of these values are altered.
|
||||
|
||||
FSUID/FSGID are not supported.
|
||||
FSUID/FSGID are not currently supported.
|
||||
|
||||
Currently, macOS (and FreeBSD, and a couple others) will not populate:
|
||||
|
||||
* SUID
|
||||
* SGID
|
||||
|
||||
due to Apple in their "infinite wisdom" allowing you to *set* these
|
||||
but exposing no direct syscall whatsoever to *retrieve* them.
|
||||
Enjoy your crippled OS, fanboys.
|
||||
*/
|
||||
type IDState struct {
|
||||
// RUID: Real UID
|
||||
|
||||
Reference in New Issue
Block a user