@kakuzu_aon/apkz 1.0.0

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.
@@ -0,0 +1,343 @@
1
+ // ────────────[ KAKUZU ]────────────────────────────
2
+ // | Discord : kakuzu_aon
3
+ // | Telegram : kakuzu_aon
4
+ // | Github : kakuzu-aon
5
+ // | File : config.js
6
+ // | License : MIT License © 2026 Kakuzu
7
+ // | Brief : Configuration management command
8
+ // ────────────────★─────────────────────────────────
9
+
10
+ const { Command } = require('commander');
11
+ const chalk = require('chalk').default;
12
+ const { default: ora } = require('ora');
13
+ const fs = require('fs-extra');
14
+ const path = require('path');
15
+ const ConfigManager = require('../utils/config');
16
+
17
+ const configCommand = new Command('config')
18
+ .description('Manage APKZ configuration settings')
19
+ .addHelpCommand(true)
20
+ .addCommand(new Command('show')
21
+ .description('Show current configuration')
22
+ .option('-j, --json', 'Output as JSON')
23
+ .option('-s, --summary', 'Show configuration summary')
24
+ .action(async (options) => {
25
+ try {
26
+ const config = new ConfigManager();
27
+ await config.initialize();
28
+
29
+ if (options.summary) {
30
+ const summary = config.getSummary();
31
+
32
+ console.log(chalk.bold('📋 Configuration Summary:'));
33
+ console.log(chalk.gray('─'.repeat(40)));
34
+ console.log(chalk.cyan(`Version: ${summary.version}`));
35
+ console.log(chalk.cyan(`Log Level: ${summary.logLevel}`));
36
+ console.log(chalk.cyan(`Web Port: ${summary.webPort}`));
37
+ console.log(chalk.cyan(`Parallel Processing: ${summary.parallelProcessing}`));
38
+ console.log(chalk.cyan(`Security Level: ${summary.securityLevel}`));
39
+ console.log(chalk.cyan(`Plugins Enabled: ${summary.pluginsEnabled}`));
40
+ console.log(chalk.cyan(`Theme: ${summary.theme}`));
41
+ console.log(chalk.cyan(`Cache Enabled: ${summary.cacheEnabled}`));
42
+
43
+ } else if (options.json) {
44
+ console.log(config.toJSON());
45
+
46
+ } else {
47
+ console.log(chalk.bold('⚙️ Current Configuration:'));
48
+ console.log(chalk.gray('─'.repeat(50)));
49
+ console.log(config.toJSON());
50
+ }
51
+
52
+ } catch (error) {
53
+ console.error(chalk.red('🔴 Error:'), error.message);
54
+ process.exit(1);
55
+ }
56
+ }))
57
+ .addCommand(new Command('get <key>')
58
+ .description('Get a configuration value')
59
+ .action(async (key) => {
60
+ try {
61
+ const config = new ConfigManager();
62
+ await config.initialize();
63
+
64
+ const value = config.get(key);
65
+
66
+ if (value === null) {
67
+ console.log(chalk.yellow(`⚠️ Configuration key not found: ${key}`));
68
+ return;
69
+ }
70
+
71
+ console.log(chalk.cyan(`📋 ${key}:`));
72
+ if (typeof value === 'object') {
73
+ console.log(JSON.stringify(value, null, 2));
74
+ } else {
75
+ console.log(value);
76
+ }
77
+
78
+ } catch (error) {
79
+ console.error(chalk.red('🔴 Error:'), error.message);
80
+ process.exit(1);
81
+ }
82
+ }))
83
+ .addCommand(new Command('set <key> <value>')
84
+ .description('Set a configuration value')
85
+ .option('-t, --type <type>', 'Value type (string, number, boolean, json)', 'string')
86
+ .action(async (key, value, options) => {
87
+ try {
88
+ const config = new ConfigManager();
89
+ await config.initialize();
90
+
91
+ // Convert value based on type
92
+ let parsedValue = value;
93
+
94
+ switch (options.type) {
95
+ case 'number':
96
+ parsedValue = parseFloat(value);
97
+ if (isNaN(parsedValue)) {
98
+ throw new Error('Invalid number value');
99
+ }
100
+ break;
101
+ case 'boolean':
102
+ parsedValue = value.toLowerCase() === 'true';
103
+ break;
104
+ case 'json':
105
+ try {
106
+ parsedValue = JSON.parse(value);
107
+ } catch (e) {
108
+ throw new Error('Invalid JSON value');
109
+ }
110
+ break;
111
+ }
112
+
113
+ config.set(key, parsedValue);
114
+ await config.saveConfig();
115
+
116
+ console.log(chalk.green(`✅ Set ${key} = ${JSON.stringify(parsedValue)}`));
117
+
118
+ } catch (error) {
119
+ console.error(chalk.red('🔴 Error:'), error.message);
120
+ process.exit(1);
121
+ }
122
+ }))
123
+ .addCommand(new Command('delete <key>')
124
+ .description('Delete a configuration key')
125
+ .action(async (key) => {
126
+ try {
127
+ const config = new ConfigManager();
128
+ await config.initialize();
129
+
130
+ const currentValue = config.get(key);
131
+ if (currentValue === null) {
132
+ console.log(chalk.yellow(`⚠️ Configuration key not found: ${key}`));
133
+ return;
134
+ }
135
+
136
+ config.delete(key);
137
+ await config.saveConfig();
138
+
139
+ console.log(chalk.green(`✅ Deleted configuration key: ${key}`));
140
+
141
+ } catch (error) {
142
+ console.error(chalk.red('🔴 Error:'), error.message);
143
+ process.exit(1);
144
+ }
145
+ }))
146
+ .addCommand(new Command('reset')
147
+ .description('Reset configuration to defaults')
148
+ .option('-f, --force', 'Force reset without confirmation')
149
+ .action(async (options) => {
150
+ try {
151
+ if (!options.force) {
152
+ const inquirer = require('inquirer');
153
+ const { confirm } = await inquirer.prompt([
154
+ {
155
+ type: 'confirm',
156
+ name: 'confirm',
157
+ message: 'Are you sure you want to reset all configuration to defaults?',
158
+ default: false
159
+ }
160
+ ]);
161
+
162
+ if (!confirm) {
163
+ console.log(chalk.yellow('⚠️ Reset cancelled'));
164
+ return;
165
+ }
166
+ }
167
+
168
+ const config = new ConfigManager();
169
+ await config.initialize();
170
+
171
+ const spinner = ora('🔄 Resetting configuration...').start();
172
+
173
+ await config.reset();
174
+
175
+ spinner.succeed('Configuration reset to defaults');
176
+
177
+ } catch (error) {
178
+ console.error(chalk.red('🔴 Error:'), error.message);
179
+ process.exit(1);
180
+ }
181
+ }))
182
+ .addCommand(new Command('export <file>')
183
+ .description('Export configuration to file')
184
+ .action(async (filePath) => {
185
+ try {
186
+ const config = new ConfigManager();
187
+ await config.initialize();
188
+
189
+ const spinner = ora('📤 Exporting configuration...').start();
190
+
191
+ await config.export(filePath);
192
+
193
+ spinner.succeed(`Configuration exported to: ${filePath}`);
194
+
195
+ } catch (error) {
196
+ console.error(chalk.red('🔴 Error:'), error.message);
197
+ process.exit(1);
198
+ }
199
+ }))
200
+ .addCommand(new Command('import <file>')
201
+ .description('Import configuration from file')
202
+ .option('-m, --merge', 'Merge with existing configuration instead of replacing')
203
+ .action(async (filePath, options) => {
204
+ try {
205
+ if (!fs.existsSync(filePath)) {
206
+ console.error(chalk.red(`🔴 Configuration file not found: ${filePath}`));
207
+ process.exit(1);
208
+ }
209
+
210
+ const config = new ConfigManager();
211
+ await config.initialize();
212
+
213
+ const spinner = ora('📥 Importing configuration...').start();
214
+
215
+ if (options.merge) {
216
+ // Merge logic would go here
217
+ console.log(chalk.yellow('⚠️ Merge mode not yet implemented, using replace'));
218
+ }
219
+
220
+ await config.import(filePath);
221
+
222
+ spinner.succeed(`Configuration imported from: ${filePath}`);
223
+
224
+ } catch (error) {
225
+ console.error(chalk.red('🔴 Error:'), error.message);
226
+ process.exit(1);
227
+ }
228
+ }))
229
+ .addCommand(new Command('backup')
230
+ .description('Create configuration backup')
231
+ .action(async () => {
232
+ try {
233
+ const config = new ConfigManager();
234
+ await config.initialize();
235
+
236
+ const spinner = ora('💾 Creating backup...').start();
237
+
238
+ const backupPath = await config.createBackup();
239
+
240
+ spinner.succeed(`Backup created: ${backupPath}`);
241
+
242
+ } catch (error) {
243
+ console.error(chalk.red('🔴 Error:'), error.message);
244
+ process.exit(1);
245
+ }
246
+ }))
247
+ .addCommand(new Command('restore <backup>')
248
+ .description('Restore configuration from backup')
249
+ .action(async (backupFile) => {
250
+ try {
251
+ const config = new ConfigManager();
252
+ await config.initialize();
253
+
254
+ const spinner = ora('🔄 Restoring backup...').start();
255
+
256
+ await config.restoreBackup(backupFile);
257
+
258
+ spinner.succeed(`Configuration restored from: ${backupFile}`);
259
+
260
+ } catch (error) {
261
+ console.error(chalk.red('🔴 Error:'), error.message);
262
+ process.exit(1);
263
+ }
264
+ }))
265
+ .addCommand(new Command('list-backups')
266
+ .description('List available configuration backups')
267
+ .action(async () => {
268
+ try {
269
+ const config = new ConfigManager();
270
+ await config.initialize();
271
+
272
+ const backups = await config.listBackups();
273
+
274
+ if (backups.length === 0) {
275
+ console.log(chalk.yellow('⚠️ No configuration backups found'));
276
+ return;
277
+ }
278
+
279
+ console.log(chalk.bold('💾 Available Backups:'));
280
+ console.log(chalk.gray('─'.repeat(60)));
281
+
282
+ for (const backup of backups) {
283
+ console.log(chalk.cyan(`📦 ${backup.name}`));
284
+ console.log(chalk.gray(` Size: ${backup.size} bytes`));
285
+ console.log(chalk.gray(` Created: ${backup.created.toLocaleString()}`));
286
+ console.log(chalk.gray(` Path: ${backup.path}`));
287
+ console.log();
288
+ }
289
+
290
+ } catch (error) {
291
+ console.error(chalk.red('🔴 Error:'), error.message);
292
+ process.exit(1);
293
+ }
294
+ }))
295
+ .addCommand(new Command('features')
296
+ .description('Show enabled/disabled features')
297
+ .action(async () => {
298
+ try {
299
+ const config = new ConfigManager();
300
+ await config.initialize();
301
+
302
+ const features = [
303
+ 'web', 'batch', 'monitoring', 'plugins', 'caching',
304
+ 'animations', 'colors', 'progressBars', 'autoBackup',
305
+ 'autoCleanup', 'webhook'
306
+ ];
307
+
308
+ console.log(chalk.bold('🚀 Feature Status:'));
309
+ console.log(chalk.gray('─'.repeat(40)));
310
+
311
+ for (const feature of features) {
312
+ const enabled = config.isFeatureEnabled(feature);
313
+ const icon = enabled ? '✅' : '❌';
314
+ const color = enabled ? chalk.green : chalk.red;
315
+ console.log(`${color(icon)} ${feature.padEnd(15)} ${enabled ? 'Enabled' : 'Disabled'}`);
316
+ }
317
+
318
+ } catch (error) {
319
+ console.error(chalk.red('🔴 Error:'), error.message);
320
+ process.exit(1);
321
+ }
322
+ }))
323
+ .addCommand(new Command('validate')
324
+ .description('Validate current configuration')
325
+ .action(async () => {
326
+ try {
327
+ const config = new ConfigManager();
328
+ await config.initialize();
329
+
330
+ const spinner = ora('🔍 Validating configuration...').start();
331
+
332
+ // Validation is done during initialization
333
+ spinner.succeed('Configuration is valid');
334
+
335
+ console.log(chalk.green('✅ All configuration values are valid'));
336
+
337
+ } catch (error) {
338
+ console.error(chalk.red('🔴 Error:'), error.message);
339
+ process.exit(1);
340
+ }
341
+ }));
342
+
343
+ module.exports = configCommand;
@@ -0,0 +1,133 @@
1
+ // ────────────[ KAKUZU ]────────────────────────────
2
+ // | Discord : kakuzu_aon
3
+ // | Telegram : kakuzu_aon
4
+ // | Github : kakuzu-aon
5
+ // | File : decode.js
6
+ // | License : MIT License © 2026 Kakuzu
7
+ // | Brief : APK decode command implementation
8
+ // ────────────────★─────────────────────────────────
9
+
10
+ const { Command } = require('commander');
11
+ const chalk = require('chalk').default;
12
+ const { default: ora } = require('ora');
13
+ const fs = require('fs-extra');
14
+ const path = require('path');
15
+ const AdmZip = require('adm-zip');
16
+ const cliProgress = require('cli-progress');
17
+
18
+ const decodeCommand = new Command('decode')
19
+ .description('Decode APK resources and extract contents')
20
+ .argument('<apk-file>', 'APK file to decode')
21
+ .option('-o, --output <dir>', 'Output directory', './decoded')
22
+ .option('-f, --force', 'Overwrite existing output directory')
23
+ .option('--no-resources', 'Skip resource decoding')
24
+ .option('--no-dex', 'Skip DEX file extraction')
25
+ .action(async (apkFile, options) => {
26
+ let spinner;
27
+ try {
28
+ if (!fs.existsSync(apkFile)) {
29
+ console.error(chalk.red(`🔴 Error: APK file not found: ${apkFile}`));
30
+ process.exit(1);
31
+ }
32
+
33
+ const outputDir = path.resolve(options.output);
34
+
35
+ if (fs.existsSync(outputDir) && !options.force) {
36
+ console.error(chalk.red(`🔴 Error: Output directory exists: ${outputDir}`));
37
+ console.error(chalk.yellow('💡 Use --force to overwrite'));
38
+ process.exit(1);
39
+ }
40
+
41
+ spinner = ora('🔧 Preparing to decode APK...').start();
42
+
43
+ await decodeAPK(apkFile, outputDir, options);
44
+
45
+ spinner.succeed('APK decoded successfully!');
46
+
47
+ console.log(chalk.green(`✅ Decoded APK to: ${outputDir}`));
48
+
49
+ } catch (error) {
50
+ if (spinner) spinner.fail('Decoding failed');
51
+ console.error(chalk.red('🔴 Error:'), error.message);
52
+ process.exit(1);
53
+ }
54
+ });
55
+
56
+ async function decodeAPK(apkPath, outputDir, options) {
57
+ const zip = new AdmZip(apkPath);
58
+ const entries = zip.getEntries();
59
+
60
+ // Create output directory
61
+ await fs.ensureDir(outputDir);
62
+
63
+ const progressBar = new cliProgress.SingleBar({
64
+ format: chalk.cyan('📦 Extracting') + ' |{bar}| |{percentage}%| |{value}/{total}| files',
65
+ barCompleteChar: '█',
66
+ barIncompleteChar: '░',
67
+ hideCursor: true
68
+ });
69
+
70
+ progressBar.start(entries.length, 0);
71
+
72
+ let processed = 0;
73
+
74
+ for (const entry of entries) {
75
+ const entryPath = path.join(outputDir, entry.entryName);
76
+
77
+ try {
78
+ if (entry.isDirectory) {
79
+ await fs.ensureDir(entryPath);
80
+ } else {
81
+ // Skip certain files based on options
82
+ if (!options.dex && entry.entryName.endsWith('.dex')) {
83
+ processed++;
84
+ progressBar.update(processed);
85
+ continue;
86
+ }
87
+
88
+ if (!options.resources && entry.entryName === 'resources.arsc') {
89
+ processed++;
90
+ progressBar.update(processed);
91
+ continue;
92
+ }
93
+
94
+ await fs.ensureDir(path.dirname(entryPath));
95
+ await fs.writeFile(entryPath, entry.getData());
96
+ }
97
+ } catch (error) {
98
+ console.warn(chalk.yellow(`⚠️ Warning: Could not extract ${entry.entryName}: ${error.message}`));
99
+ }
100
+
101
+ processed++;
102
+ progressBar.update(processed);
103
+ }
104
+
105
+ progressBar.stop();
106
+
107
+ // Create info file
108
+ const info = {
109
+ decoded_at: new Date().toISOString(),
110
+ source_apk: path.resolve(apkPath),
111
+ total_files: entries.length,
112
+ extracted_files: processed,
113
+ options: options
114
+ };
115
+
116
+ await fs.writeJson(path.join(outputDir, 'decode_info.json'), info, { spaces: 2 });
117
+
118
+ // Display summary
119
+ console.log(chalk.bold('\n📊 Decode Summary:'));
120
+ console.log(chalk.gray(` • Total files: ${entries.length}`));
121
+ console.log(chalk.gray(` • Extracted: ${processed}`));
122
+ console.log(chalk.gray(` • Output: ${outputDir}`));
123
+
124
+ if (!options.dex) {
125
+ console.log(chalk.yellow(' ⚠️ DEX files skipped'));
126
+ }
127
+
128
+ if (!options.resources) {
129
+ console.log(chalk.yellow(' ⚠️ Resources skipped'));
130
+ }
131
+ }
132
+
133
+ module.exports = decodeCommand;