tde 1.0.0__tar.gz
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.
- tde-1.0.0/LICENSE +21 -0
- tde-1.0.0/PKG-INFO +345 -0
- tde-1.0.0/README.md +317 -0
- tde-1.0.0/setup.cfg +4 -0
- tde-1.0.0/setup.py +29 -0
- tde-1.0.0/tde/__init__.py +1 -0
- tde-1.0.0/tde/cli.py +293 -0
- tde-1.0.0/tde.egg-info/PKG-INFO +345 -0
- tde-1.0.0/tde.egg-info/SOURCES.txt +10 -0
- tde-1.0.0/tde.egg-info/dependency_links.txt +1 -0
- tde-1.0.0/tde.egg-info/entry_points.txt +2 -0
- tde-1.0.0/tde.egg-info/top_level.txt +1 -0
tde-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tanishq Zope
|
|
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.
|
tde-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tde
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: TDE β Tanishq's Decoder & Encoder. A fast, dependency-free Base64 CLI tool.
|
|
5
|
+
Home-page: https://github.com/tanishqzope/TDE-Tool
|
|
6
|
+
Author: Tanishq Zope
|
|
7
|
+
Author-email: tanishqzope5@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Topic :: Security :: Cryptography
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-python
|
|
27
|
+
Dynamic: summary
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<img src="https://img.shields.io/badge/TDE-v1.0.0-00C853?style=for-the-badge&logo=python&logoColor=white" alt="Version"/>
|
|
31
|
+
<img src="https://img.shields.io/badge/Python-3.7+-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"/>
|
|
32
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"/>
|
|
33
|
+
<img src="https://img.shields.io/badge/Dependencies-Zero-success?style=for-the-badge" alt="Dependencies"/>
|
|
34
|
+
<img src="https://img.shields.io/badge/Platform-Win%20%7C%20Linux%20%7C%20macOS-blue?style=for-the-badge" alt="Platform"/>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<h1 align="center">π TDE β Tanishq's Decoder & Encoder</h1>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<strong>A fast, lightweight, dependency-free CLI tool for Base64 encoding & decoding.</strong><br/>
|
|
41
|
+
Built purely with Python's standard libraries β zero security overhead, absolute portability.
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="#-features">Features</a> β’
|
|
46
|
+
<a href="#-installation">Installation</a> β’
|
|
47
|
+
<a href="#-usage">Usage</a> β’
|
|
48
|
+
<a href="#%EF%B8%8F-architecture">Architecture</a> β’
|
|
49
|
+
<a href="#-contributing">Contributing</a> β’
|
|
50
|
+
<a href="#-license">License</a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## β¨ Features
|
|
56
|
+
|
|
57
|
+
| Feature | Description |
|
|
58
|
+
|---|---|
|
|
59
|
+
| π« **Zero Dependencies** | Runs natively using only built-in Python libraries β nothing to install, nothing to break |
|
|
60
|
+
| π₯οΈ **Cross-Platform** | Works seamlessly on Command Prompt, PowerShell, Git Bash, WSL, and Linux/macOS terminals |
|
|
61
|
+
| π **File I/O** | Read from and write directly to files for handling large payloads or binaries |
|
|
62
|
+
| π **URL-Safe Mode** | Seamlessly handle JSON Web Tokens (JWTs) and URL parameters with `-` `_` alphabet |
|
|
63
|
+
| π‘οΈ **Strict Validation** | Catch malformed data streams instantly with `--strict` mode |
|
|
64
|
+
| π§Ή **Garbage Collection** | Force-decode messy inputs by stripping invalid characters automatically |
|
|
65
|
+
| π **Pipe Support** | Chain with other CLI tools via stdin/stdout piping |
|
|
66
|
+
| π¨ **Coloured Output** | ANSI colour support with automatic graceful degradation |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## π¦ Installation
|
|
71
|
+
|
|
72
|
+
> **Prerequisites:** Python 3.7 or higher
|
|
73
|
+
|
|
74
|
+
### Quick Install
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/tanishqzope/TDE-Tool.git
|
|
78
|
+
cd TDE-Tool
|
|
79
|
+
pip install .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Once installed, the `tde` command is globally available from **any terminal**.
|
|
83
|
+
|
|
84
|
+
### Verify Installation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
tde --version
|
|
88
|
+
# Output: TDE v1.0.0
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## π Usage
|
|
94
|
+
|
|
95
|
+
### Basic Encoding & Decoding
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Encode a string to Base64
|
|
99
|
+
tde encode "hello world"
|
|
100
|
+
# Output: aGVsbG8gd29ybGQ=
|
|
101
|
+
|
|
102
|
+
# Decode a Base64 string
|
|
103
|
+
tde decode "aGVsbG8gd29ybGQ="
|
|
104
|
+
# Output: hello world
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### π URL-Safe Mode (`--url`)
|
|
108
|
+
|
|
109
|
+
Generate Base64 strings safe for web transit β replaces `+`/`/` with `-`/`_` and strips `=` padding. Perfect for **JWTs** and **URL parameters**.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
tde encode "https://example.com/api?token=abc" --url
|
|
113
|
+
# Output: aHR0cHM6Ly9leGFtcGxlLmNvbS9hcGk_dG9rZW49YWJj
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### π‘οΈ Strict Mode (`--strict`)
|
|
117
|
+
|
|
118
|
+
Forces the tool to **halt immediately** with a clear error if the input contains any non-Base64 characters.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
tde decode "aGVsbG8gd2!9ybGQ=" --strict
|
|
122
|
+
# Error: Strict mode: invalid Base64 character(s) found: '!'
|
|
123
|
+
# Hint: use --ignore-garbage to strip them automatically.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### π§Ή Ignore Garbage (`--ignore-garbage`)
|
|
127
|
+
|
|
128
|
+
Strips whitespace, newlines, and invalid characters before decoding β perfect for messy copy-paste inputs.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
tde decode "aGVsbG8 gd 29ybGQ=" --ignore-garbage
|
|
132
|
+
# Output: hello world
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### π File Operations
|
|
136
|
+
|
|
137
|
+
Read a payload from a file and write the decoded output to a new file:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Encode a file's contents
|
|
141
|
+
tde encode -i secret.txt -o encoded_payload.txt
|
|
142
|
+
|
|
143
|
+
# Decode back to original
|
|
144
|
+
tde decode -i encoded_payload.txt -o original.txt
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### π Piping Support
|
|
148
|
+
|
|
149
|
+
Chain TDE with other CLI tools:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Pipe from echo
|
|
153
|
+
echo "sensitive data" | tde encode
|
|
154
|
+
|
|
155
|
+
# Chain with curl
|
|
156
|
+
curl -s https://api.example.com/data | tde decode
|
|
157
|
+
|
|
158
|
+
# Pipe between TDE commands (round-trip)
|
|
159
|
+
echo "hello" | tde encode | tde decode
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### π Full Help Menu
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
tde --help
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
+========================================+
|
|
170
|
+
| TDE -- The Data Encoder / Decoder |
|
|
171
|
+
| v1.0.0 | Zero-dependency Base64 |
|
|
172
|
+
+========================================+
|
|
173
|
+
|
|
174
|
+
positional arguments:
|
|
175
|
+
{encode,decode} Operation to perform: 'encode' or 'decode'.
|
|
176
|
+
data Inline string payload (optional if using -i or stdin).
|
|
177
|
+
|
|
178
|
+
I/O options:
|
|
179
|
+
-i, --input FILE Read payload from FILE instead of stdin/args.
|
|
180
|
+
-o, --output FILE Write result to FILE instead of stdout.
|
|
181
|
+
|
|
182
|
+
Advanced modifiers:
|
|
183
|
+
--url Use URL-safe Base64 alphabet (- _ instead of + /).
|
|
184
|
+
--strict Halt with an error on any non-Base64 character.
|
|
185
|
+
--ignore-garbage Strip whitespace and invalid characters before decoding.
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## ποΈ Architecture
|
|
191
|
+
|
|
192
|
+
### High-Level Overview
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
196
|
+
β tde <command> [data] [flags] β
|
|
197
|
+
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
198
|
+
β
|
|
199
|
+
βΌ
|
|
200
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
201
|
+
β 1. ARGUMENT PARSER (argparse) β
|
|
202
|
+
β βββββββββββ βββββββββββ ββββββββββ βββββββββββββββββββ β
|
|
203
|
+
β β command β β data β β flags β β I/O options β β
|
|
204
|
+
β βencode/ β β(inline) β β--url β β -i input file β β
|
|
205
|
+
β βdecode β β β β--strictβ β -o output file β β
|
|
206
|
+
β ββββββ¬βββββ ββββββ¬βββββ βββββ¬βββββ ββββββββββ¬βββββββββ β
|
|
207
|
+
βββββββββΌβββββββββββββββΌββββββββββββΌβββββββββββββββββββΌβββββββββββββ
|
|
208
|
+
β β β β
|
|
209
|
+
βΌ βΌ β β
|
|
210
|
+
ββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββ
|
|
211
|
+
β 2. INPUT ROUTER β β β
|
|
212
|
+
β Priority Hierarchy: β β β
|
|
213
|
+
β ββββββββββββββββββββββββ β β β
|
|
214
|
+
β β 1. File (-i flag) ββββββββββΌβββββββββββββββββββ β
|
|
215
|
+
β β 2. Stdin (piped) β β β
|
|
216
|
+
β β 3. Arg (inline) β β β
|
|
217
|
+
β ββββββββββββ¬ββββββββββββ β β
|
|
218
|
+
βββββββββββββββΌβββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
|
|
219
|
+
β β
|
|
220
|
+
βΌ βΌ
|
|
221
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
222
|
+
β 3. PROCESSING CORE β
|
|
223
|
+
β β
|
|
224
|
+
β ββ ENCODE βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
225
|
+
β β input bytes βββΊ b64encode() βββΊ result β β
|
|
226
|
+
β β --url? βββΊ urlsafe_b64encode() βββΊ strip '=' pad β β
|
|
227
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
228
|
+
β β
|
|
229
|
+
β ββ DECODE βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
230
|
+
β β --strict? βββΊ regex validate βββΊ halt on bad β β
|
|
231
|
+
β β --ignore-garbage? βββΊ regex strip junk chars β β
|
|
232
|
+
β β --url? βββΊ restore padding βββΊ urlsafe_b64 β β
|
|
233
|
+
β β (default) βββΊ b64decode() βββΊ result β β
|
|
234
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
235
|
+
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
|
|
236
|
+
β
|
|
237
|
+
βΌ
|
|
238
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
239
|
+
β 4. OUTPUT ROUTER β
|
|
240
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
241
|
+
β β -o flag set? βββΊ Write bytes to file β β
|
|
242
|
+
β β (default) βββΊ Print to stdout β β
|
|
243
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
244
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Data Flow
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
User Input βββΊ Argument Parser βββΊ Input Router βββΊ Processing Core βββΊ Output Router
|
|
251
|
+
β β β β
|
|
252
|
+
Parse command Read from: Apply flags: Deliver to:
|
|
253
|
+
& flags β’ File (-i) β’ --url β’ File (-o)
|
|
254
|
+
β’ Stdin (pipe) β’ --strict β’ Stdout
|
|
255
|
+
β’ Inline arg β’ --ignore-garbage
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Module Structure
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
TDE-Tool/
|
|
262
|
+
βββ .gitignore # Git ignore rules
|
|
263
|
+
βββ LICENSE # MIT License
|
|
264
|
+
βββ README.md # This file
|
|
265
|
+
βββ setup.py # Installer with console_scripts entry point
|
|
266
|
+
βββ tde/ # Main package
|
|
267
|
+
βββ __init__.py # Version constant (__version__ = "1.0.0")
|
|
268
|
+
βββ cli.py # Complete CLI implementation
|
|
269
|
+
# βββ ANSI colour helpers
|
|
270
|
+
# βββ Banner & help formatter
|
|
271
|
+
# βββ _acquire_input() β Input Router
|
|
272
|
+
# βββ _encode() β Encoding engine
|
|
273
|
+
# βββ _decode() β Decoding engine
|
|
274
|
+
# βββ _emit() β Output Router
|
|
275
|
+
# βββ main() β Entry point
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## π§ CLI Reference
|
|
281
|
+
|
|
282
|
+
| Argument | Type | Description |
|
|
283
|
+
|---|---|---|
|
|
284
|
+
| `encode` | Command | Convert input to Base64 |
|
|
285
|
+
| `decode` | Command | Convert Base64 back to original |
|
|
286
|
+
| `<data>` | Positional | Inline string payload |
|
|
287
|
+
| `-i`, `--input` | Flag | Read payload from a file |
|
|
288
|
+
| `-o`, `--output` | Flag | Write result to a file |
|
|
289
|
+
| `-v`, `--version` | Flag | Show version (`TDE v1.0.0`) |
|
|
290
|
+
| `-h`, `--help` | Flag | Show help menu with examples |
|
|
291
|
+
| `--url` | Modifier | Use URL-safe Base64 alphabet |
|
|
292
|
+
| `--strict` | Modifier | Error on invalid characters |
|
|
293
|
+
| `--ignore-garbage` | Modifier | Strip invalid characters before decoding |
|
|
294
|
+
|
|
295
|
+
> β οΈ `--strict` and `--ignore-garbage` are **mutually exclusive** β they cannot be used together.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## π― Use Cases
|
|
300
|
+
|
|
301
|
+
| Scenario | Command |
|
|
302
|
+
|---|---|
|
|
303
|
+
| π Encode API keys for config files | `tde encode "sk-abc123secret"` |
|
|
304
|
+
| π Generate URL-safe JWT tokens | `tde encode "payload" --url` |
|
|
305
|
+
| π§ Decode email attachments | `tde decode -i attachment.b64 -o file.pdf` |
|
|
306
|
+
| π§ͺ Validate Base64 integrity | `tde decode "data..." --strict` |
|
|
307
|
+
| π Clean up messy copy-paste | `tde decode "broken data" --ignore-garbage` |
|
|
308
|
+
| π Round-trip verification | `echo "test" \| tde encode \| tde decode` |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## π€ Contributing
|
|
313
|
+
|
|
314
|
+
Contributions are welcome! Here's how you can help:
|
|
315
|
+
|
|
316
|
+
1. **Fork** the repository
|
|
317
|
+
2. **Create** a feature branch (`git checkout -b feature/awesome-feature`)
|
|
318
|
+
3. **Commit** your changes (`git commit -m "Add awesome feature"`)
|
|
319
|
+
4. **Push** to the branch (`git push origin feature/awesome-feature`)
|
|
320
|
+
5. **Open** a Pull Request
|
|
321
|
+
|
|
322
|
+
### Guidelines
|
|
323
|
+
|
|
324
|
+
- Use only Python standard library β **no external dependencies**
|
|
325
|
+
- Maintain cross-platform compatibility
|
|
326
|
+
- Add comments for complex logic
|
|
327
|
+
- Test on both Windows and Linux/macOS
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## π License
|
|
332
|
+
|
|
333
|
+
This project is licensed under the **MIT License** β see the [LICENSE](LICENSE) file for details.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## π€ Author
|
|
338
|
+
|
|
339
|
+
**Tanishq Zope** β [@tanishqzope](https://github.com/tanishqzope)
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
<p align="center">
|
|
344
|
+
<sub>Built with β€οΈ and pure Python. No dependencies were harmed in the making of this tool.</sub>
|
|
345
|
+
</p>
|
tde-1.0.0/README.md
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://img.shields.io/badge/TDE-v1.0.0-00C853?style=for-the-badge&logo=python&logoColor=white" alt="Version"/>
|
|
3
|
+
<img src="https://img.shields.io/badge/Python-3.7+-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python"/>
|
|
4
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"/>
|
|
5
|
+
<img src="https://img.shields.io/badge/Dependencies-Zero-success?style=for-the-badge" alt="Dependencies"/>
|
|
6
|
+
<img src="https://img.shields.io/badge/Platform-Win%20%7C%20Linux%20%7C%20macOS-blue?style=for-the-badge" alt="Platform"/>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<h1 align="center">π TDE β Tanishq's Decoder & Encoder</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>A fast, lightweight, dependency-free CLI tool for Base64 encoding & decoding.</strong><br/>
|
|
13
|
+
Built purely with Python's standard libraries β zero security overhead, absolute portability.
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="#-features">Features</a> β’
|
|
18
|
+
<a href="#-installation">Installation</a> β’
|
|
19
|
+
<a href="#-usage">Usage</a> β’
|
|
20
|
+
<a href="#%EF%B8%8F-architecture">Architecture</a> β’
|
|
21
|
+
<a href="#-contributing">Contributing</a> β’
|
|
22
|
+
<a href="#-license">License</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## β¨ Features
|
|
28
|
+
|
|
29
|
+
| Feature | Description |
|
|
30
|
+
|---|---|
|
|
31
|
+
| π« **Zero Dependencies** | Runs natively using only built-in Python libraries β nothing to install, nothing to break |
|
|
32
|
+
| π₯οΈ **Cross-Platform** | Works seamlessly on Command Prompt, PowerShell, Git Bash, WSL, and Linux/macOS terminals |
|
|
33
|
+
| π **File I/O** | Read from and write directly to files for handling large payloads or binaries |
|
|
34
|
+
| π **URL-Safe Mode** | Seamlessly handle JSON Web Tokens (JWTs) and URL parameters with `-` `_` alphabet |
|
|
35
|
+
| π‘οΈ **Strict Validation** | Catch malformed data streams instantly with `--strict` mode |
|
|
36
|
+
| π§Ή **Garbage Collection** | Force-decode messy inputs by stripping invalid characters automatically |
|
|
37
|
+
| π **Pipe Support** | Chain with other CLI tools via stdin/stdout piping |
|
|
38
|
+
| π¨ **Coloured Output** | ANSI colour support with automatic graceful degradation |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## π¦ Installation
|
|
43
|
+
|
|
44
|
+
> **Prerequisites:** Python 3.7 or higher
|
|
45
|
+
|
|
46
|
+
### Quick Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/tanishqzope/TDE-Tool.git
|
|
50
|
+
cd TDE-Tool
|
|
51
|
+
pip install .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Once installed, the `tde` command is globally available from **any terminal**.
|
|
55
|
+
|
|
56
|
+
### Verify Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
tde --version
|
|
60
|
+
# Output: TDE v1.0.0
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## π Usage
|
|
66
|
+
|
|
67
|
+
### Basic Encoding & Decoding
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Encode a string to Base64
|
|
71
|
+
tde encode "hello world"
|
|
72
|
+
# Output: aGVsbG8gd29ybGQ=
|
|
73
|
+
|
|
74
|
+
# Decode a Base64 string
|
|
75
|
+
tde decode "aGVsbG8gd29ybGQ="
|
|
76
|
+
# Output: hello world
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### π URL-Safe Mode (`--url`)
|
|
80
|
+
|
|
81
|
+
Generate Base64 strings safe for web transit β replaces `+`/`/` with `-`/`_` and strips `=` padding. Perfect for **JWTs** and **URL parameters**.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
tde encode "https://example.com/api?token=abc" --url
|
|
85
|
+
# Output: aHR0cHM6Ly9leGFtcGxlLmNvbS9hcGk_dG9rZW49YWJj
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### π‘οΈ Strict Mode (`--strict`)
|
|
89
|
+
|
|
90
|
+
Forces the tool to **halt immediately** with a clear error if the input contains any non-Base64 characters.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
tde decode "aGVsbG8gd2!9ybGQ=" --strict
|
|
94
|
+
# Error: Strict mode: invalid Base64 character(s) found: '!'
|
|
95
|
+
# Hint: use --ignore-garbage to strip them automatically.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### π§Ή Ignore Garbage (`--ignore-garbage`)
|
|
99
|
+
|
|
100
|
+
Strips whitespace, newlines, and invalid characters before decoding β perfect for messy copy-paste inputs.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
tde decode "aGVsbG8 gd 29ybGQ=" --ignore-garbage
|
|
104
|
+
# Output: hello world
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### π File Operations
|
|
108
|
+
|
|
109
|
+
Read a payload from a file and write the decoded output to a new file:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Encode a file's contents
|
|
113
|
+
tde encode -i secret.txt -o encoded_payload.txt
|
|
114
|
+
|
|
115
|
+
# Decode back to original
|
|
116
|
+
tde decode -i encoded_payload.txt -o original.txt
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### π Piping Support
|
|
120
|
+
|
|
121
|
+
Chain TDE with other CLI tools:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Pipe from echo
|
|
125
|
+
echo "sensitive data" | tde encode
|
|
126
|
+
|
|
127
|
+
# Chain with curl
|
|
128
|
+
curl -s https://api.example.com/data | tde decode
|
|
129
|
+
|
|
130
|
+
# Pipe between TDE commands (round-trip)
|
|
131
|
+
echo "hello" | tde encode | tde decode
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### π Full Help Menu
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
tde --help
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
+========================================+
|
|
142
|
+
| TDE -- The Data Encoder / Decoder |
|
|
143
|
+
| v1.0.0 | Zero-dependency Base64 |
|
|
144
|
+
+========================================+
|
|
145
|
+
|
|
146
|
+
positional arguments:
|
|
147
|
+
{encode,decode} Operation to perform: 'encode' or 'decode'.
|
|
148
|
+
data Inline string payload (optional if using -i or stdin).
|
|
149
|
+
|
|
150
|
+
I/O options:
|
|
151
|
+
-i, --input FILE Read payload from FILE instead of stdin/args.
|
|
152
|
+
-o, --output FILE Write result to FILE instead of stdout.
|
|
153
|
+
|
|
154
|
+
Advanced modifiers:
|
|
155
|
+
--url Use URL-safe Base64 alphabet (- _ instead of + /).
|
|
156
|
+
--strict Halt with an error on any non-Base64 character.
|
|
157
|
+
--ignore-garbage Strip whitespace and invalid characters before decoding.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## ποΈ Architecture
|
|
163
|
+
|
|
164
|
+
### High-Level Overview
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
168
|
+
β tde <command> [data] [flags] β
|
|
169
|
+
ββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
170
|
+
β
|
|
171
|
+
βΌ
|
|
172
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
173
|
+
β 1. ARGUMENT PARSER (argparse) β
|
|
174
|
+
β βββββββββββ βββββββββββ ββββββββββ βββββββββββββββββββ β
|
|
175
|
+
β β command β β data β β flags β β I/O options β β
|
|
176
|
+
β βencode/ β β(inline) β β--url β β -i input file β β
|
|
177
|
+
β βdecode β β β β--strictβ β -o output file β β
|
|
178
|
+
β ββββββ¬βββββ ββββββ¬βββββ βββββ¬βββββ ββββββββββ¬βββββββββ β
|
|
179
|
+
βββββββββΌβββββββββββββββΌββββββββββββΌβββββββββββββββββββΌβββββββββββββ
|
|
180
|
+
β β β β
|
|
181
|
+
βΌ βΌ β β
|
|
182
|
+
ββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββ
|
|
183
|
+
β 2. INPUT ROUTER β β β
|
|
184
|
+
β Priority Hierarchy: β β β
|
|
185
|
+
β ββββββββββββββββββββββββ β β β
|
|
186
|
+
β β 1. File (-i flag) ββββββββββΌβββββββββββββββββββ β
|
|
187
|
+
β β 2. Stdin (piped) β β β
|
|
188
|
+
β β 3. Arg (inline) β β β
|
|
189
|
+
β ββββββββββββ¬ββββββββββββ β β
|
|
190
|
+
βββββββββββββββΌβββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
|
|
191
|
+
β β
|
|
192
|
+
βΌ βΌ
|
|
193
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
194
|
+
β 3. PROCESSING CORE β
|
|
195
|
+
β β
|
|
196
|
+
β ββ ENCODE βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
197
|
+
β β input bytes βββΊ b64encode() βββΊ result β β
|
|
198
|
+
β β --url? βββΊ urlsafe_b64encode() βββΊ strip '=' pad β β
|
|
199
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
200
|
+
β β
|
|
201
|
+
β ββ DECODE βββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
202
|
+
β β --strict? βββΊ regex validate βββΊ halt on bad β β
|
|
203
|
+
β β --ignore-garbage? βββΊ regex strip junk chars β β
|
|
204
|
+
β β --url? βββΊ restore padding βββΊ urlsafe_b64 β β
|
|
205
|
+
β β (default) βββΊ b64decode() βββΊ result β β
|
|
206
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
207
|
+
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββ
|
|
208
|
+
β
|
|
209
|
+
βΌ
|
|
210
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
211
|
+
β 4. OUTPUT ROUTER β
|
|
212
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
213
|
+
β β -o flag set? βββΊ Write bytes to file β β
|
|
214
|
+
β β (default) βββΊ Print to stdout β β
|
|
215
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
216
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Data Flow
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
User Input βββΊ Argument Parser βββΊ Input Router βββΊ Processing Core βββΊ Output Router
|
|
223
|
+
β β β β
|
|
224
|
+
Parse command Read from: Apply flags: Deliver to:
|
|
225
|
+
& flags β’ File (-i) β’ --url β’ File (-o)
|
|
226
|
+
β’ Stdin (pipe) β’ --strict β’ Stdout
|
|
227
|
+
β’ Inline arg β’ --ignore-garbage
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Module Structure
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
TDE-Tool/
|
|
234
|
+
βββ .gitignore # Git ignore rules
|
|
235
|
+
βββ LICENSE # MIT License
|
|
236
|
+
βββ README.md # This file
|
|
237
|
+
βββ setup.py # Installer with console_scripts entry point
|
|
238
|
+
βββ tde/ # Main package
|
|
239
|
+
βββ __init__.py # Version constant (__version__ = "1.0.0")
|
|
240
|
+
βββ cli.py # Complete CLI implementation
|
|
241
|
+
# βββ ANSI colour helpers
|
|
242
|
+
# βββ Banner & help formatter
|
|
243
|
+
# βββ _acquire_input() β Input Router
|
|
244
|
+
# βββ _encode() β Encoding engine
|
|
245
|
+
# βββ _decode() β Decoding engine
|
|
246
|
+
# βββ _emit() β Output Router
|
|
247
|
+
# βββ main() β Entry point
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## π§ CLI Reference
|
|
253
|
+
|
|
254
|
+
| Argument | Type | Description |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| `encode` | Command | Convert input to Base64 |
|
|
257
|
+
| `decode` | Command | Convert Base64 back to original |
|
|
258
|
+
| `<data>` | Positional | Inline string payload |
|
|
259
|
+
| `-i`, `--input` | Flag | Read payload from a file |
|
|
260
|
+
| `-o`, `--output` | Flag | Write result to a file |
|
|
261
|
+
| `-v`, `--version` | Flag | Show version (`TDE v1.0.0`) |
|
|
262
|
+
| `-h`, `--help` | Flag | Show help menu with examples |
|
|
263
|
+
| `--url` | Modifier | Use URL-safe Base64 alphabet |
|
|
264
|
+
| `--strict` | Modifier | Error on invalid characters |
|
|
265
|
+
| `--ignore-garbage` | Modifier | Strip invalid characters before decoding |
|
|
266
|
+
|
|
267
|
+
> β οΈ `--strict` and `--ignore-garbage` are **mutually exclusive** β they cannot be used together.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## π― Use Cases
|
|
272
|
+
|
|
273
|
+
| Scenario | Command |
|
|
274
|
+
|---|---|
|
|
275
|
+
| π Encode API keys for config files | `tde encode "sk-abc123secret"` |
|
|
276
|
+
| π Generate URL-safe JWT tokens | `tde encode "payload" --url` |
|
|
277
|
+
| π§ Decode email attachments | `tde decode -i attachment.b64 -o file.pdf` |
|
|
278
|
+
| π§ͺ Validate Base64 integrity | `tde decode "data..." --strict` |
|
|
279
|
+
| π Clean up messy copy-paste | `tde decode "broken data" --ignore-garbage` |
|
|
280
|
+
| π Round-trip verification | `echo "test" \| tde encode \| tde decode` |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## π€ Contributing
|
|
285
|
+
|
|
286
|
+
Contributions are welcome! Here's how you can help:
|
|
287
|
+
|
|
288
|
+
1. **Fork** the repository
|
|
289
|
+
2. **Create** a feature branch (`git checkout -b feature/awesome-feature`)
|
|
290
|
+
3. **Commit** your changes (`git commit -m "Add awesome feature"`)
|
|
291
|
+
4. **Push** to the branch (`git push origin feature/awesome-feature`)
|
|
292
|
+
5. **Open** a Pull Request
|
|
293
|
+
|
|
294
|
+
### Guidelines
|
|
295
|
+
|
|
296
|
+
- Use only Python standard library β **no external dependencies**
|
|
297
|
+
- Maintain cross-platform compatibility
|
|
298
|
+
- Add comments for complex logic
|
|
299
|
+
- Test on both Windows and Linux/macOS
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## π License
|
|
304
|
+
|
|
305
|
+
This project is licensed under the **MIT License** β see the [LICENSE](LICENSE) file for details.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## π€ Author
|
|
310
|
+
|
|
311
|
+
**Tanishq Zope** β [@tanishqzope](https://github.com/tanishqzope)
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
<p align="center">
|
|
316
|
+
<sub>Built with β€οΈ and pure Python. No dependencies were harmed in the making of this tool.</sub>
|
|
317
|
+
</p>
|