1
0
forked from x/icebergs

fix ssh.scan repeat

This commit is contained in:
shaoying 2020-03-06 19:16:11 +08:00
parent 8765fe3187
commit 571d6d1f6c
4 changed files with 11 additions and 8 deletions

View File

@ -11,6 +11,7 @@ import (
"os/user"
"path"
"runtime"
"strings"
)
var Index = &ice.Context{Name: "cli", Help: "命令模块",
@ -45,7 +46,12 @@ var Index = &ice.Context{Name: "cli", Help: "命令模块",
m.Cmd(ice.AAA_ROLE, "root", m.Conf(ice.CLI_RUNTIME, "boot.username"))
}
if name, e := os.Getwd(); e == nil {
m.Conf(ice.CLI_RUNTIME, "boot.pathname", path.Base(kit.Select(name, os.Getenv("PWD"))))
name = path.Base(kit.Select(name, os.Getenv("PWD")))
ls := strings.Split(name, "/")
name = ls[len(ls)-1]
ls = strings.Split(name, "\\")
name = ls[len(ls)-1]
m.Conf(ice.CLI_RUNTIME, "boot.pathname", name)
}
// 启动记录

View File

@ -92,10 +92,7 @@ func (f *Frame) parse(m *ice.Message, line string) *Frame {
// 执行命令
msg := m.Spawns(f.target)
if msg.Cmdy(ls[0], ls[1:]); !msg.Hand {
// 系统命令
msg = msg.Set("result").Cmdy(ice.CLI_SYSTEM, ls)
}
msg.Cmdy(ls[0], ls[1:])
// 转换结果
res := msg.Result()

View File

@ -415,7 +415,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
"timeout.c", "30s",
)},
ice.WEB_DREAM: {Name: "dream", Help: "梦想家", Value: kit.Data("path", "usr/local/work",
"cmd", []interface{}{ice.CLI_SYSTEM, "ice.sh", "start", ice.WEB_SPACE, "connect"},
// "cmd", []interface{}{ice.CLI_SYSTEM, "ice.sh", "start", ice.WEB_SPACE, "connect"},
"cmd", []interface{}{ice.CLI_SYSTEM, "ice.bin", ice.WEB_SPACE, "connect"},
)},
ice.WEB_FAVOR: {Name: "favor", Help: "收藏夹", Value: kit.Data(kit.MDB_SHORT, kit.MDB_NAME)},

View File

@ -1458,8 +1458,7 @@ func (m *Message) Cmd(arg ...interface{}) *Message {
})
if m.Warn(m.Hand == false, "not found %v", list) {
m.Cmdy(CLI_SYSTEM, list)
m.Hand = true
return m.Set(MSG_RESULT).Cmd(CLI_SYSTEM, list)
}
return m
}