Commit 534da77b by 陶腾飞

2020/10/27 v1.10.2

parent 1735db9f
test/
testwalk/
testmain/
exe/
*.bat
*.ps1
*.exe
.vscode/
\ No newline at end of file
.vscode/
......@@ -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
......@@ -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 "
......
......@@ -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
......
......@@ -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
......
......@@ -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) {
......
No preview for this file type
......@@ -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()
}
//---------------------------------------------------------------
......
<?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>
......
No preview for this file type
......@@ -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)
}
}
......
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