Done for tonight, project is becoming to big for "ctrl+z version control"... Start using GIT

This commit is contained in:
2024-02-05 00:23:38 +01:00
commit 1be97536ef
14 changed files with 1407 additions and 0 deletions

40
configLoader.go Normal file
View File

@@ -0,0 +1,40 @@
// /\_/|
// { ' ' } JellyCAT
// \____\
package main
import (
"fmt"
"github.com/BurntSushi/toml"
"os"
)
type Config struct {
HijackIP string `toml:"hijack_ip"`
HijackApp string `toml:"hijack_app"`
HijackImg string `toml:"hijack_img"`
ForwardIP string `toml:"forward_ip"`
HttpsPort string `toml:"https_port"`
HttpPort string `toml:"http_port"`
CertName string `toml:"common_name"`
}
var config Config
func loadConfig() {
// Reading config from settings.cfg file
fmt.Println("SYS-LOG: Loading Config...")
data, err := os.ReadFile("settings.cfg")
if err != nil {
fmt.Println("SYS-ERR: Error reading 'settings.cfg' config file:", err)
os.Exit(1)
}
if _, err := toml.Decode(string(data), &config); err != nil {
fmt.Println("SYS-ERR: Error decoding config file:", err)
os.Exit(1)
}
fmt.Println("SYS-LOG: Config Loaded!")
// Config loaded and ready to go back to the main function!
}