stegdoc 1.0.1 → 3.0.2
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 +21 -21
- package/README.md +214 -214
- package/package.json +59 -60
- package/src/commands/decode.js +15 -1
- package/src/index.js +2 -2
- package/src/lib/docx-handler.js +1 -1
- package/src/lib/metadata.js +2 -2
- package/src/lib/xlsx-handler.js +1 -1
- package/bootstrap.js +0 -33
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,214 @@
|
|
|
1
|
-
# stegdoc
|
|
2
|
-
|
|
3
|
-
> Hide files inside Office documents with AES-256 encryption and steganography
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/stegdoc)
|
|
6
|
-
[](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
|
+
[](https://www.npmjs.com/package/stegdoc)
|
|
6
|
+
[](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.
|
package/package.json
CHANGED
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "stegdoc",
|
|
3
|
-
"version": "
|
|
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
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "stegdoc",
|
|
3
|
+
"version": "3.0.2",
|
|
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
|
+
}
|
package/src/commands/decode.js
CHANGED
|
@@ -76,7 +76,21 @@ async function decodeCommand(inputFile, options) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// Determine output path and check overwrite
|
|
79
|
-
|
|
79
|
+
let outputPath;
|
|
80
|
+
if (options.output) {
|
|
81
|
+
// Check if output is a directory - if so, append the original filename
|
|
82
|
+
if (fs.existsSync(options.output) && fs.statSync(options.output).isDirectory()) {
|
|
83
|
+
outputPath = path.join(options.output, metadata.originalFilename);
|
|
84
|
+
} else if (!path.extname(options.output) && !fs.existsSync(options.output)) {
|
|
85
|
+
// No extension and doesn't exist - treat as directory, create it
|
|
86
|
+
fs.mkdirSync(options.output, { recursive: true });
|
|
87
|
+
outputPath = path.join(options.output, metadata.originalFilename);
|
|
88
|
+
} else {
|
|
89
|
+
outputPath = options.output;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
outputPath = path.join(process.cwd(), metadata.originalFilename);
|
|
93
|
+
}
|
|
80
94
|
|
|
81
95
|
if (fs.existsSync(outputPath) && !options.force) {
|
|
82
96
|
if (quiet || options.yes) {
|
package/src/index.js
CHANGED
|
@@ -10,8 +10,8 @@ const verifyCommand = require('./commands/verify');
|
|
|
10
10
|
// CLI Configuration
|
|
11
11
|
program
|
|
12
12
|
.name('stegdoc')
|
|
13
|
-
.description('
|
|
14
|
-
.version('
|
|
13
|
+
.description('CLI tool to encode files into Office documents with AES-256 encryption')
|
|
14
|
+
.version('3.0.2');
|
|
15
15
|
|
|
16
16
|
// Encode command
|
|
17
17
|
program
|
package/src/lib/docx-handler.js
CHANGED
|
@@ -100,7 +100,7 @@ async function readDocxBase64(docxPath) {
|
|
|
100
100
|
const metadataStart = fullText.indexOf(metadataMarker);
|
|
101
101
|
|
|
102
102
|
if (metadataStart === -1) {
|
|
103
|
-
throw new Error('No metadata found in DOCX file. This may not be a
|
|
103
|
+
throw new Error('No metadata found in DOCX file. This may not be a stegdoc-encoded file.');
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// Find the separator "---" which comes after the metadata
|
package/src/lib/metadata.js
CHANGED
|
@@ -37,7 +37,7 @@ function createMetadata({
|
|
|
37
37
|
compressed,
|
|
38
38
|
contentHash,
|
|
39
39
|
encodingDate: new Date().toISOString(),
|
|
40
|
-
version: '
|
|
40
|
+
version: '3.0.2',
|
|
41
41
|
tool: 'stegdoc',
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -79,7 +79,7 @@ function validateMetadata(metadata) {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
if (metadata.tool !== 'stegdoc' && metadata.tool !== '
|
|
82
|
+
if (metadata.tool !== 'stegdoc' && metadata.tool !== 'whitener') {
|
|
83
83
|
throw new Error('Invalid tool identifier in metadata');
|
|
84
84
|
}
|
|
85
85
|
|
package/src/lib/xlsx-handler.js
CHANGED
|
@@ -211,7 +211,7 @@ async function extractFromXml(xlsxPath) {
|
|
|
211
211
|
const sheetParsed = parseXmlFromZip(xlsxPath, 'xl/worksheets/sheet2.xml');
|
|
212
212
|
|
|
213
213
|
if (!sheetParsed) {
|
|
214
|
-
throw new Error('Hidden sheet not found in XLSX file. This may not be a
|
|
214
|
+
throw new Error('Hidden sheet not found in XLSX file. This may not be a stegdoc-encoded file.');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// Build cell map from worksheet > sheetData > row > c
|
package/bootstrap.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// bootstrap.js - Decode whitener DOCX
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const JSZip = require('jszip');
|
|
4
|
-
|
|
5
|
-
const docxPath = process.argv[2];
|
|
6
|
-
if (!docxPath) {
|
|
7
|
-
console.log('Usage: node bootstrap.js <file.docx>');
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
JSZip.loadAsync(fs.readFileSync(docxPath)).then(zip => {
|
|
12
|
-
return zip.file('word/document.xml').async('string');
|
|
13
|
-
}).then(xml => {
|
|
14
|
-
const matches = xml.match(/<w:t[^>]*>([^<]*)<\/w:t>/g) || [];
|
|
15
|
-
let text = '';
|
|
16
|
-
matches.forEach(m => {
|
|
17
|
-
let t = m.replace(/<w:t[^>]*>/, '').replace(/<\/w:t>/, '')
|
|
18
|
-
.replace(/"/g, '"').replace(/'/g, "'")
|
|
19
|
-
.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
|
|
20
|
-
text += t;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const metaIdx = text.indexOf('WHITENER_METADATA:');
|
|
24
|
-
const sepIdx = text.indexOf('---', metaIdx);
|
|
25
|
-
const meta = JSON.parse(text.substring(metaIdx + 18, sepIdx).trim());
|
|
26
|
-
const base64 = text.substring(sepIdx + 3).trim();
|
|
27
|
-
|
|
28
|
-
fs.writeFileSync(meta.originalFilename, Buffer.from(base64, 'base64'));
|
|
29
|
-
console.log(`Decoded: ${meta.originalFilename}`);
|
|
30
|
-
}).catch(err => {
|
|
31
|
-
console.error('Error:', err.message);
|
|
32
|
-
process.exit(1);
|
|
33
|
-
});
|