Compare commits
2 Commits
wip_envs_s
...
v1.16.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed44eb6230
|
||
|
|
1130fb028d
|
11
TODO
11
TODO
@@ -12,17 +12,6 @@
|
|||||||
- constants/vars for errors
|
- constants/vars for errors
|
||||||
|
|
||||||
- func and struct to return segregated system-level env vars vs. user env vars (mostly usable on windows) (see envs/.TODO.go.UNFINISHED)
|
- func and struct to return segregated system-level env vars vs. user env vars (mostly usable on windows) (see envs/.TODO.go.UNFINISHED)
|
||||||
-- https://www3.ntu.edu.sg/home/ehchua/programming/howto/Environment_Variables.html
|
|
||||||
-- windows:
|
|
||||||
--- https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables
|
|
||||||
--- https://pureinfotech.com/list-environment-variables-windows-10/
|
|
||||||
--- https://gist.github.com/RebeccaWhit3/5dad8627b8227142e1bea432db3f8824
|
|
||||||
--- https://ss64.com/nt/syntax-variables.html
|
|
||||||
-- linux/XDG:
|
|
||||||
--- https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
|
|
||||||
--- https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
||||||
-- macOS:
|
|
||||||
--- https://ss64.com/osx/syntax-env_vars.html
|
|
||||||
|
|
||||||
- validator for windows usernames, domains, etc. (for *NIX, https://unix.stackexchange.com/a/435120/284004)
|
- validator for windows usernames, domains, etc. (for *NIX, https://unix.stackexchange.com/a/435120/284004)
|
||||||
-- https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou
|
-- https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou
|
||||||
|
|||||||
8
doc_nix.go
Normal file
8
doc_nix.go
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
//go:build !(windows || plan9 || wasip1 || js || ios)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Package sysutils provides [IDState], a collection of process information as it relates to user/group access/membership.
|
||||||
|
|
||||||
|
Take note that this module's main functionality is in its child packages.
|
||||||
|
*/
|
||||||
|
package sysutils
|
||||||
9
doc_windows.go
Normal file
9
doc_windows.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
Package sysutils provides [IDState], a collection of process information as it relates to user/group access/membership.
|
||||||
|
|
||||||
|
NOTE: an [IDState], and all the functions/methods thereof, are fairly useless on Windows as all methods are NO-OPs and
|
||||||
|
[GetIDState]/[GetIDStateProc] just return an empty [IDState]. It is primarily provided on Windows for easier cross-platform development.
|
||||||
|
|
||||||
|
Take note that this module's main functionality is in its child packages.
|
||||||
|
*/
|
||||||
|
package sysutils
|
||||||
30
envs/.osenvs.WIP/TODO
Normal file
30
envs/.osenvs.WIP/TODO
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
macOS:
|
||||||
|
HOME
|
||||||
|
LOGNAME
|
||||||
|
OLDPWD
|
||||||
|
PATH
|
||||||
|
PWD
|
||||||
|
SHELL
|
||||||
|
SHLVL
|
||||||
|
SSH_CLIENT
|
||||||
|
SSH_CONNECTION
|
||||||
|
SSH_TTY
|
||||||
|
TERM
|
||||||
|
TMPDIR
|
||||||
|
USER
|
||||||
|
_
|
||||||
|
e.g.
|
||||||
|
HOME=/Users/bts
|
||||||
|
LOGNAME=bts
|
||||||
|
OLDPWD=/Users/bts
|
||||||
|
PATH=/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
|
||||||
|
PWD=/Users/bts
|
||||||
|
SHELL=/bin/zsh
|
||||||
|
SHLVL=1
|
||||||
|
SSH_CLIENT=192.168.2.99 39690 22
|
||||||
|
SSH_CONNECTION=192.168.2.99 39690 192.168.2.148 22
|
||||||
|
SSH_TTY=/dev/ttys000
|
||||||
|
TERM=xterm-256color
|
||||||
|
TMPDIR=/var/folders/qv/bm6dlyd94x5fs6qpkfpj0jsr0000gq/T/
|
||||||
|
USER=bts
|
||||||
|
_=/usr/bin/env
|
||||||
7
envs/.osenvs.WIP/doc.go
Normal file
7
envs/.osenvs.WIP/doc.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
Package osenvs contains information (and, in some cases, defaults and associated methods) for
|
||||||
|
[environment variables] ("env vars") as provided by/as part of the OS.
|
||||||
|
|
||||||
|
[environment variables]: https://www3.ntu.edu.sg/home/ehchua/programming/howto/Environment_Variables.html
|
||||||
|
*/
|
||||||
|
package osenvs
|
||||||
56
envs/.osenvs.WIP/types.go
Normal file
56
envs/.osenvs.WIP/types.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package osenvs
|
||||||
|
|
||||||
|
type (
|
||||||
|
/*
|
||||||
|
AppleEnv are default environment variables found in all macOS instances.
|
||||||
|
|
||||||
|
See also the [ss64 article].
|
||||||
|
|
||||||
|
macOS also has [POSIXEnv] env vars.
|
||||||
|
|
||||||
|
[ss64 article]: https://ss64.com/osx/syntax-env_vars.html
|
||||||
|
*/
|
||||||
|
AppleEnv string
|
||||||
|
/*
|
||||||
|
MSEnv are default environment variables found in Windows instances.
|
||||||
|
|
||||||
|
These include:
|
||||||
|
|
||||||
|
* [USMT environment variables]
|
||||||
|
* ONLY the [Environment Variables] for Poweshell
|
||||||
|
** Thus no Powershell ["Automatic variables"] or ["Preference variables"]
|
||||||
|
* standard system environment variables and user environment variables
|
||||||
|
|
||||||
|
See also the [ss64 article] and the [compiled Windows 10 list] and [Windows 10/11 list].
|
||||||
|
|
||||||
|
[USMT environment variables]: https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables
|
||||||
|
[Environment Variables]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.5
|
||||||
|
["Automatic variables"]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables
|
||||||
|
["Preference variables"]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables
|
||||||
|
[ss64 article]: https://ss64.com/nt/syntax-variables.html
|
||||||
|
[compiled Windows 10 list]: https://gist.github.com/RebeccaWhit3/5dad8627b8227142e1bea432db3f8824
|
||||||
|
[Windows 10/11 list]: https://pureinfotech.com/list-environment-variables-windows-10/
|
||||||
|
*/
|
||||||
|
MSEnv string
|
||||||
|
/*
|
||||||
|
POSIXEnv are environment variables defined by/in [POSIX.1-2024] § [8. Environment Variables].
|
||||||
|
|
||||||
|
[POSIX.1-2024]: https://pubs.opengroup.org/onlinepubs/9799919799/
|
||||||
|
[8. Environment Variables]: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html
|
||||||
|
*/
|
||||||
|
POSIXEnv string
|
||||||
|
/*
|
||||||
|
XDGEnv are environment variables defined by the [FreeDesktop] [spec] for the
|
||||||
|
[XDG Base Directory Specification] § [3 Environment Variables].
|
||||||
|
|
||||||
|
Generally these are only found/expected on Linux, and only a subset of them at that.
|
||||||
|
|
||||||
|
Linux also has [POSIXEnv] env vars.
|
||||||
|
|
||||||
|
[FreeDesktop]: https://www.freedesktop.org/wiki/
|
||||||
|
[spec]: https://specifications.freedesktop.org/
|
||||||
|
[XDG Base Directory Specification]: https://specifications.freedesktop.org/basedir/latest/#variables
|
||||||
|
[3 Environment Variables]: https://specifications.freedesktop.org/basedir/latest/#variables
|
||||||
|
*/
|
||||||
|
XDGEnv string
|
||||||
|
)
|
||||||
@@ -140,7 +140,7 @@ func (i *IDState) PPIDUIDsChecked() (checked bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// SudoChecked is true if SudoEnvVars can be trusted
|
// SudoChecked is true if SudoEnvVars can be trusted.
|
||||||
func (i *IDState) SudoChecked() (checked bool) {
|
func (i *IDState) SudoChecked() (checked bool) {
|
||||||
|
|
||||||
if i == nil {
|
if i == nil {
|
||||||
|
|||||||
72
funcs_idstate_windows.go
Normal file
72
funcs_idstate_windows.go
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package sysutils
|
||||||
|
|
||||||
|
// Checked consolidates all the provided checked functions. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) Checked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IsReal consolidates all the elevation/dropped-privs checks into a single method.
|
||||||
|
|
||||||
|
This is a NO-OP on Windows.
|
||||||
|
*/
|
||||||
|
func (i *IDState) IsReal(real bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IsSudoGroup is true if any of the group sudo env vars are set,
|
||||||
|
or the parent process has a different group (and is not PID 1).
|
||||||
|
|
||||||
|
This is a NO-OP on Windows.
|
||||||
|
*/
|
||||||
|
func (i *IDState) IsSudoGroup() (sudo bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
IsSudoUser is true if any of the user sudo env vars are set,
|
||||||
|
or the parent process has a different owner (and is not PID 1).
|
||||||
|
|
||||||
|
This is a NO-OP on Windows.
|
||||||
|
*/
|
||||||
|
func (i *IDState) IsSudoUser() (sudo bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSuid is true if the RUID does not match EUID or SUID. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) IsSuid() (suid bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsSgid is true if the RGID does not match EGID or SGID. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) IsSgid() (sgid bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GIDsChecked is true if the GIDs presented can be trusted. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) GIDsChecked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// PPIDGIDsChecked is true if PPIDGidMatch can be trusted. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) PPIDGIDsChecked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// PPIDUIDsChecked is true if PPIDUidMatch can be trusted. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) PPIDUIDsChecked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// SudoChecked is true if SudoEnvVars can be trusted. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) SudoChecked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// UIDsChecked is true if the UIDs presented can be trusted. This is a NO-OP on Windows.
|
||||||
|
func (i *IDState) UIDsChecked() (checked bool) {
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
`math`
|
`math`
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
`github.com/shirou/gopsutil/v3/process`
|
`github.com/shirou/gopsutil/v4/process`
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"r00t2.io/sysutils/envs"
|
"r00t2.io/sysutils/envs"
|
||||||
`r00t2.io/sysutils/errs`
|
`r00t2.io/sysutils/errs`
|
||||||
|
|||||||
13
funcs_windows.go
Normal file
13
funcs_windows.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package sysutils
|
||||||
|
|
||||||
|
// GetIDState returns current ID/elevation information. This is a NO-OP on Windows.
|
||||||
|
func GetIDState() (ids IDState) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetIDStateProc is like GetIDState but for an arbitrary PID. This is a NO-OP on Windows.
|
||||||
|
func GetIDStateProc(pid uint32) (ids IDState, err error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
16
go.mod
16
go.mod
@@ -1,17 +1,16 @@
|
|||||||
module r00t2.io/sysutils
|
module r00t2.io/sysutils
|
||||||
|
|
||||||
go 1.24.5
|
go 1.25
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/djherbis/times v1.6.0
|
github.com/djherbis/times v1.6.0
|
||||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||||
github.com/shirou/gopsutil/v3 v3.24.5
|
github.com/shirou/gopsutil/v4 v4.25.12
|
||||||
github.com/shirou/gopsutil/v4 v4.25.10
|
golang.org/x/sync v0.19.0
|
||||||
golang.org/x/sync v0.17.0
|
golang.org/x/sys v0.40.0
|
||||||
golang.org/x/sys v0.37.0
|
|
||||||
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8
|
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8
|
||||||
r00t2.io/goutils v1.10.3
|
r00t2.io/goutils v1.16.3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -19,8 +18,7 @@ require (
|
|||||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
|
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||||
github.com/shoenig/go-m1cpu v0.1.7 // indirect
|
github.com/tklauser/go-sysconf v0.3.16 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.15 // indirect
|
github.com/tklauser/numcpus v0.11.0 // indirect
|
||||||
github.com/tklauser/numcpus v0.10.0 // indirect
|
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
30
go.sum
30
go.sum
@@ -17,33 +17,27 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||||
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
|
github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPic6CY=
|
||||||
github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
|
github.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.10 h1:at8lk/5T1OgtuCp+AwrDofFRjnvosn0nkN2OLQ6g8tA=
|
|
||||||
github.com/shirou/gopsutil/v4 v4.25.10/go.mod h1:+kSwyC8DRUD9XXEHCAFjK+0nuArFJM0lva+StQAcskM=
|
|
||||||
github.com/shoenig/go-m1cpu v0.1.7 h1:C76Yd0ObKR82W4vhfjZiCp0HxcSZ8Nqd84v+HZ0qyI0=
|
|
||||||
github.com/shoenig/go-m1cpu v0.1.7/go.mod h1:KkDOw6m3ZJQAPHbrzkZki4hnx+pDRR1Lo+ldA56wD5w=
|
|
||||||
github.com/shoenig/test v1.7.0 h1:eWcHtTXa6QLnBvm0jgEabMRN/uJ4DMV3M8xUGgRkZmk=
|
|
||||||
github.com/shoenig/test v1.7.0/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI=
|
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
|
github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA=
|
||||||
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
|
github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI=
|
||||||
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
|
github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw=
|
||||||
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
|
github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
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 h1:FW42yWB1sGClqswyHIB68wo0+oPrav1IuQ+Tdy8Qp8E=
|
||||||
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8/go.mod h1:44w9OfBSQ9l3o59rc2w3AnABtE44bmtNnRMNC7z+oKE=
|
honnef.co/go/augeas v0.0.0-20161110001225-ca62e35ed6b8/go.mod h1:44w9OfBSQ9l3o59rc2w3AnABtE44bmtNnRMNC7z+oKE=
|
||||||
r00t2.io/goutils v1.10.3 h1:GmEtsM/nrrVWooYJllXDRsgInobEinv2dn5ccU4zGAA=
|
r00t2.io/goutils v1.16.2 h1:aJtAD+t1pCaM9cpO1o1S7UDDh7fxBPT7CTYuGHJsVVo=
|
||||||
r00t2.io/goutils v1.10.3/go.mod h1:76AxpXUeL10uFklxRB11kQsrtj2AKiNm8AwG1bNoBCA=
|
r00t2.io/goutils v1.16.2/go.mod h1:h+XtmWIvgm5S/liSJYFw3N09r5J7cjZ+Z5+aoYGw67k=
|
||||||
|
|||||||
11
paths/TODO
11
paths/TODO
@@ -1 +1,12 @@
|
|||||||
- search criteria should *also* support a timestamp range (e.g. so a search can be restricted to both older than AND newer than; e.g. older than 00:00, newer than 01:00)
|
- search criteria should *also* support a timestamp range (e.g. so a search can be restricted to both older than AND newer than; e.g. older than 00:00, newer than 01:00)
|
||||||
|
|
||||||
|
- need an ExpandHomeSys (...which will change ExpandHome behavior, if it switches to path instead of path/filepath...)
|
||||||
|
-- Should probably split out to a separate module or branch to v2.
|
||||||
|
-- separate module:
|
||||||
|
--- r00t2.io/paths/
|
||||||
|
<generic>
|
||||||
|
gopath/
|
||||||
|
<generic path separator - forward slash>
|
||||||
|
syspath/
|
||||||
|
<os.PathSeparator>
|
||||||
|
I could consolidate a LOT of code if I use a struct that has a mode (or typed against different separators?) etc. but...
|
||||||
|
|||||||
38
types_windows.go
Normal file
38
types_windows.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package sysutils
|
||||||
|
|
||||||
|
/*
|
||||||
|
IDState on *NIX-like platforms collects information about the current running process.
|
||||||
|
|
||||||
|
However, it is only present as a sort of dummy on Windows to make cross-platform development easier.
|
||||||
|
Do not expect any sort of usefulness from this struct on Windows other than parsing an IDState generated on *NIX.
|
||||||
|
*/
|
||||||
|
type IDState struct {
|
||||||
|
// RUID: Real UID
|
||||||
|
RUID int
|
||||||
|
// EUID: Effective UID
|
||||||
|
EUID int
|
||||||
|
// SUID: Saved Set UID
|
||||||
|
SUID int
|
||||||
|
// RGID: Real GID
|
||||||
|
RGID int
|
||||||
|
// EGID: Effective GID
|
||||||
|
EGID int
|
||||||
|
// SGID: Saved Set GID
|
||||||
|
SGID int
|
||||||
|
// SudoEnvUser is true if SUDO_USER or SUDO_UID is set.
|
||||||
|
SudoEnvUser bool
|
||||||
|
// SudoEnvGroup is true if SUDO_GID is set.
|
||||||
|
SudoEnvGroup bool
|
||||||
|
// SudoEnvCmd is true if SUDO_COMMAND is set.
|
||||||
|
SudoEnvCmd bool
|
||||||
|
// SudoEnvHome is true if SUDO_HOME is set.
|
||||||
|
SudoEnvHome bool
|
||||||
|
// SudoEnvVars is true if any of the "well-known" sudo environment variables are set.
|
||||||
|
SudoEnvVars bool
|
||||||
|
// PPIDUidMatch is true if the parent PID UID matches the current process UID (mismatch usually indicates sudo invocation).
|
||||||
|
PPIDUidMatch bool
|
||||||
|
// PPIDGidMatch is true if the parent PID GID matches the current process GID (mismatch usually indicates sudo invocation).
|
||||||
|
PPIDGidMatch bool
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user