Compare commits

...

2 Commits

Author SHA1 Message Date
qubiaobiao fbe039795a 软件加密批处理文件生成器 2024-02-22 14:12:53 +08:00
qubiaobiao 39061befc2 加密批处理文件生成器 2024-02-22 12:10:31 +08:00
6 changed files with 65 additions and 39 deletions

View File

@ -4,6 +4,6 @@ If Not "%~1"=="H" (
mshta vbscript:"<script language=vbs>Set UAC=CreateObject(""Shell.Application""):UAC.ShellExecute ""%~s0"", ""H"", """", ""runas"", 1:window,close</script>"
)
start "" "%~dp0\encryption.exe"
reg add HKEY_CURRENT_USER\SOFTWARE\HwaSmart /v BDAuthorization /t REG_SZ /d 87a47565-be47-1470-1a8b-c2354cbaea36 /f
exit

0
MachineGuid.txt Normal file
View File

Binary file not shown.

55
batcreater.js Normal file
View File

@ -0,0 +1,55 @@
const fs = require('fs');
const crypto = require('crypto');
const passPath = 'HKEY_CURRENT_USER\\SOFTWARE\\HwaSmart';
const passValue = 'BDAuthorization';
function cryptMD5(GUID) {
let md5 = crypto.createHash('md5');
let ciphertext = md5.update(GUID).digest('hex')
return ciphertext.slice(0,8)+'-'+ciphertext.slice(8,12)+'-'+ciphertext.slice(12,16)+'-'+ciphertext.slice(16,20)+'-'+ciphertext.slice(20,32);
}
fs.readFile('./MachineGuid.txt', 'utf-8', (err, data) => {
if (err) {
if (err.code === 'ENOENT') {
console.error('file not exist');
return;
}
console.error(err, 'open');
return;
}
fs.readFile('./KeyWord.txt', 'utf-8', (error, key) => {
if (error) {
if (error.code === 'ENOENT') {
console.error('file not exist');
return;
}
console.error(error, 'open');
return;
}
console.log(key)
fs.writeFile('./BDAuthorization.bat',
`@echo off
If Not "%~1"=="H" (
mshta vbscript:"<script language=vbs>Set UAC=CreateObject(""Shell.Application""):UAC.ShellExecute ""%~s0"", ""H"", """", ""runas"", 1:window,close</script>"
)
reg add ${passPath} /v ${passValue} /t REG_SZ /d ${cryptMD5(data + key)} /f
exit`,
(e) => {
if(e){
console.log(`创建失败:${e}`);
}
console.log(`创建成功!`);
});
fs.writeFile('./MachineGuid.txt', '', (ero) => {
if(ero){
console.log(`创建失败:${ero}`);
}
console.log(`创建成功!`);
});
});
});

View File

@ -1,33 +0,0 @@
const crypto = require('crypto');
const fs = require('fs');
const child_process = require('child_process');
const keyPath = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography';
const keyValue = 'MachineGuid';
const passPath = 'HKEY_CURRENT_USER\\SOFTWARE\\HwaSmart';
const passValue = 'BDAuthorization';
function cryptMD5(GUID) {
let md5 = crypto.createHash('md5');
let ciphertext = md5.update(GUID).digest('hex')
return ciphertext.slice(0,8)+'-'+ciphertext.slice(8,12)+'-'+ciphertext.slice(12,16)+'-'+ciphertext.slice(16,20)+'-'+ciphertext.slice(20,32);
}
fs.readFile('./KeyWord.txt', 'utf-8', (err, key) => {
if (err) {
if (err.code === 'ENOENT') {
console.error('file not exist');
return;
}
console.error(err, 'open');
return;
}
child_process.exec(`REG QUERY ${keyPath} /v ${keyValue}`,function(error,stdout,stderr){
console.log('stderr:'+stderr);
if(error != null){
console.log('exec error:'+error);
return
}
child_process.exec(`reg add ${passPath} /v ${passValue} /t REG_SZ /d ${cryptMD5(stdout.slice(83,119) + key)} /f`);
});
});

View File

@ -1,6 +1,10 @@
打开文件
拿到客户的Guid后将其粘贴到文件
MachineGuid.txt 中
再打开文件
KeyWord.txt
输入加密关键字
点击运行文件
权限部署.bat
即可完成权限部署
然后点击运行文件
batcreater.exe
运行完成后将文件
BDAuthorization.bat
发送到客户的电脑上,在客户的电脑上点击运行