3
0
forked from ff/Botnet
Botnet/rootchk.go
Morrigan 01df84aeba IsRoot changed to global variable
IsRoot changed to global variable. todo: change from int to bool.
2019-03-24 19:41:01 -07:00

34 lines
365 B
Go

package main
import (
"fmt"
//"os"
"os/user"
"strconv"
)
var (
IsRoot int = 0
)
func chkroot(){
user, err := user.Current()
if err != nil {
panic(err)
}
id1, err := strconv.Atoi(user.Uid) //converts uid to a int
if id1 == 0 { //cheks if uid = 0
IsRoot = 1
}
}
func main() {
chkroot()
fmt.Println(IsRoot)
}