From dc6e0a99ffb4227338193a12926c81e588c5d0c9 Mon Sep 17 00:00:00 2001 From: elkentaro Date: Sun, 16 Apr 2017 20:16:45 +0900 Subject: [PATCH] Added an extension to overwrite the default keyboard layout to en-US (#167) * Create setkb.sh * Update setkb.sh added a delay after the powershell to allow the execution of the powershell command. * Update setkb.sh Modified so that its even easier. SETKB START will set the keyboard to a en-US keyboard layout. SETKB DONE will reset the keyboard to the default layout based on the culture settings. SET xx-XX will set the keyboard layout to whatever is specified as xx-XX --- library/extensions/setkb.sh | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 library/extensions/setkb.sh diff --git a/library/extensions/setkb.sh b/library/extensions/setkb.sh new file mode 100644 index 0000000..5d4b6c2 --- /dev/null +++ b/library/extensions/setkb.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# SETKB v2.0 by @elkentaro +# Simplifies executing commands from HID attacks for different language keyboards. on Windows by using Powershell. +# Usage: SETKB en-US [give the command the 2 letter combination of keyboard settings] +# +# Examples: +# SETKB START (set the keyboard layout to a US keyboard layout) +# SETKB DONE (set the keyboard layout to the default keyboard determined by the OS language settings) +# SETKB xx-XX (overwrite the keyboard layout to whatever keyboard layout you need, you will need the [lanugage].json file to run Ducky scripts) + + +function SETKB() { + local state=$1 + shift + + [[ -z "$state" ]] && exit 1 # state keyboard parameter must be given. + + case "$state" in + 'START') + QUACK GUI r + QUACK DELAY 500 + QUACK STRING "powershell.exe Set-WinUserLanguageList -LanguageList en-US -force;" + QUACK ENTER + QUACK DELAY 1500 + + ;; + 'DONE') + QUACK GUI r + QUACK DELAY 500 + QUACK "STRING powershell.exe \$back2kb=(get-Culture | Select -ExpandProperty Name) ; Set-WinUserLanguageList -LanguageList \$back2kb -force; " + QUACK ENTER + QUACK DELAY 1500 + + ;; + + *) + QUACK GUI r + QUACK DELAY 500 + QUACK "STRING powershell.exe Set-WinUserLanguageList -LanguageList $state -force" + QUACK ENTER + QUACK DELAY 1500 + + ;; + + + + esac +} + +export -f SETKB