A powerful and flexible screen capture utility for Windows that captures one or multiple screenshots and packages them into a ZIP archive. Part of the AfterShell post-exploitation toolkit.
✨ Standalone Executable: This application builds as a single-file executable with no DLL dependencies. Just copy the .exe and run it anywhere on Windows x64 systems.
1. Build the Application
cd C:\Dev\AfterShell\exfil\ScreenCapture
build-screencapture.bat2. Run Your First Capture
# Capture a single screenshot
bin\Release\net8.0-windows\win-x64\publish\ScreenCapture.exe
# Output: screenshots_YYYYMMDD_HHMMSS.zip in current directory| Task | Command |
|---|---|
| Single screenshot | ScreenCapture.exe |
| 5 screenshots | ScreenCapture.exe -c 5 |
| 10 screenshots, 2s apart | ScreenCapture.exe -c 10 -i 2 |
| Wait 5s, then capture | ScreenCapture.exe -d 5 |
| Custom filename | ScreenCapture.exe -o myfile.zip |
| Primary monitor only | ScreenCapture.exe --monitor 1 |
| List monitors | ScreenCapture.exe --list-monitors |
| Show help | ScreenCapture.exe --help |
- Single or Multiple Captures: Capture one screenshot or N screenshots in sequence
- Configurable Intervals: Set time intervals between consecutive captures
- Initial Delay: Add a delay before starting the capture sequence
- Multi-Monitor Support: Capture from all monitors, primary monitor, or specific monitors
- Automatic ZIP Packaging: All screenshots are automatically packaged into a ZIP file
- High Quality PNG Format: Screenshots saved in lossless PNG format
- Timestamped Filenames: Each screenshot has a unique timestamp
- Automatic Cleanup: Temporary files are automatically cleaned up
- Operating System: Windows 10 or later
- .NET Runtime: .NET 8.0 or later
- Dependencies: System.Drawing.Common (automatically installed)
Note: This project is configured to build as a single-file standalone executable. See the Single-File Build Guide for details.
# Navigate to the project folder
cd exfil\ScreenCapture
# Build both Debug and Release versions
build-screencapture.bat# Navigate to the project folder
cd exfil\ScreenCapture
# Publish as single-file executable (Debug)
dotnet publish -c Debug
# Publish as single-file executable (Release)
dotnet publish -c Release
# Output location:
# bin\Release\net8.0-windows\win-x64\publish\ScreenCapture.exe# Build and run with parameters
build-and-run-screencapture.bat --help
build-and-run-screencapture.bat -c 3 -i 1
build-and-run-screencapture.bat -c 3 -i 1 -o test.zipAfter building, find your standalone executable at:
bin\Debug\net8.0-windows\win-x64\publish\ScreenCapture.exe (Debug build)
bin\Release\net8.0-windows\win-x64\publish\ScreenCapture.exe (Release build)
✨ No DLLs required! The executable includes all dependencies. Just copy and run anywhere on Windows x64.
# Capture a single screenshot (default)
ScreenCapture.exe
# Capture 5 screenshots
ScreenCapture.exe -c 5
# Capture 10 screenshots, 2 seconds apart
ScreenCapture.exe -c 10 -i 2# Capture with initial delay
ScreenCapture.exe -c 5 -i 1 -d 3
# Custom output filename
ScreenCapture.exe -c 3 -o myscreen.zip
# Capture from primary monitor only
ScreenCapture.exe -c 5 --monitor 1
# Capture from second monitor
ScreenCapture.exe -c 3 --monitor 2
# List all available monitors
ScreenCapture.exe --list-monitors
# Continuous capture with long interval
ScreenCapture.exe -c 100 -i 60| Option | Short | Description | Default |
|---|---|---|---|
--count |
-c |
Number of screenshots to capture | 1 |
--interval |
-i |
Interval in seconds between screenshots | 0 |
--delay |
-d |
Initial delay in seconds before starting | 0 |
--output |
-o |
Output ZIP file path | screenshots_YYYYMMDD_HHMMSS.zip |
--monitor |
-m |
Monitor to capture (0=all, 1=primary, 2+=specific) | 0 |
--list-monitors |
List all available monitors and exit | ||
--help |
-h |
Show help message |
- Monitor 0: Captures the entire virtual screen (all monitors combined)
- Monitor 1: Always captures the primary monitor
- Monitor 2+: Captures the specific monitor number (use
--list-monitorsto see available monitors)
ScreenCapture.exe --list-monitorsOutput Example:
Found 3 monitor(s):
Monitor #1 (Primary)
Resolution: 2560x1440
Position: X=0, Y=0
Device: \\.\DISPLAY1
Monitor #2
Resolution: 1920x1080
Position: X=2560, Y=0
Device: \\.\DISPLAY2
--monitor 0= All monitors (default)--monitor 1= Primary monitor--monitor 2= Second monitor- And so on...
- File Format: PNG (lossless compression, high quality)
- Filename Pattern:
screenshot_YYYYMMDD_HHMMSS_fff.png - ZIP Archive: All screenshots automatically packaged
- Default ZIP Name:
screenshots_YYYYMMDD_HHMMSS.zip
ScreenCapture.exeResult: 1 screenshot in ZIP file
Output: screenshots_20260112_143022.zip containing 1 screenshot
# Capture 5 screenshots with 1 second between each
ScreenCapture.exe -c 5 -i 1 -o evidence.zipResult: evidence.zip with 5 screenshots
Capture screenshots every 30 seconds for 1 hour (120 screenshots):
ScreenCapture.exe -c 120 -i 30 -o surveillance.zip# Capture every 30 seconds for 10 minutes (20 screenshots)
ScreenCapture.exe -c 20 -i 30 -o monitoring.zipCapture from each monitor separately:
# Capture all monitors as one image
ScreenCapture.exe -c 3 -i 2 --monitor 0 -o all_monitors.zip
# Capture primary monitor only
ScreenCapture.exe -c 3 -i 2 --monitor 1 -o primary_only.zip
# Capture specific monitor
ScreenCapture.exe -c 1 --monitor 2 -o monitor2.zipCapture 60 screenshots, one per minute:
ScreenCapture.exe -c 60 -i 60 -o timelapse.zipWait 10 seconds before starting (time to switch windows):
ScreenCapture.exe -c 3 -d 10 -o delayed.zipResult: Time to switch windows before capture
# Wait 10 seconds to open document, then capture
ScreenCapture.exe -d 10 -o document.zip- Use Initial Delay (
-d) to switch windows before capture - Monitor 0 captures the entire desktop (all monitors combined)
- ZIP files are automatically created - no need to specify .zip extension
- Timestamps prevent filename conflicts
- Temporary files are automatically cleaned up
- Uses native Windows GDI+ APIs for screen capture
- Leverages
Graphics.CopyFromScreen()for optimal performance - Supports multi-monitor configurations through
System.Windows.Forms.Screen
- Uses .NET built-in
System.IO.Compression - Optimal compression level for balance between size and speed
- In-memory processing for efficiency
- Creates temporary directory for screenshots
- Automatic cleanup of temporary files
- Directory creation for output path if needed
- Handles file conflicts by overwriting
- Low CPU usage during intervals
- Minimal memory footprint
- Fast PNG encoding
- Efficient ZIP compression
The utility handles various error conditions:
- Monitor not found: Validates monitor index before capture
- File system errors: Creates directories as needed
- Access denied: Reports permission issues
- Capture failures: Continues with remaining captures if one fails
- Cleanup errors: Ignores cleanup failures (non-critical)
Solution: Run ScreenCapture.exe --list-monitors to see available monitors
Solution: Ensure you have proper permissions. Some protected content may require elevated privileges.
Solution:
- Use monitor selection to capture specific screens only
- Reduce the number of captures
- PNG format is necessary for quality but creates larger files
Solution:
- Ensure .NET 8.0 SDK is installed
- Run
dotnet restorebefore building - Check that System.Drawing.Common package is available
dotnet --versionSolution: Check output directory permissions
- Screenshots may contain sensitive information
- ZIP files are not encrypted by default
- Consider secure transfer and deletion of capture files
- Be aware of monitoring and detection tools
This utility is part of the AfterShell post-exploitation toolkit. It can be integrated with other AfterShell tools for comprehensive data exfiltration:
# Example: Combine with other exfil tools
ScreenCapture.exe -c 5 -i 2 -o screens.zip
OutlookExporter.exe --recipients --limit 100 -o contacts.csv
# ... additional exfil operationsThis tool is part of the AfterShell project. Contributions, bug reports, and feature requests are welcome at:
GitHub: https://github.com/Logisek/AfterShell
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Copyright (C) 2025 Logisek
- Website: https://logisek.com
- Email: info@logisek.com
- Project: https://github.com/Logisek/AfterShell
- Initial release
- Single and multiple screenshot capture
- Multi-monitor support
- Automatic ZIP packaging
- Configurable intervals and delays
- AfterShell integration