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
534da77b
Commit
534da77b
authored
Oct 27, 2020
by
陶腾飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2020/10/27 v1.10.2
parent
1735db9f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
84 deletions
+56
-84
.gitignore
+2
-2
README.MD
+8
-2
public/env.go
+2
-0
public/msg_deal.go
+4
-10
public/msg_init.go
+1
-2
public/win.go
+15
-4
users/AD-Control.ico
+0
-0
users/menu.go
+22
-61
users/users.exe.manifest
+1
-1
users/users.exe.syso
+0
-0
users/users.go
+1
-2
No files found.
.gitignore
View file @
534da77b
test/
testwalk/
testmain/
exe/
*.bat
*.ps1
*.exe
.vscode/
\ No newline at end of file
.vscode/
README.MD
View file @
534da77b
...
...
@@ -70,6 +70,8 @@ UI:
-
2020/08/26 v1.8.4 解决个人共享读取失败的问题
-
2020/10/18 v1.9.0 修复双向备份文件Bug,针对704室主机唤醒做调整,增加远程唤醒功能
-
2020/10/22 v1.10.0 升级批量打开,增加重启软件按钮,检测并关闭保护试图
-
2020/10/26 v1.10.1 修复批量打开失败问题
-
2020/10/27 v1.10.2 优化软件安装和重启小工具的程序逻辑,更新64位的程序清单和新ico文件
## 其他说明
...
...
@@ -94,5 +96,8 @@ UI:
if icon, err := NewIconFromFile(name); err == nil {
```
### 源码编译说明
-
不支持 go module
-
请在GOPATH下 git clone
1.
不支持 go module
2.
请在GOPATH下 git clone
3.
go env GOARCH应是amd64
4.
在users目录下
`rsrc -manifest users.exe.manifest -arch amd64 -o users.exe.syso`
,使用
[
rsrc
](
https://github.com/akavel/rsrc
)
根据users.exe.manifest清单文件生成64未的users.exe.syso。users.exe.syso是users.exe启动的充分条件。
5.
在users目录下,
`go build`
将生成一个带命令行窗口的GUI程序。
`go build -ldflags="-H windowsgui"`
将生成纯粹的GUI程序
\ No newline at end of file
public/env.go
View file @
534da77b
...
...
@@ -19,6 +19,7 @@ var User_homeshare string = GetEnv("HOMESHARE")
var
User_userdomain
string
=
GetEnv
(
"USERDOMAIN"
)
var
User_name
string
=
GetEnv
(
"USERNAME"
)
var
User_dept
string
=
GetEnv
(
"DEPT"
)
var
User_tmp
string
=
GetEnv
(
"tmp"
)
var
User_sid
string
=
Reg_query_key_one
(
HKCU
,
`Software\Microsoft\Windows\CurrentVersion\FileAssociations`
,
"UserSid"
)
var
User_sessionID
string
=
Reg_query_item_one
(
HKU
,
User_sid
+
`\Volatile Environment`
)
//var User_name_display string = GetEnvFqdn("CN")
...
...
@@ -109,6 +110,7 @@ var Reg_Value_LogStatus_OUT string = "OUT"
// other //
const
Link_WxworkBot
string
=
`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=59107f72-5b72-4a20-a33c-fdb1cd46f2c6`
const
Cmd_c
string
=
"cmd /c "
const
Cmd_k
string
=
"cmd /k "
const
Cmd_K_Start
string
=
"cmd /k start "
...
...
public/msg_deal.go
View file @
534da77b
...
...
@@ -204,22 +204,16 @@ func (exec *MJexec)MsgDeal()interface{}{
exec
.
Status
=
Msg_Exec_State_Over
case
Msg_Exec_InstallSoftware
:
// 对于 msi 格式
// 从\\adserver安装
// 对于 msi 格式,从\\adserver目录使用msiexec安装
// 共享则需要everyone的读取权限
if
strings
.
HasSuffix
(
exec
.
Command
,
".msi"
){
full_cmd
:=
"msiexec /i "
+
SMB_ADSoftlike
+
`\`
+
exec
.
Command
+
" /qb"
PsExec_sdi
(
exec
.
Computername
,
full_cmd
,
exec
.
SessionID
)
// 对于 exe 格式
// 对于 exe 格式
,从 ADMIN$ 复制到C:\windows,再执行
}
else
{
// 如果文件存在,则执行C:\windows目录下的文件
if
exec
.
DataBool
{
PsExec_sdi
(
exec
.
Computername
,
Dir_Windows
+
exec
.
Command
,
exec
.
SessionID
)
// 如果文件不存在,从 ADMIN$ 复制到C:\windows,再执行
}
else
{
PsExec_sdic
(
exec
.
Computername
,
Dir_ADsoftware_local
+
exec
.
Command
,
exec
.
SessionID
)
}
PsExec_sfdic
(
exec
.
Computername
,
Dir_ADsoftware_local
+
exec
.
Command
,
exec
.
SessionID
)
}
exec
.
Status
=
Msg_Exec_State_Over
...
...
public/msg_init.go
View file @
534da77b
...
...
@@ -205,10 +205,9 @@ func GJexec(s string) MJexec{
exec
.
Init
(
s
)
return
exec
}
func
GJexecInstallSoftware
(
b
bool
,
s
string
)
interface
{}{
func
GJexecInstallSoftware
(
s
string
)
interface
{}{
var
exec
MJexec
exec
.
Init
(
s
)
exec
.
DataBool
=
b
exec
.
Instruction
=
Msg_Exec_InstallSoftware
exec
.
Command
=
s
return
exec
...
...
public/win.go
View file @
534da77b
...
...
@@ -186,11 +186,17 @@ func PSTest_Connection(host string) (bool,error) {
//
// local
//
func
ChooseFolder
(
explain
,
initDir
*
string
)
string
{
func
ChooseFile
(
explain
,
initDir
string
)
string
{
fg
:=
new
(
walk
.
FileDialog
)
fg
.
Title
=
explain
fg
.
InitialDirPath
=
initDir
fg
.
ShowOpen
(
*
new
(
walk
.
Form
))
return
fg
.
FilePath
}
func
ChooseFolder
(
explain
,
initDir
string
)
string
{
fg
:=
new
(
walk
.
FileDialog
)
fg
.
Title
=
*
explain
fg
.
InitialDirPath
=
*
initDir
fg
.
Title
=
explain
fg
.
InitialDirPath
=
initDir
fg
.
ShowBrowseFolder
(
*
new
(
walk
.
Form
))
return
fg
.
FilePath
}
...
...
@@ -220,6 +226,11 @@ func PsExec_sdic(pc ,cmd ,sessionid string) {
psExecCommand
:=
`psexec \\`
+
pc
+
" -s -d -i "
+
sessionid
+
" -c "
+
cmd
Execcmd_nowait
(
psExecCommand
)
}
// 以管理员,立刻返回,指定会话,(即使文件存在)发送本地程序要远程主机,再执行
func
PsExec_sfdic
(
pc
,
cmd
,
sessionid
string
)
{
psExecCommand
:=
`psexec \\`
+
pc
+
" -s -f -d -i "
+
sessionid
+
" -c "
+
cmd
Execcmd_nowait
(
psExecCommand
)
}
// 以管理员,立刻返回
func
Pskill
(
pc
,
cmd
string
)
{
...
...
users/AD-Control.ico
View file @
534da77b
No preview for this file type
users/menu.go
View file @
534da77b
...
...
@@ -70,64 +70,6 @@ func pCancelCloseWindows(){
}
//--------------------------------------------------------------------
//
// Software Install
//
//--------------------------------------------------------------------
// 软件安装
func
menuInitSoftwareInstall
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"软件安装"
// 建立空菜单
nm
,
err
:=
walk
.
NewMenu
()
if
err
!=
nil
{
pub
.
PntError
(
err
)
}
list
,
err
:=
pub
.
ReadDir
(
pub
.
SMB_ADSoftlike
)
if
err
!=
nil
{
pub
.
PntError
(
err
)
}
for
_
,
ueach
:=
range
list
{
each
:=
ueach
.
Name
()
if
each
==
".DS_Store"
{
continue
}
each_noext
:=
strings
.
TrimSuffix
(
strings
.
TrimSuffix
(
ueach
.
Name
(),
".exe"
),
".msi"
)
// 建立 子按钮
na
:=
walk
.
NewAction
()
if
err
:=
na
.
SetText
(
each_noext
);
err
!=
nil
{
pub
.
PntError
(
err
)
}
// 为子按钮 添加事件
na
.
Triggered
()
.
Attach
(
func
()
{
siEnter_admin
(
each
)
})
// 将 子按钮 添加到 菜单
nm
.
Actions
()
.
Add
(
na
)
}
//将菜单添加到托盘
sysmenu
,
err
:=
ni
.
ContextMenu
()
.
Actions
()
.
AddMenu
(
nm
)
if
err
!=
nil
{
pub
.
PntError
(
err
)
}
// 主菜单 属性
sysmenu
.
SetText
(
fa
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
// 软件安装 进行安装
func
siEnter_admin
(
softname
string
){
go
pub
.
Msg
(
"等待弹出安装窗口,请稍等。。"
)
ifFile
:=
pub
.
Exist
(
`C:\windows\`
+
softname
)
pub
.
SendServerExec
(
pub
.
GJexecInstallSoftware
(
ifFile
,
softname
))
}
//---------------------------------------------------------------
//
// Kinds of Tools
...
...
@@ -138,7 +80,7 @@ func siEnter_admin(softname string){
func
menuInitTools
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"工具集合"
sub
:=
[
...
]
string
{
"Excel关键词分割"
,
"备份用户文件"
,
"优雅批量打开网页"
,
"隐藏/显示桌面图标"
,
"更新手机代理程序"
,
"PDF转换"
,
"窗口拦截"
,
"
刷新
小工具"
}
sub
:=
[
...
]
string
{
"Excel关键词分割"
,
"备份用户文件"
,
"优雅批量打开网页"
,
"隐藏/显示桌面图标"
,
"更新手机代理程序"
,
"PDF转换"
,
"窗口拦截"
,
"
软件安装"
,
"重启
小工具"
}
// 建立空菜单
nm
,
err
:=
walk
.
NewMenu
()
if
err
!=
nil
{
...
...
@@ -176,6 +118,8 @@ func menuInitTools(ni * walk.NotifyIcon){
case
6
:
na
.
Triggered
()
.
Attach
(
tWindowsBlock
)
case
7
:
na
.
Triggered
()
.
Attach
(
tSoftwareInstall
)
case
8
:
na
.
Triggered
()
.
Attach
(
tRebootUsers
)
}
...
...
@@ -269,10 +213,27 @@ func tWindowsBlock(){
return
}
// 其他工具 软件安装
func
tSoftwareInstall
(){
softpath
:=
`Z:\softlike\`
softname
:=
pub
.
ChooseFile
(
"请选择单个文件"
,
softpath
)
if
softname
==
""
{
return
}
if
strings
.
HasPrefix
(
softname
,
softpath
)
{
softname
=
strings
.
TrimPrefix
(
softname
,
softpath
)
go
pub
.
Msg
(
"等待弹出安装窗口,请稍等。。"
)
pub
.
SendServerExec
(
pub
.
GJexecInstallSoftware
(
softname
))
}
else
{
go
pub
.
Msg
(
"请勿修改文件路径!"
)
}
}
// 其他工具 重启用户程序
func
tRebootUsers
(){
pub
.
Execcmd_nowait
(
pub
.
SMB_ADSoftTool
+
"【工具】更新小工具.bat"
)
pub
.
Delay
(
1
)
go
pub
.
Msg
(
"正在刷新,请稍后!"
)
pub
.
Execcmd_wait
(
`cmd /c copy /y \\adserver\software\application\users.exe %tmp%`
)
pub
.
Execcmd_nowait_noargs
(
pub
.
User_tmp
+
`\users.exe`
)
pub
.
ExitNormal
()
}
//---------------------------------------------------------------
...
...
users/users.exe.manifest
View file @
534da77b
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<asmv1:assemblyIdentity name="AD-Control-Users..exe" version="
0.0.0.1
" publicKeyToken="0000000000000000" language="非特定语言" processorArchitecture="msil" type="win32" />
<asmv1:assemblyIdentity name="AD-Control-Users..exe" version="
1.10.2.0
" publicKeyToken="0000000000000000" language="非特定语言" processorArchitecture="msil" type="win32" />
<description asmv2:publisher="知微" asmv2:product="域控制中心" xmlns="urn:schemas-microsoft-com:asm.v1" />
<dependency>
<dependentAssembly>
...
...
users/users.exe.syso
View file @
534da77b
No preview for this file type
users/users.go
View file @
534da77b
...
...
@@ -43,7 +43,6 @@ func userInit() string{
}
func
menuInit
(
ni
*
walk
.
NotifyIcon
){
menuInitPower
(
ni
)
menuInitSoftwareInstall
(
ni
)
menuInitTools
(
ni
)
menuInitFileShares
(
ni
)
menuInitMyShares
(
ni
)
...
...
@@ -75,7 +74,7 @@ func isActive(){
}
func
userEnvInit
(){
if
pub
.
Reg_Query_DC
(
pub
.
Reg_Name_CloseView
)
!=
pub
.
Reg_Value_ON
{
pub
.
Execcmd_nowait
(
pub
.
SMB_ADSoftTool
+
`【修复】关闭excel和word保护视图.bat`
)
pub
.
Execcmd_nowait
(
pub
.
Cmd_c
+
pub
.
SMB_ADSoftTool
+
`【修复】关闭excel和word保护视图.bat`
)
pub
.
Reg_Write_DC
(
pub
.
Reg_Name_CloseView
,
pub
.
Reg_Value_OFF
)
}
}
...
...
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