Jump to content

Problem getting script to work correctly


JTate

Recommended Posts

I am trying to create a script to enter a CTRL key every 4 minutes. This is what I presently do now is to hit either the left or right CTRL key and this resets the in use of my PC. Here is a snippet of my script file. I am using Hak5 Duck Encoder 2.6.3.

REM CtrlLoop.txt as of 2016-07-17
DELAY 1000
REM had other stuff here REM'd out
DELAY 10000
REPEAT 8
KEY_RIGHT_CTRL
REM -------------------
DELAY 10000
REPEAT 8
KEY_RIGHT_CTRL
REM -------------------
DELAY 10000
REPEAT 8
KEY_RIGHT_CTRL
REM -------------------
 

This keeps my PC awake, but if I position the cursor to a command prompt or in a text editor what I get is about every 3 minutes the letter k. Thus after a while I get a string of kkkkkkkkk. What I want is just the CTRL key submitted.

Would also be nice if I could put a branch in the script, right now I have the last four lines repeated about 1000 times.

Link to comment
Share on other sites

Welcome to the forum, what comes to mind first is why you would choose this method to keep your (windows?) box awake instead of using the options the OS gives you (the power options)? But ok that's not your question.

I'm not sure if KEY_RIGHT_CTRL is something ducky knows. Where did you get that? Referring to 

https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript

the control key is activated by CONTROL or CTRL. Did you try that? 

Making a loop like in a program is not possible, because ducky is not a script, but just a keyboard typing. Depending on the amount of time you want it work you'll need a long script. You might want to look into the DEFAULT_DELAY command to shorten your code.

Edited by Guest
Link to comment
Share on other sites

The answer to your first question is because I don't have admin access.

I got the KEY_RIGHT_CTRL from the keyboard.properties files. The way that I read the documentation was that you could use any of those names in the script. When I first started working on the script the CTRL gave an error as if it wanted an additional parameter. I tried changing the KEY_RIGHT_CTRL to just CTRL. It encodes with no problems but it allows the PC to timeout and lock now. It is a PIA when you are in the middle of a Webex and your PC locks up. Have to do the CTRL-ALT-DELETE and enter my password.

Link to comment
Share on other sites

I'm not sure about this but...I don't think your supposed to use the exact terms as used in the keyboard properties files. You use the terms as defined in ducky script. 

Have you tried CONTROL instead of CTRL?

Is the input language of the computer supported by ducky?

Can you think up another key combo to use (maybe open the startmenu and close it 4 minutes later)?

Link to comment
Share on other sites

Running the encoder with no options gives you the following, not the last line in particular.

Script Commands:
   ALT [key name] (ex: ALT F4, ALT SPACE)
   CTRL | CONTROL [key name] (ex: CTRL ESC)
   CTRL-ALT [key name] (ex: CTRL-ALT DEL)
   CTRL-SHIFT [key name] (ex: CTRL-SHIFT ESC)
   DEFAULT_DELAY | DEFAULTDELAY [Time in millisecond * 10] (change the delay bet
   DELAY [Time in millisecond * 10] (used to overide temporary the default delay
   GUI | WINDOWS [key name] (ex: GUI r, GUI l)
   REM [anything] (used to comment your code, no obligation :) )
   ALT-SHIFT (swap language)
   SHIFT [key name] (ex: SHIFT DEL)
   STRING [any character of your layout]
   REPEAT [Number] (Repeat last instruction N times)
   [key name] (anything in the keyboard.properties)

I changed it to use CONTROL (and like CTRL) and again it encodes with no problem but it allows the PC to timeout and lock. The language is US and it matches the keyboard. As for other key combinations it needs to be something that is less intrusive when I am using the PC and typing.

Link to comment
Share on other sites

Took your suggestion of a different combination. Tried CTRL F12 and that seems to work for most everything. It is defined to Excel and causes some weird results there. Possibly some other places it will cause problems, but I manually tried CTRL-F12 with most things that I use. Missed Excel and the first time I switched to Excel it was time for Ducky to quit waiting. This is workable but would still be nice if I could use just the CTRL.

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