summaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
authorEnderByEndera <[email protected]>2021-01-04 19:12:08 +0800
committerEnderByEndera <[email protected]>2021-01-04 19:12:08 +0800
commitc8e63c7cf633d01688b7d65199703d03863910ee (patch)
tree9791f4308c80a50b2f8415c74497327300a65422 /cmd/root.go
parent8bdad142ee15e746c47de6819265d8b2fcb6644a (diff)
1. Added model package, will put all the structs to the
model package 2. Changed Command struct ,added arg "Flags" in the struct 3. move the marshal_and_unmarshal.go to the model pakcage 4. changed EvaluatePathRule func, return back to use the filepath.Walk func to check the score 5. added EvaluateWebsiteRule func in the rules package 6. added websiterules.json in the static/rules 7. added WebsiteRulesPath arg in the Conf struct in the yaml.go
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/root.go b/cmd/root.go
index a5a1ec0..87ec324 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -12,6 +12,7 @@ package cmd
import (
"commdetection/comm"
"commdetection/logger"
+ "commdetection/model"
"commdetection/rules"
"github.com/sirupsen/logrus"
@@ -34,7 +35,7 @@ var (
logLevel uint32
filters = []comm.Filter{}
- rs = rules.Rules{}
+ rs = model.Rules{}
)
// Execute executes the command
@@ -64,12 +65,12 @@ func root() {
for _, ev := range evaluations {
switch ev {
case "command":
- rs = rules.AddRule(rs, rules.Rule{
+ rs = rules.AddRule(rs, model.Rule{
Name: "Command",
RuleFunc: "EvaluateCommandRule",
})
case "path":
- rs = rules.AddRule(rs, rules.Rule{
+ rs = rules.AddRule(rs, model.Rule{
Name: "Path",
RuleFunc: "EvaluatePathRule",
})
@@ -91,7 +92,7 @@ func root() {
}
// StartEvaluateCommands starts evaluating commands using variables rootCmd provided
-func StartEvaluateCommands(filename string) []rules.CommScore {
+func StartEvaluateCommands(filename string) []model.CommScore {
// 从文件中获取路径,默认获取路径为/root/.bash_history
logger.Debugf("Start getting commmands from \"%s\"", filename)
commands := comm.GetCommands(filename, "")