parent
ad1410410b
commit
40c6572a81
|
|
@ -23,40 +23,40 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"bufio"
|
"bufio"
|
||||||
"log"
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Detect which OS is running
|
tmpdir := ""
|
||||||
//tmpdir := ""
|
hostsloc := ""
|
||||||
//hostsloc := ""
|
cfgloc := ""
|
||||||
cfgloc := ""
|
|
||||||
switch runtime.GOOS {
|
sysdetect (&tmpdir, &hostsloc, &cfgloc)
|
||||||
case "windows":
|
|
||||||
fmt.Println("Windows is currently unsupported")
|
|
||||||
os.Exit(1)
|
|
||||||
//tmpdir := "C:\\tmp"
|
|
||||||
//hostsloc := "C:\\Windows\\System32\\drivers\\etc\\hosts"
|
|
||||||
case "linux":
|
|
||||||
//tmpdir = "/tmp/"
|
|
||||||
//hostsloc = "/etc/hosts"
|
|
||||||
cfgloc ="/etc/rhosts/rhosts.cfg"
|
|
||||||
case "ios":
|
|
||||||
fmt.Println("ios")
|
|
||||||
os.Exit(1)
|
|
||||||
default:
|
|
||||||
log.Print(runtime.GOOS," is not supported")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse Config
|
|
||||||
cfgparse(cfgloc)
|
cfgparse(cfgloc)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sysdetect (tmpdir, hostsloc, cfgloc *string) {
|
||||||
|
// Detect OS and set params
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "windows":
|
||||||
|
log.Fatal("Windows is not supported")
|
||||||
|
*tmpdir = "C:\\tmp"
|
||||||
|
*hostsloc = "C:\\Windows\\System32\\drivers\\etc\\hosts"
|
||||||
|
case "linux":
|
||||||
|
*tmpdir = "/tmp/"
|
||||||
|
*hostsloc = "/etc/hosts"
|
||||||
|
*cfgloc ="/etc/rhosts/rhosts.cfg"
|
||||||
|
case "ios":
|
||||||
|
log.Fatal("IOS is not supported")
|
||||||
|
default:
|
||||||
|
log.Fatal(runtime.GOOS," is not supported")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func cfgparse (cfgloc string){
|
func cfgparse (cfgloc string){
|
||||||
log.Print("Opening: ", cfgloc)
|
log.Print("Opening: ", cfgloc)
|
||||||
file, err := os.Open(cfgloc)
|
file, err := os.Open(cfgloc)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue