Jump to content

How do I use an alt+spacebar combo in ducky script?


Recommended Posts

I'm trying to write a ducky script for my rubber ducky that will open the powershell terminal and then make the screen rain the green digits like in the matrix, but in order to maximize the effect I want to make the shell window max size as soon as it opens and i dont know how to do that with keystrokes other than alt+spacebar to open the upper left window menu and hitting "x" to maximize. How would I put that button combo into ducky script? Would it be

"alt spacebar" or 

"alt  space" kind of how to open the shell or notepad you start it with

"GUI r" to signify the windows button plus r to open the run menu (I know the quote marks dont go there, just using them to seperate the button combos for this example). Anyhow, I'm at at a stand still till I can figure this out. Any help would be really appreciated. Thanks in advance!

Link to comment
Share on other sites

What Ducky do you have? New or old version? What encoder do you use? The Javascript based older web based one (or java command line) or Payload Studio? If you're using the Javascript encoder to create the inject.bin file, you might need to adjust the JS code to get it accepting the key combo you want to use.

Link to comment
Share on other sites

I have the original ducky I use the JS encoder. Is payload studio the one you can buy from Hak5? Also, all I'm really wanting to use the apt+spacebar combo for is to maximize the PS window when I open it. I didnt even think about it until after I posted this, but isnt there a command in duckyscript to maximize window or am I mistaken and thinking of something else? Either way, thanks for the reply, I'll try to do a little more reading on how to write the script to see what I may need to be tweaking to fix it. I just tried to get it to do it using the alt+spacebar command in so many ways that I ran out of ideas. It may be something else in the script altogether that is causing my payload not to work how I want

Link to comment
Share on other sites

Payload Studio is the recently released editor/encoder from Hak5. You can buy the Pro version, but there's a free community edition as well.


However, for the JS encoder you can try to adjust the code. There's a bug that results in things getting "cut", so your "ALT SPACE" will be "ALT S".

Open the JS encoder HTML file

At about line 440 in the JS encoder file, change
let key = args[0];
let key = args;

Link to comment
Share on other sites

You can use Payload Studio to write DuckyScript 1.0 for the old "Classic" USB Rubber Ducky — but you'll have to be mindful to limit yourself to only the classic commands: REM, STRING, DELAY and the special keys/combos. The inject.bin file is generates will be backwards compatible with the old duck so long as you don't use any of the new features.

The key combo you're looking for is `ALT SPACE`

Another way to do this in Windows however (for cmd and powershell) is `ALT ENTER`

You can find documentation for the keystroke injection commands / keys at https://docs.hak5.org/hak5-usb-rubber-ducky/ducky-script-basics/keystroke-injection

Link to comment
Share on other sites

PayloadStudio 1.1.0 is out and makes writing payloads in the correct DuckyScript version a little easier - the compiler will now detect and provide output for which version of DuckyScript was detected in use in your payload (so you can ensure you're using the right version - DS1.0 for an OG ducky)

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.

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...