future-architect/vuls


Do you want to work on this issue?
You can request for a bounty in order to promote it!
Support for Gentoo Linux #1963
necrose99 posted onGitHub
<!-- If this is a FEATURE REQUEST, request format does not matter! -->
https://github.com/necrose99/GLSA-OVAL my parser needs much work ... yet still probably bit off more than i can chew... for now (hints welcomed)
however if Theirs items to take and intégrate feel free ...
scrape webpages for nvd cve links chat gpt is a help but... still broken bits
Gentoo Security Advisories anyway they have nvd links etc ..
sudo or vuls groupid vuls and vuls sub bits / depends ... gooval etc ... might need other perms ie windows admin etc... ie systemwide installs its been a while on vuls
//permissions.go
package main
import (
"fmt"
"os/exec"
"os/user"
"syscall"
)
func permissions) {
currentUser, err := user.Current()
if err != nil {
fmt.Println("Error getting current user:", err)
return
}
inVulsGroup, err := IsUserInGroup(currentUser, "vuls")
if err != nil {
fmt.Println("Error checking if user is in vuls group:", err)
return
}
if inVulsGroup || IsSudoUser(currentUser) {
cmd := exec.Command("vuls", "scan")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
err := cmd.Run()
if err != nil {
fmt.Println("Error running Vuls scanner:", err)
return
}
} else {
fmt.Println("User", currentUser.Username, "is not permitted to run Vuls scanner")
}
}
func IsUserInGroup(user *user.User, group string) (bool, error) {
// Logic to check if user is in a specific group
}
func IsSudoUser(user *user.User) bool {
// Logic to check if user has sudo privileges
}
`