Jump to content

[Extension] SETKB


elkentaro

Recommended Posts

So with the new firmware 1.1 , we now have extension. Here is my contribution, it sets the input keyboard layout to en-US (US keyboard) to provide an easier way to work with the payloads. Granted there is a DUCKY_LANG option , however its still a bit wanky for me and from reading the forums for some others. This way , you don't need to worry about different layouts.

 

----------------------------------setkb.sh--------------

#!/bin/bash
#
# SETKB v1 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]
# copy the text of and save it as setkb.sh under /payloads/library/extensions/
# Examples:
# SETKB en-US (set the keyboard layout to a US keyboard layout) [usage prior to HID attack]
# SETKB ja-JP (set the keyboard layout to a Japanese 106 layout) [usage after HID attack to reset the env]


function SETKB() {
   local kb=$1
   shift
   
   [[ -z "$kb" ]] && exit 1 # KB keyboard parameter must be given.
   
   case "$kb" in
      'en-US')
         QUACK GUI r
         QUACK DELAY 500
         QUACK STRING "powershell.exe Set-WinUserLanguageList -LanguageList en-US -force"
   QUACK DELAY 1500
         QUACK ENTER
         ;;
      *)
         QUACK GUI r
         QUACK DELAY 500
         QUACK "STRING powershell.exe Set-WinUserLanguageList -LanguageList $kb -force"
        QUACK DELAY 1500
         QUACK ENTER
         ;;       
   esac
}

export -f SETKB

------------------------------------------------

Minor note: This extension does require that the "-" key is the same key code as the one in us.json . 

Edited by elkentaro
  • Upvote 3
Link to comment
Share on other sites

New version out. 

SETKB START will switch it to en-US keyboard, then SETKB DONE will set it back based on windows OS language version, SETKB xx-XX will overwrite to whatever keyboard setting you want. 

you do have to change the default us.json file to issue a different key code for "-" 

"-":"00:00:56" 

Which seems to be the universal key code for "-" on the numpad instead of the keyboard.

 

  • Upvote 2
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Is it possible to specify the InputMethodTips when you set the language.

Here's my problem: When i set the language back to fr-CA the default keyboard layout is French Canadian multilingual (InputMethodTips : {0C0C:00011009})

I'd want to set the keyboard layout to French Canadian (InputMethodTips : {0C0C:00001009})

The first is when a set SETKB fr-Ca

The second is whan i go manually put French Canadian in the keyboard layout

PS C:\Users\user> Get-WinUserLanguageList

LanguageTag     : fr-CA
Autonym         : français (Canada)
EnglishName     : French
LocalizedName   : Français (Canada)
ScriptName      : Script latin
InputMethodTips : {0C0C:00011009}
Spellchecking   : True
Handwriting     : False

PS C:\Users\user> Get-WinUserLanguageList


LanguageTag     : fr-CA
Autonym         : français (Canada)
EnglishName     : French
LocalizedName   : Français (Canada)
ScriptName      : Script latin
InputMethodTips : {0C0C:00001009}
Spellchecking   : True
Handwriting     : False

 

 

Thanks for your help !

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...