mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-26 00:21:54 +08:00
release revsuit vBeta0.1.0 (#15)
Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
@@ -1 +1,10 @@
|
||||
package cli
|
||||
|
||||
const banner = `
|
||||
____ _____ _ __
|
||||
/ __ \___ _ __/ ___/__ __(_) /_
|
||||
/ /_/ / _ \ | / /\__ \/ / / / / __/
|
||||
/ _, _/ __/ |/ /___/ / /_/ / / /_
|
||||
/_/ |_|\___/|___//____/\__,_/_/\__/
|
||||
v%s
|
||||
https://revsuit.pro`
|
||||
|
||||
+26
-6
@@ -1,16 +1,21 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"github.com/li4n0/revsuit/pkg/server"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
log "unknwon.dev/clog/v2"
|
||||
)
|
||||
|
||||
func Start() {
|
||||
_ = log.NewConsole(100,
|
||||
log.ConsoleConfig{
|
||||
Level: log.LevelInfo,
|
||||
})
|
||||
app := &cli.App{
|
||||
Name: "RevSuit",
|
||||
Usage: "An Open-Sourced Reverse Platform Designed for Receive Various Kinds of Connection",
|
||||
@@ -23,21 +28,32 @@ func Start() {
|
||||
Name: "token",
|
||||
Usage: "token used to manage platform",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "flags",
|
||||
Usage: "for http and dns connection, platform will only record the connection those match these regex flags. * meaning record all",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "db",
|
||||
Usage: "database file path",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "log",
|
||||
Usage: "specify a log level from debug, info, warn, error, fatal. (default: info)",
|
||||
},
|
||||
&cli.PathFlag{
|
||||
Name: "config",
|
||||
Usage: "load configuration from FILE (default: config.yaml)",
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
var configFile = "config.yaml"
|
||||
if c.Path("config") != "" {
|
||||
configFile = c.Path("config")
|
||||
}
|
||||
conf := &server.Config{}
|
||||
if content, err := os.ReadFile("config.yaml"); err == nil {
|
||||
if content, err := os.ReadFile(configFile); err == nil {
|
||||
if err := yaml.Unmarshal(content, conf); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if os.IsNotExist(err) && configFile == "config.yaml" {
|
||||
log.Warn("Generate default configurations to config.yaml, please configure and run again.")
|
||||
return os.WriteFile("config.yaml", configTemplate, 0644)
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
@@ -50,6 +66,10 @@ func Start() {
|
||||
if c.String("db") != "" {
|
||||
conf.Database = c.String("db")
|
||||
}
|
||||
if c.String("log") != "" {
|
||||
conf.Database = c.String("log")
|
||||
}
|
||||
fmt.Printf(banner, server.VERSION)
|
||||
server.New(conf).Run()
|
||||
return nil
|
||||
},
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
version: 4.0
|
||||
addr: :10000
|
||||
token:
|
||||
database: revsuit.db
|
||||
log_level: info
|
||||
|
||||
http:
|
||||
ip_header:
|
||||
dns:
|
||||
enable: true
|
||||
rmi:
|
||||
enable: true
|
||||
addr: :1099
|
||||
mysql:
|
||||
enable: true
|
||||
addr: :3306
|
||||
version_string: 10.4.13-MariaDB-log
|
||||
ftp:
|
||||
enable: true
|
||||
addr: :21
|
||||
pasv_ip: 127.0.0.1 # your public network ip
|
||||
pasv_port: 2020
|
||||
notice:
|
||||
dingtalk: https://oapi.dingtalk.com/robot/send?access_token={token}
|
||||
lark: https://open.feishu.cn/open-apis/bot/v2/hook/{token}
|
||||
weixin: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={key}
|
||||
slack: https://hooks.slack.com/services/{id}/{token}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
//go:embed config.tpl.yaml
|
||||
var configTemplate []byte
|
||||
Reference in New Issue
Block a user