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 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>