Collection techniques

← maldev README · docs/index

The collection/* package tree groups local data-acquisition primitives for post-exploitation: keystrokes, clipboard contents, screen captures. Each sub-package is self-contained and Windows-only — pick the data source the operator needs and import the matching package.

flowchart LR
    subgraph user [User session]
        KB[Keyboard input]
        CB[Clipboard]
        FB[Framebuffer]
    end
    subgraph collection [collection/*]
        K[keylog<br>WH_KEYBOARD_LL hook]
        C[clipboard<br>OpenClipboard + seq poll]
        S[screenshot<br>GDI BitBlt]
    end
    subgraph sink [Operator sink]
        OUT[stdout / file / C2 channel]
    end
    KB --> K
    CB --> C
    FB --> S
    K -. Ctrl+V .-> C
    K --> OUT
    C --> OUT
    S --> OUT

Packages

PackageTech pageDetectionOne-liner
collection/keylogkeylogging.mdnoisylow-level keyboard hook with per-event window/process attribution and Ctrl+V clipboard capture
collection/clipboardclipboard.mdquietone-shot ReadText plus Watch channel driven by GetClipboardSequenceNumber polling
collection/screenshotscreenshot.mdquietGDI BitBlt → PNG; primary, arbitrary rectangle, or per-monitor capture

Quick decision tree

You want to…Use
…record what the user types, with window contextkeylog.Start
…also capture pasted credentialskeylog.Start — Ctrl+V auto-snapshots clipboard into the event
…read clipboard once (e.g. after runas)clipboard.ReadText
…stream clipboard changes for a sessionclipboard.Watch
…grab the primary monitor as PNGscreenshot.Capture
…enumerate monitors first, then capture onescreenshot.DisplayCountCaptureDisplay
…crop to a specific UI region (e.g. an open RDP window)screenshot.CaptureRect

MITRE ATT&CK

T-IDNamePackagesD3FEND counter
T1056.001Input Capture: Keyloggingcollection/keylogD3-PA
T1115Clipboard Datacollection/clipboard, collection/keylog (paste capture)D3-PA
T1113Screen Capturecollection/screenshotD3-PA

Cross-referenced techniques

Two adjacent collection workflows live under sibling areas. They are listed here as a navigation convenience; their canonical homes are the packages that own them.

Area concernTech pageOwning package
NTFS Alternate Data Streams (hide collected data in :stream suffixes)alternate-data-streams.mdcleanup/ads
LSASS minidump (in-process MINIDUMP assembly via NtReadVirtualMemory)lsass-dump.mdcredentials/lsassdump

[!NOTE] Both pages will move to their owning areas in Phase 6 of the doc refactor (see docs/refactor-2026-doc/progress.md).

See also