Commit 3e334cfd by 陶腾飞

2022/04/11 v2.3.2

parent 1c3dee1f
......@@ -93,6 +93,7 @@
- 2022/04/09 v2.2.5 修复IP地址、MAC地址获取失败的问题,添加cmdb信息更新时间字段,优化log日志,开机时将确定主机位置,修复DDR4的判断超过速率字段出现的场景导致无法判断DDR4的问题,小工具菜单名优化,远程唤醒优化
- 2022/04/11 v2.3.0 添加无用户登录时的工位活动检测
- 2022/04/11 v2.3.1 修复运行时无法检测环境变量问题
- 2022/04/11 v2.3.2 添加对用户注销、登录时log记录与转发
## 四、其他说明
......
......@@ -121,6 +121,11 @@ func flag_report(s string) {
LOG(ERROR, s, err.Error())
os.Exit(-1)
}
case pub.Msg_Report_WillLogInUser:
d = []byte(pub.User_name_display)
case pub.Msg_Report_LogOutUser:
d = []byte(pub.User_name_display)
}
pub.SendADMsg(pub.Msg_Report, pub.GJreportString(s, string(d)))
}
......@@ -134,15 +139,7 @@ func hour() {
}
}
func hourUserActivitydetection() {
// r2, err := pub.Execcmd_waitOutput("cmd /c query user")
// if err != nil {
// fmt.Printf("err %v\n", err)
// }
// fmt.Printf("return %s\n", string(r2))
// r := pub.Execcmd_outputIgnoreError("cmd /c query user")
// if len(r) == 0 {
pub.SendADMsg(pub.Msg_Exec, pub.GJexec(pub.Msg_Exec_UserActivitydetection, "0"))
// }
}
//直接指定mac地址,不带主机名参数
......
......@@ -11,7 +11,7 @@ const SymbolHostname = "-"
// AD-Control //
const Version string = "2.3.1"
const Version string = "2.3.2"
const Host_adserver string = "ADSERVER"
const Host_adserver_ip string = "192.168.0.20"
const Host_thserver string = "THSERVER"
......
......@@ -106,7 +106,13 @@ func (rep *MJreport) MsgDeal() interface{} {
}
case Msg_Report_WillLogInUser:
l := fmt.Sprintf("登陆 %s 在 %s", rep.DataStr, rep.Computername)
LOG(INFO, "REP_LOGIN", l)
SendWxworkTextToAdmins(l)
case Msg_Report_WillLogOutUser:
l := fmt.Sprintf("注销 %s 在 %s", rep.DataStr, rep.Computername)
LOG(INFO, "REP_LOGOUT", l)
SendWxworkTextToAdmins(l)
// 更新主要计算机
case Msg_Report_UpdatePrimaryHost:
......
......@@ -60,6 +60,24 @@ func execcmd_base(cmdargs string) (string, []string, error) {
LOG(INFO, "CMD", cmdargs)
return app, appargs, nil
}
func execcmd_base_nolog(cmdargs string) (string, []string, error) {
if cmdargs == "" {
return "", nil, Error_Null_Command
}
var app string
var appargs []string
spaceindex := strings.Index(cmdargs, " ")
if spaceindex != -1 {
app = cmdargs[:spaceindex]
appargs = strings.Split(cmdargs[spaceindex+1:], " ")
} else {
app = cmdargs
appargs[0] = ""
}
return app, appargs, nil
}
func Execcmd_nowait(cmdargs string) error {
app, appargs, err := execcmd_base(cmdargs)
if err != nil {
......@@ -122,7 +140,7 @@ func Execcmd_output(cmdargs string) []byte {
return nil
}
func Execcmd_outputIgnoreError(cmdargs string) []byte {
app, appargs, _ := execcmd_base(cmdargs)
app, appargs, _ := execcmd_base_nolog(cmdargs)
out, _ := exec.Command(app, appargs...).CombinedOutput()
outchinese, _ := simplifiedchinese.GBK.NewDecoder().Bytes(out)
......
......@@ -133,8 +133,6 @@ func GetWXWorkToken() (string, error) {
if wt.Errcode == 0 {
return wt.Access_token, nil
} else {
LOG(ERROR, NULL, err)
return "", Error_Fail_File_Write
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment