Jump to content

Recommended Posts

Posted

Hello everyone, 

 

Could you help me - im stuck. So, there is exercise in ducky script course where you need to create 20 files with random names. I tried to make some variable:

DELAY 2000
COMMAND SPACE
DELAY 200
STRING terminal
DELAY 500
ENTER
DELAY 200
STRING cd Desktop/test
DELAY 500
VAR $COUNTER = 20
VAR $NAME = $_RANDOM_SC_LETTER + $_RANDOM_INT

WHILE ($COUNTER > 0)
    STRING touch %$NAME%
    ENTER
    DELAY 500
    $COUNTER = ($COUNTER - 1)
    VAR $NAME = $_RANDOM_SC_LETTER + $_RANDOM_INT
END_WHILE

 

 

But Actually it's not allowed to put some variable in STRING. How can I resolve that? Thank you in advance 

Posted

I guess you're referring to exercise 9-1

General tip; if you are entering a string then use STRINGLN instead of STRING followed by ENTER, saves some lines, especially in larger/longer payloads
There are of course occasions when STRING combined with ENTER is still valid even if using DS3.0

Initial delay might be a bit longer, it depends on how fast the target can enumerate the Ducky

From where do you get/where do you define $_RANDOM_SC_LETTER ?

Also, there will probably be an issue with assigning letters to a variable since variables can only contain integers. You most likely need to use $_RANDOM_LETTER_KEYCODE along with INJECT_VAR in that case if you want to follow that path. I would probably use another feature of DuckyScript to generate/output random letters without the need of using a variable.

Btw, the "cursor" never gets positioned in Desktop/test in the terminal since there is no ENTER following the line containing STRING cd Desktop/test

I guess that just using the touch command isn't enough since the exercise says the files should have content as well (also randomized), use the hint in the book

I would probably not have 2 lines with
VAR $NAME = $_RANDOM_SC_LETTER + $_RANDOM_INT
one should be enough in the beginning of the while loop (however, wouldn't use that line anyway)

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