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
1345e69e
Commit
1345e69e
authored
May 18, 2020
by
陶腾飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.8:更新 大屏主机的文件共享,取消TXHD的凌晨关机.
parent
45010501
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
92 additions
and
50 deletions
+92
-50
README.MD
+30
-14
adct/adct.exe
+0
-0
adct/adct.go
+9
-20
daemon/daemon.exe
+0
-0
public/env.go
+1
-1
public/win.go
+0
-1
users/menu.go
+51
-13
users/users.exe
+0
-0
users/users.go
+1
-1
No files found.
README.MD
View file @
1345e69e
# AD-Control-Goalng
# AD-Control-Goalng
# 程序简介
# 程序简介
本程序是从
[
AD-Control
](
http://git.zhiweidata.top/taotengfei/AD-Control
)
升级而来,并融合了在AD上经常使用的工具.
本程序是从
[
AD-Control
](
http://git.zhiweidata.top/taotengfei/AD-Control
)
升级而来,并融合了在AD上经常使用的工具.
# 概念
# 概念
1.
**AD,ADServer**
是主控
1.
**AD,ADServer**
是主控
...
@@ -12,24 +13,39 @@
...
@@ -12,24 +13,39 @@
# 程序作用简要
# 程序作用简要
## DCU - Domain Computer User
## DCU - Domain Computer User
在DC上以
**用户权限**
且
**任务栏托盘**
的方式启动
UI:在DC上以
**用户权限**
且
**任务栏托盘**
的方式运行
使用方式:将需要运行以管理员权限启动的程序,提交到DCD来启动程序;其他程序,直接运行
启动说明:由组策略的文件替换功能,从文件共享中复制到C:
\W
indows
\S
ystem32下,并运行
具体功能:详见(需要个DCU的RedMe.md链接)
具体功能:
1.
电源选项
2.
软件安装
3.
微盘同步
4.
文件共享
## DCD - Domain Computer Daemon
## DCD - Domain Computer Daemon
运行方式:
在DC上以
**管理员权限**
且
**前台无窗口**
运行的方式启动(以后台运行有问题:DCD无法正常启动其他带有GUI界面的程序)
运行方式:
由组策略在计算机启动时运行命令
`runad.bat daemon`
来进行循环启动DCD。(
**管理员权限、无窗口**
)
主要功能运行由DCU和ADU提交的程序和与接受处理发送消息
主要功能运行由DCU和ADU提交的程序和与接受处理发送消息
(通常处理需要管理员权限的消息)
## ADD - ADServer Daemon
## ADD - ADServer Daemon
运行方式:前后台任意
运行方式:前后台任意
主要作用:根据ADU的参数设定响应来自DC端的请求
主要作用:根据ADU的参数设定响应来自DC端的请求
## ADU - ADServer User
其他:使用注册表(HKLM
\S
oftware
\A
DControl)作为数据库的存储
## ADU - ADServer User(未完成)
运行方式: 命令行参数形式
运行方式: 命令行参数形式
主要作用:设定请求返回的结果
主要作用:设定请求返回的结果
# AD-Control运行模型
# 其他说明
用到了github.com/lxn/walk,但是修改了部分代码
1.
在notifyicon.go的notifyIconWndProc()中
`if showmenu = !showmenu;!showmenu { return } `
和
`var showmenu bool = false `
。来解决托盘菜单中按钮点击一次,会跳出2次的问题
2.
解决icon文件没有使用指定的绝对路径问题
# 现有问题
在func (rm
*ResourceManager) Icon(name string) (*
Icon, error) {
下
更新
if icon, err := NewIconFromFile(filepath.Join(rm.rootDirPath, name)); err == nil {
为
if icon, err := NewIconFromFile(name); err == nil {
1.
DCD应以服务且能与桌面交互的运行方式运作
2.
ADU未完成
# 现有问题
3.
SlaveAD辅控应启动Daemon,作为备用响应请求程序
1.
ADU未完成
4.
托盘中菜单按钮不能实时修改
2.
SlaveAD辅控应启动Daemon,作为备用响应请求程序
\ No newline at end of file
3.
托盘中菜单按钮不能实时修改
\ No newline at end of file
adct/adct.exe
View file @
1345e69e
No preview for this file type
adct/adct.go
View file @
1345e69e
...
@@ -3,7 +3,7 @@ import (
...
@@ -3,7 +3,7 @@ import (
"AD-Control/public"
"AD-Control/public"
"time"
"time"
"flag"
"flag"
"strings"
_
"strings"
)
)
...
@@ -53,34 +53,23 @@ func flag_hour(){
...
@@ -53,34 +53,23 @@ func flag_hour(){
switch
nh
{
switch
nh
{
case
0
:
case
0
:
if
strings
.
Index
(
public
.
User_computername
,
"TXHD"
)
!=-
1
{
shutdown
()
reboot
()
}
else
{
shutdown
()
}
break
break
case
1
:
case
1
:
if
strings
.
Index
(
public
.
User_computername
,
"TXHD"
)
!=-
1
{
shutdown
()
reboot
()
}
else
{
shutdown
()
}
break
break
case
2
:
case
2
:
if
strings
.
Index
(
public
.
User_computername
,
"TXHD"
)
!=-
1
{
shutdown
()
reboot
()
}
else
{
shutdown
()
}
break
break
case
3
:
case
3
:
public
.
MsgBox
(
`5分钟后,即将关机,运行Z:\tools\【工具】取消关机.bat`
)
shutdown
()
public
.
Execcmd_nowait
(
"shutdown -s -t 300"
)
break
break
case
4
:
case
4
:
shutdown
()
break
case
5
:
case
5
:
shutdown
()
break
case
6
:
case
6
:
default
:
default
:
break
break
...
...
daemon/daemon.exe
View file @
1345e69e
No preview for this file type
public/env.go
View file @
1345e69e
...
@@ -9,7 +9,7 @@ const ADServerDaemon string = Env_MainADHostname + DaemonListen
...
@@ -9,7 +9,7 @@ const ADServerDaemon string = Env_MainADHostname + DaemonListen
var
LocalDaemon
string
=
User_computername
+
DaemonListen
var
LocalDaemon
string
=
User_computername
+
DaemonListen
const
DocuBase
string
=
`C:\Users\Public\Documents\AD-Control\`
const
DocuBase
string
=
`C:\Users\Public\Documents\AD-Control\`
const
RandMax
int
=
60
const
RandMax
int
=
60
const
Version
string
=
"0.
7
"
const
Version
string
=
"0.
8
"
const
Application
string
=
"AD-Control-Log"
const
Application
string
=
"AD-Control-Log"
...
...
public/win.go
View file @
1345e69e
...
@@ -83,7 +83,6 @@ func ChooseFolder(explain, initDir * string) string {
...
@@ -83,7 +83,6 @@ func ChooseFolder(explain, initDir * string) string {
return
fg
.
FilePath
return
fg
.
FilePath
}
}
func
OpenWindow
(
s
string
){
func
OpenWindow
(
s
string
){
PrintLog
(
s
)
Execcmd_nowait
(
"explorer "
+
s
)
Execcmd_nowait
(
"explorer "
+
s
)
}
}
...
...
users/menu.go
View file @
1345e69e
...
@@ -4,12 +4,14 @@ import (
...
@@ -4,12 +4,14 @@ import (
"AD-Control/public"
"AD-Control/public"
)
)
//---------------------------------------------------------
//---------------------------------------------------------
//
//
// Power
// Power
//
//
//---------------------------------------------------------
//---------------------------------------------------------
// 电源菜单
func
menuInitPower
(
ni
*
walk
.
NotifyIcon
){
func
menuInitPower
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"电源选项"
fa
:=
"电源选项"
sub
:=
[
...
]
string
{
"下班咯"
,
"关闭系统"
,
"用户注销"
,
"重启系统"
,
"取消关机计时"
}
sub
:=
[
...
]
string
{
"下班咯"
,
"关闭系统"
,
"用户注销"
,
"重启系统"
,
"取消关机计时"
}
...
@@ -56,29 +58,37 @@ func menuInitPower(ni * walk.NotifyIcon){
...
@@ -56,29 +58,37 @@ func menuInitPower(ni * walk.NotifyIcon){
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
}
// 电源管理 下班
func
pWorkOff
(){
func
pWorkOff
(){
public
.
SendServerReport
(
public
.
Msg_Report_Offwork
)
public
.
SendServerReport
(
public
.
Msg_Report_Offwork
)
}
}
// 电源管理 关机
func
pCloseWindows
(){
func
pCloseWindows
(){
public
.
SendServerExec
(
public
.
Msg_Exec_CloseWindows
)
public
.
SendServerExec
(
public
.
Msg_Exec_CloseWindows
)
}
}
// 电源管理 注销用户
func
pLogOffUser
(){
func
pLogOffUser
(){
public
.
SendServerExec
(
public
.
Msg_Exec_LogOffUser
)
public
.
SendServerExec
(
public
.
Msg_Exec_LogOffUser
)
}
}
// 电源管理 重启主机
func
pRebootWindows
(){
func
pRebootWindows
(){
public
.
SendServerExec
(
public
.
Msg_Exec_RebootWindows
)
public
.
SendServerExec
(
public
.
Msg_Exec_RebootWindows
)
}
}
// 电源管理 取消自动关机
func
pCancelCloseWindows
(){
func
pCancelCloseWindows
(){
public
.
SendServerExec
(
public
.
Msg_Exec_CancelCloseWindows
)
public
.
SendServerExec
(
public
.
Msg_Exec_CancelCloseWindows
)
}
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
//
//
// Software Install
// Software Install
//
//
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// 软件安装
func
menuInitSoftwareInstall
(
ni
*
walk
.
NotifyIcon
){
func
menuInitSoftwareInstall
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"软件安装"
fa
:=
"软件安装"
// 建立空菜单
// 建立空菜单
...
@@ -122,6 +132,7 @@ func menuInitSoftwareInstall(ni * walk.NotifyIcon){
...
@@ -122,6 +132,7 @@ func menuInitSoftwareInstall(ni * walk.NotifyIcon){
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
}
// 软件安装 进行安装
func
siEnter_admin
(
softname
string
){
func
siEnter_admin
(
softname
string
){
go
public
.
Msg
(
"等待弹出安装窗口,请稍等。。"
)
go
public
.
Msg
(
"等待弹出安装窗口,请稍等。。"
)
ifFile
:=
public
.
Exist
(
`C:\windows\`
+
softname
)
ifFile
:=
public
.
Exist
(
`C:\windows\`
+
softname
)
...
@@ -129,11 +140,14 @@ func siEnter_admin(softname string){
...
@@ -129,11 +140,14 @@ func siEnter_admin(softname string){
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
//
//
// WxDrive Sync
// WxDrive Sync
//
//
//---------------------------------------------------------------
//---------------------------------------------------------------
// 微盘同步
func
menuInitWxDriveSync
(
ni
*
walk
.
NotifyIcon
){
func
menuInitWxDriveSync
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"微盘同步"
fa
:=
"微盘同步"
sub
:=
[
...
]
string
{
"初始化"
,
"同步部门共享盘到微盘(手动)"
,
"同步部门共享盘到服务器(手动)"
,
"说明"
}
sub
:=
[
...
]
string
{
"初始化"
,
"同步部门共享盘到微盘(手动)"
,
"同步部门共享盘到服务器(手动)"
,
"说明"
}
...
@@ -178,6 +192,7 @@ func menuInitWxDriveSync(ni * walk.NotifyIcon){
...
@@ -178,6 +192,7 @@ func menuInitWxDriveSync(ni * walk.NotifyIcon){
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
}
// 微盘同步 初始化
func
wxdsInit
(){
func
wxdsInit
(){
explain
:=
"选择个人ID,请根据微盘的文件夹所在位置进行选择,确定并选择并点击文件夹(一串数字)后,点击确定继续进行下一步!具体操作方法点击说明!"
explain
:=
"选择个人ID,请根据微盘的文件夹所在位置进行选择,确定并选择并点击文件夹(一串数字)后,点击确定继续进行下一步!具体操作方法点击说明!"
initDir
:=
public
.
User_Dir_WeDrive
initDir
:=
public
.
User_Dir_WeDrive
...
@@ -195,6 +210,7 @@ func wxdsInit(){
...
@@ -195,6 +210,7 @@ func wxdsInit(){
FullWeDrive
)
FullWeDrive
)
public
.
Msg
(
"初始化完毕,请在微盘中创建文件夹(办公室部门内部共享),并分享给同事,创建后,点击开始同步即可。"
)
public
.
Msg
(
"初始化完毕,请在微盘中创建文件夹(办公室部门内部共享),并分享给同事,创建后,点击开始同步即可。"
)
}
}
// 微盘同步 同步到微盘
func
wxdsToDrive
(){
func
wxdsToDrive
(){
if
public
.
Msg_YesNo
(
"确定手动进行一次 -> 从共享盘同步到微盘吗?如果调整过共享盘的文件结构,请先在微盘中同步调整,否则微盘将会混沌。"
)
==
1
{
if
public
.
Msg_YesNo
(
"确定手动进行一次 -> 从共享盘同步到微盘吗?如果调整过共享盘的文件结构,请先在微盘中同步调整,否则微盘将会混沌。"
)
==
1
{
public
.
SendServer
(
public
.
GJexecCopyWeDrive
(
public
.
Msg_Exec_CopyWeDrive
))
public
.
SendServer
(
public
.
GJexecCopyWeDrive
(
public
.
Msg_Exec_CopyWeDrive
))
...
@@ -203,6 +219,7 @@ func wxdsToDrive(){
...
@@ -203,6 +219,7 @@ func wxdsToDrive(){
}
}
}
}
// 微盘同步 同步到服务器
func
wxdsToServer
(){
func
wxdsToServer
(){
reg_Value_WeDriveDir
:=
public
.
Reg_query_key_one
(
reg_Value_WeDriveDir
:=
public
.
Reg_query_key_one
(
public
.
HKCU
,
public
.
HKCU
,
...
@@ -220,30 +237,33 @@ func wxdsToServer(){
...
@@ -220,30 +237,33 @@ func wxdsToServer(){
}
}
}
}
// 微盘同步 说明
func
wxdsExplain
(){
func
wxdsExplain
(){
msg
:=
msg
:=
`
`
1.此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
1.此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
2.当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化。
2.当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化。
5.初始化后,凡是启动了小工具,2小时自动同步一次到微盘。但从微盘同步到部门共享盘中只能是手动的。
5.初始化后,凡是启动了小工具,2小时自动同步一次到微盘。但从微盘同步到部门共享盘中只能是手动的。
7.但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
7.但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
9.关于初始化中路径选择问题:打开微盘,右键打开已下载的文件。根据该文件所在的路径来确定初始化中的路径。
9.关于初始化中路径选择问题:打开微盘,右键打开已下载的文件。根据该文件所在的路径来确定初始化中的路径。
8.以上,此致,敬礼,望赞!
8.以上,此致,敬礼,望赞!
`
`
public
.
Msg
(
msg
)
public
.
Msg
(
msg
)
}
}
//---------------------------------------------------------------
//---------------------------------------------------------------
//
//
// Kinds of Tools
// Kinds of Tools
//
//
//---------------------------------------------------------------
//---------------------------------------------------------------
// 其他工具
func
menuInitTools
(
ni
*
walk
.
NotifyIcon
){
func
menuInitTools
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"工具集合"
fa
:=
"工具集合"
...
@@ -303,20 +323,23 @@ func menuInitTools(ni * walk.NotifyIcon){
...
@@ -303,20 +323,23 @@ func menuInitTools(ni * walk.NotifyIcon){
sysmenu
.
SetEnabled
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
}
// 其他工具 Excel关键词分割器
func
tMultiSplit
(){
func
tMultiSplit
(){
public
.
Execcmd_nowait
(
public
.
Startk
+
public
.
Link_MultiSplit
)
public
.
Execcmd_nowait
(
public
.
Startk
+
public
.
Link_MultiSplit
)
}
}
// 其他工具 移动硬盘(胡一波专用)
func
tJR_huyibo_movedisk
(){
func
tJR_huyibo_movedisk
(){
public
.
SendDaemonExec
(
`F:\SamsungPortableSSD.exe`
)
public
.
SendDaemonExec
(
`F:\SamsungPortableSSD.exe`
)
}
}
// 其他工具 隐藏图标
func
tHideIcon
(){
func
tHideIcon
(){
public
.
Msg
(
"emmmmmmm,大概下周吧,这周无望哈"
)
public
.
Msg
(
"emmmmmmm,大概下周吧,这周无望哈"
)
}
}
// 其他工具 显示图标
func
tShowIcon
(){
func
tShowIcon
(){
public
.
Msg
(
"仅供参考!!"
)
public
.
Msg
(
"仅供参考!!"
)
}
}
// 其他工具 测试
func
tTest
(){
func
tTest
(){
//public.SendDaemonExec(`D:\WXWork.exe`)
//public.SendDaemonExec(`D:\WXWork.exe`)
}
}
...
@@ -328,6 +351,7 @@ func tTest(){
...
@@ -328,6 +351,7 @@ func tTest(){
//
//
//---------------------------------------------------------------
//---------------------------------------------------------------
// 文件共享 (包含域用户和大屏主机的文件共享)
func
menuInitFileShares
(
ni
*
walk
.
NotifyIcon
){
func
menuInitFileShares
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"文件共享"
fa
:=
"文件共享"
...
@@ -337,6 +361,9 @@ func menuInitFileShares(ni * walk.NotifyIcon){
...
@@ -337,6 +361,9 @@ func menuInitFileShares(ni * walk.NotifyIcon){
public
.
PrintLog
(
err
)
public
.
PrintLog
(
err
)
}
}
// 说明:添加 域用户 文件共享
// 方法:列举目录名,生成菜单
// 其次,列举额目录中的名单作为按钮添加到菜单
deptList
,
err
:=
public
.
ReadDir
(
public
.
Env_ADMain
)
deptList
,
err
:=
public
.
ReadDir
(
public
.
Env_ADMain
)
if
err
!=
nil
{
if
err
!=
nil
{
public
.
PrintLog
(
err
)
public
.
PrintLog
(
err
)
...
@@ -371,7 +398,6 @@ func menuInitFileShares(ni * walk.NotifyIcon){
...
@@ -371,7 +398,6 @@ func menuInitFileShares(ni * walk.NotifyIcon){
nm
.
Actions
()
.
Add
(
na
)
nm
.
Actions
()
.
Add
(
na
)
}
}
if
m
,
err
:=
mfs
.
Actions
()
.
AddMenu
(
nm
);
err
!=
nil
{
if
m
,
err
:=
mfs
.
Actions
()
.
AddMenu
(
nm
);
err
!=
nil
{
public
.
PrintLog
(
err
)
public
.
PrintLog
(
err
)
}
else
{
}
else
{
...
@@ -382,16 +408,28 @@ func menuInitFileShares(ni * walk.NotifyIcon){
...
@@ -382,16 +408,28 @@ func menuInitFileShares(ni * walk.NotifyIcon){
}
}
}
}
//
将菜单添加到托盘
//
添加
sysmenu
,
err
:=
ni
.
ContextMenu
()
.
Actions
()
.
AddMenu
(
mfs
)
na
:=
walk
.
NewAction
(
)
if
err
!=
nil
{
if
err
:=
na
.
SetText
(
"会议室的大脸机"
);
err
!=
nil
{
public
.
PrintLog
(
err
)
public
.
PrintLog
(
err
)
}
else
{
//将菜单添加到托盘
na
.
Triggered
()
.
Attach
(
func
(){
public
.
OpenWindow
(
`ftp://adserver`
)})
if
err
:=
mfs
.
Actions
()
.
Add
(
na
);
err
!=
nil
{
public
.
PrintLog
(
err
)
}
}
}
//将菜单添加到托盘
sysmenu
,
err
:=
ni
.
ContextMenu
()
.
Actions
()
.
AddMenu
(
mfs
)
if
err
!=
nil
{
public
.
PrintLog
(
err
)
}
// 主菜单 属性
// 主菜单 属性
sysmenu
.
SetText
(
fa
)
sysmenu
.
SetText
(
fa
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
}
...
...
users/users.exe
View file @
1345e69e
No preview for this file type
users/users.go
View file @
1345e69e
...
@@ -19,7 +19,7 @@ func userInit() string{
...
@@ -19,7 +19,7 @@ func userInit() string{
}
}
}()
}()
}
}
var
icoDir
=
[]
string
{
`AD-Control.ico`
,
`C:\Users\Public\Documents\AD-Control\AD-Control.ico`
}
var
icoDir
=
[]
string
{
`AD-Control.ico`
,
`C:\
windows\system32\AD-Control.ico`
,
`C:\
Users\Public\Documents\AD-Control\AD-Control.ico`
}
for
_
,
i
:=
range
icoDir
{
for
_
,
i
:=
range
icoDir
{
if
public
.
Exist
(
i
){
if
public
.
Exist
(
i
){
return
i
return
i
...
...
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