mirror of
https://github.com/vitalygashkov/crextractor.git
synced 2026-07-15 17:40:03 +02:00
fix: add cli shebang, improve cjs compatibility, exit if target source not found
This commit is contained in:
Regular → Executable
+4
-4
@@ -1,5 +1,5 @@
|
||||
import { extractSecrets } from './crunchys';
|
||||
#!/usr/bin/env node
|
||||
|
||||
(async () => {
|
||||
await extractSecrets();
|
||||
})();
|
||||
const { extractSecrets } = require('./crunchys');
|
||||
|
||||
extractSecrets();
|
||||
|
||||
+5
-4
@@ -25,9 +25,7 @@ const downloadLatestApk = async () => {
|
||||
const decompileApk = (apkPath) => {
|
||||
try {
|
||||
execSync(`jadx ${apkPath}`, { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
} catch (error) {}
|
||||
return apkPath.replace('.xapk', '');
|
||||
};
|
||||
|
||||
@@ -64,7 +62,7 @@ const parseSecrets = (contents) => {
|
||||
return { id, secret, encoded, header };
|
||||
};
|
||||
|
||||
export const extractSecrets = async ({ cleanup = true } = {}) => {
|
||||
const extractSecrets = async ({ cleanup = true } = {}) => {
|
||||
console.log('Downloading latest APK...');
|
||||
const apkPath = await downloadLatestApk();
|
||||
|
||||
@@ -74,6 +72,7 @@ export const extractSecrets = async ({ cleanup = true } = {}) => {
|
||||
console.log('Searching for secrets...');
|
||||
const sourcesDir = join(decompiledDir, 'sources');
|
||||
const configurationImpl = await findConfigurationImpl(sourcesDir);
|
||||
if (!configurationImpl) return console.error('Could not find ConfigurationImpl.kt');
|
||||
|
||||
console.log('Parsing secrets...');
|
||||
const { id, secret, encoded, header } = parseSecrets(configurationImpl);
|
||||
@@ -88,3 +87,5 @@ export const extractSecrets = async ({ cleanup = true } = {}) => {
|
||||
|
||||
return { id, secret, encoded, header };
|
||||
};
|
||||
|
||||
module.exports = { extractSecrets };
|
||||
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "crunchys",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "A utility to extract secrets from Crunchyroll mobile app",
|
||||
"main": "crunchys.js",
|
||||
"types": "crunchys.d.ts",
|
||||
"bin": "crunchys-cli.js",
|
||||
"type": "commonjs",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user