Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AD-Control-Golang
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶腾飞
AD-Control-Golang
Commits
8eade0b1
Commit
8eade0b1
authored
Apr 26, 2022
by
浔阳陌客
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022/04/26 v2.5.4
parent
e47b8496
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
35 deletions
+45
-35
README.MD
+1
-0
public/cmdbjson.go
+3
-3
public/env.go
+1
-1
public/msg_deal.go
+13
-0
public/msg_init.go
+24
-28
public/win.go
+3
-3
No files found.
README.MD
View file @
8eade0b1
...
...
@@ -100,6 +100,7 @@
-
2022/04/23 v2.5.1 每月10号和25号提醒新人创建个人账号
-
2022/04/23 v2.5.2 添加知微运维平台的"账号管理功能"
-
2022/04/25 v2.5.3 更新powershell函数
-
2022/04/26 v2.5.4 更新powershell函数
## 四、其他说明
...
...
public/cmdbjson.go
View file @
8eade0b1
...
...
@@ -108,7 +108,7 @@ func (cir *CIRecordStartup) GetHardWare() {
// cpu
go
func
()
{
defer
wg
.
Done
()
cpuCount
,
cpuName
,
cpuCores
,
cpuLogicalProcessors
:=
g
etHardwareCPUForPS
()
cpuCount
,
cpuName
,
cpuCores
,
cpuLogicalProcessors
:=
G
etHardwareCPUForPS
()
cir
.
Cpu
=
fmt
.
Sprintf
(
"%s * %s %s核 %s线程"
,
cpuCount
,
cpuName
,
cpuCores
,
cpuLogicalProcessors
)
}()
...
...
@@ -116,7 +116,7 @@ func (cir *CIRecordStartup) GetHardWare() {
go
func
()
{
defer
wg
.
Done
()
Capacity
,
Speed
,
MemoryType
,
mCount
:=
g
etHardwareMemoryForPS
()
Capacity
,
Speed
,
MemoryType
,
mCount
:=
G
etHardwareMemoryForPS
()
for
i
:=
0
;
i
<=
mCount
;
i
++
{
cir
.
Memory
+=
fmt
.
Sprintf
(
"%dGB %sMhz %s,"
,
Capacity
[
i
],
Speed
[
i
],
MemoryType
[
i
])
}
...
...
@@ -126,7 +126,7 @@ func (cir *CIRecordStartup) GetHardWare() {
// 硬盘
go
func
()
{
defer
wg
.
Done
()
_
,
Sizen
,
MediaType
,
hCount
:=
g
etHardwareHardDiskForPS
(
false
)
_
,
Sizen
,
MediaType
,
hCount
:=
G
etHardwareHardDiskForPS
(
false
)
for
i
:=
0
;
i
<=
hCount
;
i
++
{
cir
.
Disk
+=
fmt
.
Sprintf
(
"%dGB %s,"
,
Sizen
[
i
],
MediaType
[
i
])
}
...
...
public/env.go
View file @
8eade0b1
...
...
@@ -11,7 +11,7 @@ const SymbolHostname = "-"
// AD-Control //
const
Version
string
=
"2.5.
3
"
const
Version
string
=
"2.5.
4
"
const
Host_adserver
string
=
"ADSERVER"
const
Host_adserver_ip
string
=
"192.168.0.20"
const
Host_thserver
string
=
"THSERVER"
...
...
public/msg_deal.go
View file @
8eade0b1
...
...
@@ -48,6 +48,13 @@ func DealMsg(msgtype, url string, unmsg []byte) []byte {
ice
:=
msg
.
MsgDeal
()
ret
=
ReParseJson
(
&
ice
)
// CMDB 消息
case
Msg_CMDB
:
var
msg
MJcmdb
ParseJson
(
unmsg
,
&
msg
)
ice
:=
msg
.
MsgDeal
()
ret
=
ReParseJson
(
&
ice
)
default
:
msg
:=
ParseWX
(
url
,
&
unmsg
)
go
msg
.
MsgDealSend
()
...
...
@@ -422,6 +429,12 @@ func (wake *MJwake) MsgDeal() interface{} {
return
wake
}
// 关于 CMDB 的消息处理
func
(
cmdb
*
MJcmdb
)
MsgDeal
()
interface
{}
{
fmt
.
Println
(
"cmdb"
)
return
cmdb
}
// 关于 wxwork 企业微信 的 消息处理
func
(
wxwork
*
MJwxwork
)
MsgDealSend
()
{
...
...
public/msg_init.go
View file @
8eade0b1
...
...
@@ -9,6 +9,7 @@ import (
const
EndSign
byte
=
125
// msg status //////////////////////////////////////////////////////////////
const
Msg_status_commit
string
=
"commit"
const
Msg_status_deal
string
=
"deal"
...
...
@@ -16,36 +17,23 @@ const Msg_status_deal string = "deal"
const
Msg_Report
string
=
"report"
const
Msg_Exec
string
=
"exec"
const
Msg_Wxwork
string
=
"wxwork"
const
Msg_Wake
string
=
"wake"
// base word ////////////////////////////////////////////////////////////////
const
LogInUser
string
=
"LogInUser"
const
LogOutUser
string
=
"LogOutUser"
const
WillLogInUser
string
=
"WillLogInUser"
const
WillLogOutUser
string
=
"WillLogOutUser"
const
TurnOnPC
string
=
"TurnOnPC"
const
TurnOffPC
string
=
"TurnOffPC"
const
WillTurnOnPC
string
=
"WillTurnOnPC"
const
WillTurnOffPC
string
=
"WillTurnOffPC"
const
UpdatePrimaryHost
string
=
"UpdatePrimaryHost"
const
SignUPUser
string
=
"SignUPUser"
const
Dimission
string
=
"Dimission"
const
Msg_CMDB
string
=
"cmdb"
const
Msg_Wxwork
string
=
"wxwork"
// msg report type ///////////////////////////////////////////////////////////
const
Msg_Report_LoginInUser
string
=
LogInUser
const
Msg_Report_LogOutUser
string
=
LogInUser
const
Msg_Report_WillLogInUser
string
=
WillLogInUser
const
Msg_Report_WillLogOutUser
string
=
WillLogOutUser
const
Msg_Report_TurnOnPC
string
=
TurnOnPC
const
Msg_Report_TurnOffPC
string
=
TurnOffPC
const
Msg_Report_WillTurnOnPC
string
=
WillTurnOnPC
const
Msg_Report_WillTurnOffPC
string
=
WillTurnOffPC
const
Msg_Report_UpdatePrimaryHost
string
=
UpdatePrimaryHost
const
Msg_Report_SignUPUser
string
=
SignUPUser
const
Msg_Report_Dimission
string
=
Dimission
const
Msg_Report_LoginInUser
string
=
"LogInUser"
const
Msg_Report_LogOutUser
string
=
"LogOutUser"
const
Msg_Report_WillLogInUser
string
=
"WillLogInUser"
const
Msg_Report_WillLogOutUser
string
=
"WillLogOutUser"
const
Msg_Report_TurnOnPC
string
=
"TurnOnPC"
const
Msg_Report_TurnOffPC
string
=
"TurnOffPC"
const
Msg_Report_WillTurnOnPC
string
=
"WillTurnOnPC"
const
Msg_Report_WillTurnOffPC
string
=
"WillTurnOffPC"
const
Msg_Report_UpdatePrimaryHost
string
=
"UpdatePrimaryHost"
const
Msg_Report_SignUPUser
string
=
"SignUPUser"
const
Msg_Report_Dimission
string
=
"Dimission"
// msg exec type ////////////////////////////////////////////////////////////////
...
...
@@ -53,9 +41,9 @@ const Msg_Exec_State_Request string = "request"
const
Msg_Exec_State_Ack
string
=
"ack"
const
Msg_Exec_State_Over
string
=
"over"
const
Msg_Exec_UserActivitydetection
string
=
"UserActivitydetection"
const
Msg_Exec_TurnOffPC
string
=
TurnOffPC
const
Msg_Exec_TurnOffPC
string
=
"TurnOffPC"
const
Msg_Exec_TurnOffPC_cmd
string
=
"shutdown -s -t 300"
const
Msg_Exec_LogOffUser
string
=
LogOutUser
const
Msg_Exec_LogOffUser
string
=
"LogOutUser"
const
Msg_Exec_LogOffUser_cmd
string
=
"shutdown -l"
const
Msg_Exec_RebootWindows
string
=
"rebootWindows"
const
Msg_Exec_RebootWindows_cmd
string
=
"shutdown -r -t 15"
...
...
@@ -65,6 +53,7 @@ const Msg_Exec_OpenAdminEXE string = "OpenAdmin"
const
Msg_Exec_OpenRemoteTerminal
string
=
"OpenRemoteTerminal"
// msg wkae type ////////////////////////////////////////////////////////////////
const
Msg_Wake_Status_Req
string
=
"WakeReq"
const
Msg_Wake_Status_Start
string
=
"WakeStart"
const
Msg_Wake_Status_Over
string
=
"WakeOver"
...
...
@@ -139,6 +128,13 @@ type MJwxwork struct {
Result
string
Content
string
}
type
MJcmdb
struct
{
MsgType
string
`json:"msgtype"`
Status
string
`json:"status"`
Instruction
string
`json:"instruction"`
Explain
string
`json:"explain"`
Version
string
`json:"version"`
}
//
//
...
...
public/win.go
View file @
8eade0b1
...
...
@@ -370,7 +370,7 @@ func GetNewFolder(rdir, extdir string) string {
}
// 获取硬件信息
func
g
etHardwareCPUForPS
()
(
string
,
string
,
string
,
string
)
{
func
G
etHardwareCPUForPS
()
(
string
,
string
,
string
,
string
)
{
var
c
,
j
int
var
cpuCount
,
cpuName
,
cpuCores
,
cpuLogicalProcessors
string
cpuUN
,
_
:=
PSCommandOutputNoSplit
(
"Get-WmiObject -Class Win32_Processor | select Name,NumberOfCores,NumberOfLogicalProcessors | format-list"
)
...
...
@@ -397,7 +397,7 @@ func getHardwareCPUForPS() (string, string, string, string) {
}
return
cpuCount
,
cpuName
,
cpuCores
,
cpuLogicalProcessors
}
func
g
etHardwareMemoryForPS
()
([]
int
,
[]
string
,
[]
string
,
int
)
{
func
G
etHardwareMemoryForPS
()
([]
int
,
[]
string
,
[]
string
,
int
)
{
Capacity
:=
make
([]
int
,
2
)
Speed
:=
make
([]
string
,
2
)
...
...
@@ -465,7 +465,7 @@ func getHardwareMemoryForPS() ([]int, []string, []string, int) {
}
return
Capacity
,
Speed
,
MemoryType
,
j
-
1
}
func
g
etHardwareHardDiskForPS
(
mini
bool
)
([]
string
,
[]
int64
,
[]
string
,
int
)
{
func
G
etHardwareHardDiskForPS
(
mini
bool
)
([]
string
,
[]
int64
,
[]
string
,
int
)
{
MediaType
:=
make
([]
string
,
2
)
FriendlyName
:=
make
([]
string
,
2
)
Sizen
:=
make
([]
int64
,
2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment