The following is a true story of a small victory I felt that I should share, and maybe help someone with similar interests.
This is likely not the easiest way to achieve this, but it was a simple concept I wanted to give a shot.
I had an idea the other day to copy all of my saved payloads onto my android phone. This way, whenever I might be feeling mischievous, *err*, need to perform "administrative tasks", I could do so without going to my laptop. which I might not have on me, choosing the script, compiling, and transferring onto my ducky.
Step 1: Organization
My goal was to "pre-compile", and relocate each source file, along with its resulting inject.bin file into its own directory, so as to easily access them on my android; easy selection, and transfer them quickly to the storage of my ducky.
Originally, I had about 40 scripts saved as .txt files in a directory named "Payloads".
[Payloads]
|
|----Payload1.txt
|----Payload2.txt
|----Payload3.txt
etc.
With a bit of windows, and a crash course in powershell-fu, I made a script to create directories with the name of the payload, and move the payload into its respective directory.
MakeDirAndRename.ps1:
$files = get-childitem "C:\Users\Cola\Desktop\Duck\Payloads\*.txt"
ForEach ($file in $files) {
$dirname = $file.BaseName
New-Item -Path $dirname -type directory
Move-Item $file $dirname
}
Result:
[Payloads]
|
|----[Payload1]
| |
| |----Payload1.txt
|
|
|----[Payload2]
| |
| |----Payload2.txt
|
|
|----[Payload3]
| |
| |----Payload3.txt
etc.
Step 2: Compiling Recursively
Realizing that the compiler looks for files named payload.txt, I made another script to recursively rename them all to payload.txt, in retrospect, I would have just modified the compiler batch file to look recursively through the directories and compile all the things, but its all about learning, so this is what I did:
RecursiveRename.ps1
get-childItem -recurse | Where {$_.extension -eq ".txt"} | rename-item -newname payload.txt
Result:
[Payloads]
|
|----[Payload1]
| |
| |----payload.txt
|
|
|----[Payload2]
| |
| |----payload.txt
|
|
|----[Payload3]
| |
| |----payload.txt
etc.
I modified the compiler to include the path to encode.jar, then wrote a cute little batch script to run the compiler.bat in each directory recursively.
call "C:\Users\Cola\Desktop\Duck\Payloads\compile.bat"
for /r /d %%x in (*) do (
pushd "%%x"
call "C:\Users\Cola\Desktop\Duck\Payloads\compile.bat"
popd
)
The final result:
[Payloads]
|
|----[Payload1]
| |
| |----Payload1.txt
| |----inject.bin
|
|----[Payload2]
| |
| |----Payload2.txt
| |----inject.bin
|
|----[Payload3]
| |
| |----Payload3.txt
| |----inject.bin
etc.
Pardon the icky, roundabout way, but with my limited windows/IT background, I was pretty darn happy when I got it all working.
Step 3: Deployment
After organizing the files in a phone/tablet friendly way, and eliminating the need to compile every time I needed to change scripts, I transferred all of the directories onto a folder on my phones built in storage. To retrieve them, I will either plug the ducky in to my phone via OTG cable (I'm using 4CAP firmware), or just the SD card.
I hadn't seen anything about this and the idea just kinda hit me when I had my ducky with me, but no laptop.
Please give me some feedback on what I've done and let me know what I could have done better!
Also, I'd love to see some similar stories!
EDIT: Wrapping up
After experimentation, I decided to add a bookmark to http://ducktoolkit-411.rhcloud.com/Home.jsp to my home screen, next to my preferred filesystem browser
This has the Online Duck Encoder, and various other recources.