Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
windows-boom
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
陶腾飞
windows-boom
Commits
dfe5f17e
Commit
dfe5f17e
authored
Aug 03, 2022
by
陶腾飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022-08-03 v1.2
parent
fc7f08f5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
37 deletions
+149
-37
README.MD
+7
-4
main.exe
+0
-0
main.go
+18
-0
office.go
+103
-15
win.go
+21
-18
No files found.
README.MD
View file @
dfe5f17e
...
...
@@ -2,9 +2,11 @@
一款知微定制版的windows、office激活工具,无毒无害,可重复激活至永久。
##
说明
##
支持的版本
目前仅支持Windows 10 Pro、Office 16.0 ProPlus,之后将更新office2019版本
-
Windows 10 Pro
-
Office 2016 ProPlus(专业增强版)
-
Office 2016 ProPlus(专业增强版)
## 用法
...
...
@@ -13,4 +15,5 @@
## 更新记录
2022-07-31 v1.0 支持windows 10 Pro的激活
2022-08-02 v1.1 支持Office 16.0 ProPlus的激活
\ No newline at end of file
2022-08-02 v1.1 支持Office 2016 ProPlus的激活
2022-08-03 v1.2 支持Office 2019 ProPlus的激活
\ No newline at end of file
main.exe
View file @
dfe5f17e
No preview for this file type
main.go
View file @
dfe5f17e
...
...
@@ -4,6 +4,7 @@ import (
"log"
pub
"git.zhiweidata.top/taotengfei/AD-Control-Golang/public"
"golang.org/x/sys/windows/registry"
)
var
MS
=
&
pub
.
MS
...
...
@@ -12,14 +13,31 @@ func main() {
if
pub
.
Zhiweireach
()
{
log
.
Printf
(
"该主机属于知微域"
)
}
log
.
Println
(
"--------------------------"
)
if
err
:=
activeWindows
();
err
!=
nil
{
log
.
Println
(
err
)
log
.
Println
(
"Windows 激活失败"
)
}
log
.
Println
(
"--------------------------"
)
if
err
:=
activeOffice
();
err
!=
nil
{
log
.
Println
(
err
)
log
.
Println
(
"Office 激活失败"
)
}
log
.
Println
(
"--------------------------"
)
log
.
Println
(
"程序运行结束"
)
select
{}
}
func
query_key_one
(
path
,
key
string
)
(
string
,
error
)
{
if
k
,
kerr
:=
registry
.
OpenKey
(
registry
.
LOCAL_MACHINE
,
path
,
registry
.
READ
);
kerr
==
nil
{
defer
k
.
Close
()
if
sk
,
_
,
err
:=
k
.
GetStringValue
(
key
);
err
!=
nil
{
return
""
,
err
}
else
{
return
sk
,
nil
}
}
else
{
return
""
,
kerr
}
}
office.go
View file @
dfe5f17e
...
...
@@ -7,25 +7,96 @@ import (
"strings"
pub
"git.zhiweidata.top/taotengfei/AD-Control-Golang/public"
reg
"git.zhiweidata.top/taotengfei/AD-Control-Golang/registry"
)
func
checkOffice
(
path
string
)
bool
{
out
,
err
:=
execcmd
(
path
,
"/dstatus"
)
if
err
!=
nil
{
log
.
Println
(
out
)
log
.
Println
(
string
(
out
))
log
.
Println
(
err
.
Error
())
return
false
}
outstr
:=
string
(
out
)
if
strings
.
Contains
(
outstr
,
"---LICENSED---"
)
{
log
.
Printf
(
"当前已激活Office"
)
return
false
}
else
if
strings
.
Contains
(
outstr
,
"---OOB_GRACE---"
)
{
log
.
Printf
(
"当前未激活Office"
)
return
true
}
else
if
strings
.
Contains
(
outstr
,
"No installed product keys detected"
)
{
log
.
Printf
(
"当前未激活Office"
)
return
true
}
return
false
return
true
}
func
getOfficePath
()
(
string
,
error
)
{
var
reg
[
4
][
2
]
string
var
path
string
reg
[
0
][
0
]
=
`SOFTWARE\Microsoft\Office\16.0\Outlook\InstallRoot`
// reg[0][1] = "Office 2016 ProPlus"
reg
[
1
][
0
]
=
`SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\Wow6432Node\Microsoft\Office\16.0\Common\InstallRoot`
// reg[1][1] = "Office 2019 ProPlus"
for
i
:=
0
;
i
<
len
(
reg
);
i
++
{
path
,
_
=
query_key_one
(
reg
[
i
][
0
],
"Path"
)
if
path
!=
""
{
return
path
,
nil
}
}
if
path
==
""
{
return
""
,
fmt
.
Errorf
(
"不支持该版本的Office"
)
}
return
path
,
nil
}
func
setOfficeSKU
(
path
string
)
error
{
path
=
path
+
`root\Licenses16\`
arr
:=
[]
string
{
"ProPlus2019VL_KMS_Client_AE-ppd.xrm-ms"
,
"ProPlus2019VL_KMS_Client_AE-ul.xrm-ms"
,
"ProPlus2019VL_KMS_Client_AE-ul-oob.xrm-ms"
,
"ProPlus2019VL_MAK_AE-pl.xrm-ms"
,
"ProPlus2019VL_MAK_AE-ppd.xrm-ms"
,
"ProPlus2019VL_MAK_AE-ul-oob.xrm-ms"
,
"ProPlus2019VL_MAK_AE-ul-phn.xrm-ms"
,
// "client-issuance-bridge-office.xrm-ms",
// "client-issuance-root.xrm-ms",
// "client-issuance-root-bridge-test.xrm-ms",
// "client-issuance-stil.xrm-ms",
// "client-issuance-ul.xrm-ms",
// "client-issuance-ul-oob.xrm-ms",
// "pkeyconfig-office.xrm-ms",
// "ProPlusVL_KMS_Client-ppd.xrm-ms",
// "ProPlusVL_KMS_Client-ul.xrm-ms",
// "ProPlusVL_KMS_Client-ul-oob.xrm-ms",
// "ProjectProVL_KMS_Client-ppd.xrm-ms",
// "ProjectProVL_KMS_Client-ul-oob.xrm-ms",
// "ProjectProVL_KMS_Client-ul.xrm-ms",
// "VisioProVL_KMS_Client-ppd.xrm-ms",
// "VisioProVL_KMS_Client-ul-oob.xrm-ms",
// "VisioProVL_KMS_Client-ul.xrm-ms",
// "SkypeforBusinessVL_KMS_Client-ppd.xrm-ms",
// "SkypeforBusinessVL_KMS_Client-ul.xrm-ms",
// "SkypeforBusinessVL_KMS_Client-ul-oob.xrm-ms",
// "client-issuance-bridge-office.xrm-ms",
// "client-issuance-root.xrm-ms",
// "client-issuance-root-bridge-test.xrm-ms",
// "client-issuance-stil.xrm-ms",
// "client-issuance-ul.xrm-ms",
// "client-issuance-ul-oob.xrm-ms",
// "pkeyconfig-office.xrm-ms",
}
for
_
,
i
:=
range
arr
{
cmd
:=
fmt
.
Sprintf
(
`powershell cscript C:\Windows\SysWOW64\slmgr.vbs /ilc "%s%s" //nologo`
,
path
,
i
)
out
:=
string
(
pub
.
Execcmd_output
(
cmd
))
if
strings
.
Contains
(
out
,
"错误"
)
{
return
fmt
.
Errorf
(
out
)
}
}
log
.
Println
(
"SKU设置完毕"
)
return
nil
}
func
getOfficeVersion
(
path
string
)
(
string
,
error
)
{
var
officeVersion
string
...
...
@@ -44,51 +115,65 @@ func getOfficeVersion(path string) (string, error) {
}
func
activeOffice
()
error
{
log
.
Printf
(
"正在检查Office的安装路径"
)
path
:=
reg
.
Query_key_one
(
reg
.
HKLM
,
`SOFTWARE\Microsoft\Office\16.0\Outlook\InstallRoot`
,
"Path"
)
if
path
==
""
{
return
fmt
.
Errorf
(
"不支持该版本的Office"
)
path
,
err
:=
getOfficePath
(
)
if
err
!=
nil
{
return
err
}
log
.
Printf
(
"Office的安装路径:%s"
,
path
)
path
=
strings
.
ToLower
(
path
)
if
strings
.
Contains
(
path
,
`root\`
)
{
path
=
strings
.
Split
(
path
,
`root\`
)[
0
]
}
log
.
Printf
(
"Office的基础路径:%s"
,
path
)
path_ospp
:=
path
+
`Office16\`
log
.
Printf
(
"检查激活Office状态"
)
if
!
checkOffice
(
path
)
{
if
!
checkOffice
(
path
_ospp
)
{
return
nil
}
log
.
Printf
(
"准备激活Office"
)
// log.Printf("获取Office版本")
// officeVersion, err := getOfficeVersion(path)
// officeVersion, err := getOfficeVersion(path
_ospp
)
// if err != nil {
// return err
// }
// 从服务器获取密钥
officeVersion
:=
"Office
16.0
ProPlus"
officeVersion
:=
"Office
2019
ProPlus"
pub
.
SendBoomServer
(
pub
.
Msg_Boom_Active
,
officeVersion
)
if
pub
.
MS
.
Error
{
return
fmt
.
Errorf
(
pub
.
MS
.
Errmsg
)
}
key
:=
pub
.
MS
.
S
log
.
Printf
(
"请求到%s的版本的密钥为%s"
,
officeVersion
,
key
)
out
,
err
:=
execcmd
(
path
,
"/sethst:192.168.0.21"
)
if
err
:=
setOfficeSKU
(
path
);
err
!=
nil
{
return
err
}
out
,
err
:=
execcmd
(
path_ospp
,
"/sethst:192.168.0.21"
)
outstr
:=
string
(
out
)
if
err
!=
nil
{
if
strings
.
Contains
(
outstr
,
"0x80070005"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"The Software Licensing Service reported that the action requires administrator privilege"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
{
log
.
Println
(
outstr
)
}
}
if
strings
.
Contains
(
outstr
,
"Successfully applied setting"
)
{
log
.
Printf
(
"kms的IP设置成功"
)
}
out
,
err
=
execcmd
(
path
,
"/setprt:1688"
)
out
,
err
=
execcmd
(
path
_ospp
,
"/setprt:1688"
)
outstr
=
string
(
out
)
if
err
!=
nil
{
if
strings
.
Contains
(
outstr
,
"0x80070005"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"The Software Licensing Service reported that the action requires administrator privilege"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"No Office KMS licenses were found on the system."
)
{
return
fmt
.
Errorf
(
"没有找到KMS密钥"
)
}
else
{
log
.
Println
(
outstr
)
}
}
if
strings
.
Contains
(
outstr
,
"Successfully applied setting"
)
{
...
...
@@ -97,14 +182,16 @@ func activeOffice() error {
log
.
Println
(
outstr
)
}
out
,
err
=
execcmd
(
path
,
"/inpkey:"
+
key
)
out
,
err
=
execcmd
(
path
_ospp
,
"/inpkey:"
+
key
)
outstr
=
string
(
out
)
if
err
!=
nil
{
if
strings
.
Contains
(
outstr
,
"0x80070005"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"The Software Licensing Service reported that the action requires administrator privilege"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"The Software Licensing Service reported that the product SKU is not found."
)
{
return
fmt
.
Errorf
(
"SKU安装错误"
)
}
else
if
strings
.
Contains
(
outstr
,
"The Software Licensing Service reported that the product key is invalid"
)
{
return
fmt
.
Errorf
(
"激活使用了错误的密钥"
)
}
...
...
@@ -122,6 +209,7 @@ func execcmd(path, args1 string) ([]byte, error) {
cmd
:=
exec
.
Command
(
"powershell"
,
`cscript`
,
"OSPP.VBS"
,
args1
,
"//nologo"
)
cmd
.
Dir
=
path
out
,
err
:=
cmd
.
CombinedOutput
()
if
err
!=
nil
{
return
pub
.
ToChineseChar
(
out
),
err
}
...
...
win.go
View file @
dfe5f17e
...
...
@@ -6,14 +6,14 @@ import (
"strings"
pub
"git.zhiweidata.top/taotengfei/AD-Control-Golang/public"
reg
"git.zhiweidata.top/taotengfei/AD-Control-Golang/registry"
)
func
checkWindows
()
bool
{
var
status
bool
out
:=
pub
.
Execcmd_output
(
`cscript
/nologo C:\Windows\SysWOW64\slmgr.vbs /xpr
`
)
out
:=
pub
.
Execcmd_output
(
`cscript
C:\Windows\SysWOW64\slmgr.vbs /xpr //nologo
`
)
outs
:=
strings
.
TrimSpace
(
string
(
out
))
winProductName
:=
reg
.
Query_key_one
(
reg
.
HKLM
,
`SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform`
,
"BackupProductKeyDefault"
)
winProductName
,
_
:=
query_key_one
(
`SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform`
,
"BackupProductKeyDefault"
)
if
strings
.
Contains
(
outs
,
"计算机已永久激活"
)
{
log
.
Printf
(
"当前已永久激活,使用的密钥为%s"
,
winProductName
)
return
false
...
...
@@ -33,7 +33,10 @@ func checkWindows() bool {
return
status
}
func
requestWindowsKey
()
(
string
,
string
,
error
)
{
product
:=
reg
.
Query_key_one
(
reg
.
HKLM
,
`SOFTWARE\Microsoft\Windows NT\CurrentVersion`
,
"ProductName"
)
product
,
err
:=
query_key_one
(
`SOFTWARE\Microsoft\Windows NT\CurrentVersion`
,
"ProductName"
)
if
err
!=
nil
{
return
""
,
""
,
err
}
if
product
==
""
{
return
""
,
""
,
fmt
.
Errorf
(
"无法查询到系统产品名称"
)
}
...
...
@@ -54,24 +57,24 @@ func activeWindows() error {
return
err
}
log
.
Printf
(
"请求到%s的密钥:%s
\n
"
,
product
,
key
)
kmsfile
:=
"vlmcsd-Windows-x64.exe"
kms
:=
fmt
.
Sprintf
(
`%s\%s`
,
pub
.
Dir_tmp
,
kmsfile
)
if
pub
.
NotExist
(
kms
)
{
log
.
Printf
(
"下载kms服务器"
)
//
kmsfile := "vlmcsd-Windows-x64.exe"
//
kms := fmt.Sprintf(`%s\%s`, pub.Dir_tmp, kmsfile)
//
if pub.NotExist(kms) {
//
log.Printf("下载kms服务器")
url
:=
fmt
.
Sprintf
(
"%s/%s"
,
pub
.
Msg_File
,
kmsfile
)
if
err
:=
pub
.
DownloadFileInside
(
url
,
kms
);
err
!=
nil
{
log
.
Printf
(
"下载失败"
)
return
err
}
}
//
url := fmt.Sprintf("%s/%s", pub.Msg_File, kmsfile)
//
if err := pub.DownloadFileInside(url, kms); err != nil {
//
log.Printf("下载失败")
//
return err
//
}
//
}
if
!
pub
.
Telnet
(
"192.168.0.21"
,
"168
9
"
)
{
if
!
pub
.
Telnet
(
"192.168.0.21"
,
"168
8
"
)
{
return
fmt
.
Errorf
(
"无法连接到知微kms"
)
}
log
.
Printf
(
"探测到kms服务器已经运行"
)
outstr
:=
string
(
pub
.
Execcmd_output
(
`cscript
/nologo C:\Windows\SysWOW64\slmgr.vbs /skms 192.168.0.21:1688
`
))
outstr
:=
string
(
pub
.
Execcmd_output
(
`cscript
C:\Windows\SysWOW64\slmgr.vbs /skms 192.168.0.21:1688 //nologo
`
))
if
strings
.
Contains
(
outstr
,
"拒绝访问: 所请求的操作需要提升特权"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
...
...
@@ -79,14 +82,14 @@ func activeWindows() error {
log
.
Printf
(
"kms设置成功"
)
}
outstr
=
string
(
pub
.
Execcmd_output
(
`cscript
/nologo C:\Windows\SysWOW64\slmgr.vbs /ipk `
+
key
))
outstr
=
string
(
pub
.
Execcmd_output
(
`cscript
C:\Windows\SysWOW64\slmgr.vbs /ipk `
+
key
+
" //nologo"
))
if
strings
.
Contains
(
outstr
,
"拒绝访问: 所请求的操作需要提升特权"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"成功地安装了产品密钥"
)
{
log
.
Printf
(
"成功安装产品密钥"
)
}
outstr
=
string
(
pub
.
Execcmd_output
(
`cscript
/nologo C:\Windows\SysWOW64\slmgr.vbs /at
o`
))
outstr
=
string
(
pub
.
Execcmd_output
(
`cscript
C:\Windows\SysWOW64\slmgr.vbs /ato //nolog
o`
))
if
strings
.
Contains
(
outstr
,
"拒绝访问: 所请求的操作需要提升特权"
)
{
return
fmt
.
Errorf
(
"请使用管理员权限打开本程序"
)
}
else
if
strings
.
Contains
(
outstr
,
"0x8007000D 数据无效"
)
{
...
...
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