Add generate a dir and conf file in /etc/banforge
This commit is contained in:
21
local/config/sysconf.go
Normal file
21
local/config/sysconf.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateConf() {
|
||||||
|
if syscall.Geteuid() != 0 {
|
||||||
|
os.Exit(1)
|
||||||
|
fmt.Printf("You must be root to run\n, use the sudo/doas")
|
||||||
|
}
|
||||||
|
exec.Command("mkdir /etc/banforge")
|
||||||
|
exec.Command("touch /etc/banforge/config.toml")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func CheckSysConf() {
|
||||||
|
}
|
||||||
28
local/parser/parser.go
Normal file
28
local/parser/parser.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package parser
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"github.com/d3m0k1d/BanForge/local/logger"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Event struct {
|
||||||
|
Data string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Scaner struct {
|
||||||
|
scanner *bufio.Scanner
|
||||||
|
ch chan Event
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateScaner(path string) *Scaner {
|
||||||
|
log := logger.New(false)
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err.Error())
|
||||||
|
}
|
||||||
|
return &Scaner{
|
||||||
|
scanner: bufio.NewScanner(file),
|
||||||
|
ch: make(chan Event),
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user