summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-02-09 09:07:00 -0600
committerJeff Carr <[email protected]>2023-02-09 09:07:00 -0600
commitd00a8f5cd32147370f8318b1e469558f44b6c81e (patch)
treec45e8d0fd0f7da398bbe765a9fe10afc5f984372 /unix.go
parent00082af773b80948418bc9eb471ab22498e80c75 (diff)
a bunch more dns stuff
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/unix.go b/unix.go
new file mode 100644
index 0000000..b953c60
--- /dev/null
+++ b/unix.go
@@ -0,0 +1,41 @@
+// This creates a simple hello world window
+package main
+
+import (
+ "os"
+ "os/exec"
+ "log"
+ "net"
+// "git.wit.org/wit/gui"
+// "github.com/davecgh/go-spew/spew"
+)
+
+func CheckSuperuser() bool {
+ return os.Getuid() == 0
+}
+
+func Escalate() {
+ if os.Getuid() != 0 {
+ cmd := exec.Command("sudo", "./control-panel-dns")
+ cmd.Stdin = os.Stdin
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ err := cmd.Run()
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+}
+
+// You need permission to do a zone transfer. Otherwise:
+// dig +noall +answer +multiline lab.wit.org any
+// dig +all +multiline fire.lab.wit.org # gives the zonefile header (ttl vals)
+func DumpPublicDNSZone(zone string) {
+ entries, err := net.LookupHost(zone)
+ if err != nil {
+ panic(err)
+ }
+ for _, entry := range entries {
+ log.Println(entry)
+ }
+}