stegdoc 4.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ReemX
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ReemX
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,214 +1,200 @@
1
- # stegdoc
2
-
3
- > Hide files inside Office documents with AES-256 encryption and steganography
4
-
5
- [![npm version](https://img.shields.io/npm/v/stegdoc.svg)](https://www.npmjs.com/package/stegdoc)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- **stegdoc** is a CLI tool that encodes any file into legitimate-looking Office documents (Excel/Word). Your data is hidden within spreadsheets or documents that appear to contain normal server monitoring reports, while optionally being protected with military-grade AES-256-GCM encryption.
9
-
10
- ## Features
11
-
12
- - **Steganography** - Hide data in Excel spreadsheets (hidden sheets) or Word documents
13
- - **AES-256-GCM Encryption** - Military-grade encryption with PBKDF2 key derivation (100k iterations)
14
- - **Realistic Decoy Data** - Generated server metrics that make files look like IT monitoring reports
15
- - **Multi-part Splitting** - Automatically split large files across multiple documents
16
- - **Smart Compression** - Gzip compression for compressible files, skipped for images/video/archives
17
- - **Integrity Verification** - SHA-256 hashing detects tampering
18
- - **Folder Support** - Encode entire directories (automatically zipped)
19
- - **Interactive Mode** - User-friendly prompts guide you through options
20
-
21
- ## Installation
22
-
23
- ```bash
24
- npm install -g stegdoc
25
- ```
26
-
27
- Or run directly with npx:
28
-
29
- ```bash
30
- npx stegdoc encode myfile.pdf
31
- ```
32
-
33
- ## Quick Start
34
-
35
- ```bash
36
- # Encode a file with encryption (recommended)
37
- stegdoc encode secret.pdf -p mypassword
38
-
39
- # Decode it back
40
- stegdoc decode server_metrics_20251215_1200_A1B2.xlsx -p mypassword
41
-
42
- # View file info without decoding
43
- stegdoc info server_metrics_20251215_1200_A1B2.xlsx
44
-
45
- # Verify file integrity
46
- stegdoc verify server_metrics_20251215_1200_A1B2.xlsx -p mypassword
47
- ```
48
-
49
- ## Commands
50
-
51
- ### `encode` - Hide a file in an Office document
52
-
53
- ```bash
54
- stegdoc encode <file> [options]
55
- ```
56
-
57
- **Options:**
58
- | Option | Description | Default |
59
- |--------|-------------|---------|
60
- | `-o, --output-dir <dir>` | Output directory | Current directory |
61
- | `-s, --chunk-size <size>` | Split size: `5MB`, `25MB`, `3 parts`, `max`/`single`/`none` | `5MB` |
62
- | `-f, --format <format>` | Output format: `xlsx` or `docx` | `xlsx` |
63
- | `-p, --password <pass>` | Encryption password | None (unencrypted) |
64
- | `--force` | Overwrite existing files | Prompt |
65
- | `-q, --quiet` | Minimal output for scripting | Off |
66
- | `-y, --yes` | Skip interactive prompts | Off |
67
-
68
- **Examples:**
69
-
70
- ```bash
71
- # Basic encoding (will prompt for options)
72
- stegdoc encode document.pdf
73
-
74
- # Encode with password and Word format
75
- stegdoc encode document.pdf -p mysecret -f docx
76
-
77
- # Split into exactly 3 parts
78
- stegdoc encode large-video.mp4 -p mysecret -s "3 parts"
79
-
80
- # No splitting (single file output)
81
- stegdoc encode archive.zip -p mysecret -s max
82
-
83
- # Encode a folder
84
- stegdoc encode ./my-folder -p mysecret
85
- ```
86
-
87
- ### `decode` - Recover the original file
88
-
89
- ```bash
90
- stegdoc decode <file> [options]
91
- ```
92
-
93
- **Options:**
94
- | Option | Description | Default |
95
- |--------|-------------|---------|
96
- | `-o, --output <path>` | Output file path | Original filename |
97
- | `-p, --password <pass>` | Decryption password | Prompt if needed |
98
- | `--force` | Overwrite existing files | Prompt |
99
- | `-q, --quiet` | Minimal output | Off |
100
- | `-y, --yes` | Skip prompts, fail if password needed | Off |
101
-
102
- **Examples:**
103
-
104
- ```bash
105
- # Decode with password
106
- stegdoc decode server_metrics_20251215_1200_A1B2.xlsx -p mysecret
107
-
108
- # Decode to specific location
109
- stegdoc decode report.xlsx -p mysecret -o ./recovered/original.pdf
110
-
111
- # Multi-part files are auto-detected
112
- stegdoc decode server_metrics_20251215_1200_A1B2_part1.xlsx -p mysecret
113
- ```
114
-
115
- ### `info` - View metadata without decoding
116
-
117
- ```bash
118
- stegdoc info <file>
119
- ```
120
-
121
- Displays:
122
- - Original filename and size
123
- - Encryption status
124
- - Compression status
125
- - Part information (for split files)
126
- - Content hash for verification
127
-
128
- ### `verify` - Validate file integrity
129
-
130
- ```bash
131
- stegdoc verify <file> [options]
132
- ```
133
-
134
- **Options:**
135
- | Option | Description |
136
- |--------|-------------|
137
- | `-p, --password <pass>` | Verify password is correct |
138
-
139
- Checks:
140
- - Metadata integrity
141
- - All parts present (for multi-part files)
142
- - Password validity (if provided)
143
-
144
- ## How It Works
145
-
146
- ### Encoding Pipeline
147
-
148
- ```
149
- Input File
150
-
151
- [Compression] gzip (if beneficial)
152
-
153
- [Base64 Encoding]
154
-
155
- [Encryption] AES-256-GCM (optional)
156
-
157
- [Office Wrapper] XLSX or DOCX
158
-
159
- [Decoy Layer] Server metrics data
160
-
161
- Output File(s)
162
- ```
163
-
164
- ### File Storage
165
-
166
- **XLSX Format:**
167
- - Sheet 1 ("Server Metrics"): Visible decoy data - looks like IT monitoring reports
168
- - Sheet 2 ("Data"): Hidden sheet containing your encrypted payload
169
-
170
- **DOCX Format:**
171
- - Embedded text with metadata and payload
172
- - Appears as a system report document
173
-
174
- ### Encryption Details
175
-
176
- - **Algorithm**: AES-256-GCM (Galois/Counter Mode)
177
- - **Key Derivation**: PBKDF2-SHA256 with 100,000 iterations
178
- - **Key Size**: 256 bits
179
- - **IV**: 96 bits (randomly generated)
180
- - **Salt**: 128 bits (randomly generated)
181
- - **Authentication**: 128-bit auth tag (GCM provides authenticated encryption)
182
-
183
- ### Filename Generation
184
-
185
- Output files use deterministic, realistic filenames:
186
- ```
187
- server_metrics_YYYYMMDD_HH00_XXXX.xlsx
188
- system_report_YYYYMMDD_HH00_XXXX.docx
189
- ```
190
-
191
- The date/time and ID are derived from a hash, ensuring files from the same encoding session are related.
192
-
193
- ## Use Cases
194
-
195
- - **Secure file transfer** - Send encrypted files that look like mundane reports
196
- - **Backup storage** - Store sensitive data in plain sight
197
- - **Privacy** - Keep personal files private on shared systems
198
- - **Data portability** - Office documents work everywhere
199
-
200
- ## Backward Compatibility
201
-
202
- Files created with previous versions are fully supported. The tool automatically detects and handles legacy formats.
203
-
204
- ## Requirements
205
-
206
- - Node.js 18.0.0 or higher
207
-
208
- ## License
209
-
210
- MIT License - see [LICENSE](LICENSE) for details.
211
-
212
- ## Contributing
213
-
214
- Contributions are welcome! Please feel free to submit a Pull Request.
1
+ # stegdoc
2
+
3
+ > Hide files inside Office documents with AES-256 encryption and steganography
4
+
5
+ [![npm version](https://img.shields.io/npm/v/stegdoc.svg)](https://www.npmjs.com/package/stegdoc)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ **stegdoc** is a CLI tool that encodes any file into legitimate-looking Office documents (Excel/Word). Your data is hidden within realistic server access logs and Hebrew incident reports no hidden sheets, no suspicious content. Optionally protected with AES-256-GCM encryption.
9
+
10
+ ## Features
11
+
12
+ - **Log-Based Steganography** Payload is embedded directly in realistic nginx access log entries (URL tokens, UUIDs, trace IDs). No hidden sheets the data IS the logs
13
+ - **AES-256-GCM Encryption** Military-grade encryption with PBKDF2 key derivation (100k iterations)
14
+ - **Brotli Compression** — 15-25% better compression than gzip
15
+ - **Dual Format Support**
16
+ - **XLSX** Access log spreadsheet with realistic entries, any file size
17
+ - **DOCX** Hebrew RTL incident report with log excerpts, files under 1 MB
18
+ - **Multi-part Splitting** Automatically split large files across multiple documents
19
+ - **Integrity Verification** SHA-256 hashing detects tampering
20
+ - **Folder Support** — Encode entire directories (automatically zipped)
21
+ - **Interactive Mode** — User-friendly prompts guide you through options
22
+ - **Legacy Compatibility** — `--legacy` flag produces v4 format for older environments
23
+ - **Backward Compatible** — Reads and decodes all previous format versions
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install -g stegdoc
29
+ ```
30
+
31
+ Or run directly with npx:
32
+
33
+ ```bash
34
+ npx stegdoc encode myfile.pdf
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```bash
40
+ # Encode a file with encryption (recommended)
41
+ stegdoc encode secret.pdf -p mypassword
42
+
43
+ # Decode it back
44
+ stegdoc decode access_log_20260315_1200_A1B2_part1.xlsx -p mypassword
45
+
46
+ # View file info without decoding
47
+ stegdoc info access_log_20260315_1200_A1B2_part1.xlsx
48
+
49
+ # Verify file integrity
50
+ stegdoc verify access_log_20260315_1200_A1B2_part1.xlsx -p mypassword
51
+ ```
52
+
53
+ ## Commands
54
+
55
+ ### `encode` — Hide a file in an Office document
56
+
57
+ ```bash
58
+ stegdoc encode <file> [options]
59
+ ```
60
+
61
+ | Option | Description | Default |
62
+ |--------|-------------|---------|
63
+ | `-o, --output-dir <dir>` | Output directory | Current directory |
64
+ | `-s, --chunk-size <size>` | Split size: `5MB`, `25MB`, `3 parts`, `max` | `5MB` |
65
+ | `-f, --format <format>` | Output format: `xlsx` or `docx` | `xlsx` |
66
+ | `-p, --password <pass>` | Encryption password | None (unencrypted) |
67
+ | `--legacy` | Use v4 format for backward compatibility | Off |
68
+ | `--no-limit` | Bypass DOCX 1 MB size limit | Off |
69
+ | `--force` | Overwrite existing files | Prompt |
70
+ | `-q, --quiet` | Minimal output for scripting | Off |
71
+ | `-y, --yes` | Skip interactive prompts | Off |
72
+
73
+ **Examples:**
74
+
75
+ ```bash
76
+ # Encode with password (produces access log spreadsheet)
77
+ stegdoc encode document.pdf -p mysecret
78
+
79
+ # Encode as Hebrew incident report (DOCX)
80
+ stegdoc encode config.json -p mysecret -f docx
81
+
82
+ # Split into 3 parts
83
+ stegdoc encode large-file.zip -p mysecret -s "3 parts"
84
+
85
+ # Legacy v4 format (for older environments)
86
+ stegdoc encode data.bin -p mysecret --legacy
87
+
88
+ # Encode a folder
89
+ stegdoc encode ./my-folder -p mysecret
90
+ ```
91
+
92
+ ### `decode` — Recover the original file
93
+
94
+ ```bash
95
+ stegdoc decode <file> [options]
96
+ ```
97
+
98
+ | Option | Description | Default |
99
+ |--------|-------------|---------|
100
+ | `-o, --output <path>` | Output file path | Original filename |
101
+ | `-p, --password <pass>` | Decryption password | Prompt if needed |
102
+ | `--force` | Overwrite existing files | Prompt |
103
+ | `-q, --quiet` | Minimal output | Off |
104
+ | `-y, --yes` | Skip prompts, fail if password needed | Off |
105
+
106
+ **Examples:**
107
+
108
+ ```bash
109
+ # Decode with password
110
+ stegdoc decode access_log_20260315_1200_A1B2_part1.xlsx -p mysecret
111
+
112
+ # Decode DOCX
113
+ stegdoc decode system_report_20260315_0800_CD42_part1.docx -p mysecret
114
+
115
+ # Multi-part files auto-detected (just provide part 1)
116
+ stegdoc decode access_log_20260315_1200_A1B2_part1.xlsx -p mysecret
117
+ ```
118
+
119
+ ### `info` — View metadata without decoding
120
+
121
+ ```bash
122
+ stegdoc info <file>
123
+ ```
124
+
125
+ ### `verify` Validate file integrity
126
+
127
+ ```bash
128
+ stegdoc verify <file> [-p <password>]
129
+ ```
130
+
131
+ ## How It Works
132
+
133
+ ### v5 Pipeline (default)
134
+
135
+ ```
136
+ Input File
137
+ |
138
+ [Brotli Compression]
139
+ |
140
+ [AES-256-GCM Encryption] (optional)
141
+ |
142
+ [Log-Embed Encoding] -- payload distributed across log line fields
143
+ |
144
+ [Office Wrapper] -- XLSX access logs or DOCX incident report
145
+ |
146
+ Output File(s)
147
+ ```
148
+
149
+ ### Data Channels (per log line)
150
+
151
+ Each nginx access log entry carries **114 bytes** of payload across 6 channels:
152
+
153
+ | Channel | Format | Bytes |
154
+ |---------|--------|-------|
155
+ | URL path segment | base64url | 21 |
156
+ | Query param `token` | base64url | 21 |
157
+ | Query param `state` | base64url | 21 |
158
+ | Referer `ref` param | base64url | 21 |
159
+ | X-Request-ID | UUID v4 (hex) | 14 |
160
+ | X-Trace-ID | 32-char hex | 16 |
161
+
162
+ ### Output Formats
163
+
164
+ **XLSX** Single "Access Logs" sheet with realistic nginx log entries. Columns: Remote Address, Timestamp, Method, Request, Status, Bytes, Referer, User-Agent, X-Request-ID, X-Trace-ID. No hidden sheets.
165
+
166
+ **DOCX** — Hebrew RTL incident report with title, executive summary, timeline table, log excerpts in monospace code blocks, root cause analysis, and recommendations. Reports are procedurally generated (15 services x 12 incident types = thousands of unique variants).
167
+
168
+ ### Encryption
169
+
170
+ - **Algorithm**: AES-256-GCM (Galois/Counter Mode)
171
+ - **Key Derivation**: PBKDF2-SHA256 with 100,000 iterations
172
+ - **Key Size**: 256 bits
173
+ - **IV**: 96 bits (randomly generated per part)
174
+ - **Salt**: 128 bits (shared per session)
175
+ - **Authentication**: 128-bit auth tag
176
+
177
+ ### Filenames
178
+
179
+ ```
180
+ access_log_YYYYMMDD_HH00_XXXX[_partN].xlsx
181
+ system_report_YYYYMMDD_HH00_XXXX[_partN].docx
182
+ ```
183
+
184
+ ## Legacy Mode
185
+
186
+ Use `--legacy` to produce v4 format files (hidden sheet + gzip compression) for environments that haven't upgraded to stegdoc v5:
187
+
188
+ ```bash
189
+ stegdoc encode data.bin -p mypass --legacy
190
+ ```
191
+
192
+ The decoder auto-detects format version — it reads both v4 and v5 files without any flags.
193
+
194
+ ## Requirements
195
+
196
+ - Node.js 18.0.0 or higher
197
+
198
+ ## License
199
+
200
+ MIT License — see [LICENSE](LICENSE) for details.
package/package.json CHANGED
@@ -1,59 +1,59 @@
1
- {
2
- "name": "stegdoc",
3
- "version": "4.0.0",
4
- "description": "Hide files inside Office documents (XLSX/DOCX) with AES-256 encryption and steganography",
5
- "main": "src/index.js",
6
- "bin": {
7
- "stegdoc": "src/index.js"
8
- },
9
- "scripts": {
10
- "start": "node src/index.js",
11
- "dev": "node src/index.js",
12
- "test": "echo \"Error: no test specified\" && exit 1"
13
- },
14
- "keywords": [
15
- "cli",
16
- "steganography",
17
- "encryption",
18
- "aes-256",
19
- "xlsx",
20
- "docx",
21
- "hide",
22
- "encode",
23
- "decode",
24
- "covert",
25
- "office",
26
- "spreadsheet",
27
- "security"
28
- ],
29
- "author": "ReemX",
30
- "license": "MIT",
31
- "repository": {
32
- "type": "git",
33
- "url": "git+https://github.com/ReemX/stegdoc.git"
34
- },
35
- "bugs": {
36
- "url": "https://github.com/ReemX/stegdoc/issues"
37
- },
38
- "homepage": "https://github.com/ReemX/stegdoc#readme",
39
- "engines": {
40
- "node": ">=18.0.0"
41
- },
42
- "files": [
43
- "src",
44
- "LICENSE",
45
- "README.md"
46
- ],
47
- "packageManager": "pnpm@10.19.0",
48
- "dependencies": {
49
- "adm-zip": "^0.5.16",
50
- "chalk": "^4.1.2",
51
- "commander": "^14.0.2",
52
- "docx": "^9.5.1",
53
- "exceljs": "^4.4.0",
54
- "fast-xml-parser": "^5.3.3",
55
- "file-type": "^16.5.4",
56
- "inquirer": "^8.2.6",
57
- "ora": "^5.4.1"
58
- }
59
- }
1
+ {
2
+ "name": "stegdoc",
3
+ "version": "5.0.1",
4
+ "description": "Hide files inside Office documents (XLSX/DOCX) with AES-256 encryption and steganography",
5
+ "main": "src/index.js",
6
+ "bin": {
7
+ "stegdoc": "src/index.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node src/index.js",
11
+ "dev": "node src/index.js",
12
+ "test": "echo \"Error: no test specified\" && exit 1"
13
+ },
14
+ "keywords": [
15
+ "cli",
16
+ "steganography",
17
+ "encryption",
18
+ "aes-256",
19
+ "xlsx",
20
+ "docx",
21
+ "hide",
22
+ "encode",
23
+ "decode",
24
+ "covert",
25
+ "office",
26
+ "spreadsheet",
27
+ "security"
28
+ ],
29
+ "author": "ReemX",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/ReemX/stegdoc.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/ReemX/stegdoc/issues"
37
+ },
38
+ "homepage": "https://github.com/ReemX/stegdoc#readme",
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ },
42
+ "files": [
43
+ "src",
44
+ "LICENSE",
45
+ "README.md"
46
+ ],
47
+ "packageManager": "pnpm@10.19.0",
48
+ "dependencies": {
49
+ "adm-zip": "^0.5.16",
50
+ "chalk": "^4.1.2",
51
+ "commander": "^14.0.2",
52
+ "docx": "^9.5.1",
53
+ "exceljs": "^4.4.0",
54
+ "fast-xml-parser": "^5.3.3",
55
+ "file-type": "^16.5.4",
56
+ "inquirer": "^8.2.6",
57
+ "ora": "^5.4.1"
58
+ }
59
+ }