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 () => {
|
const { extractSecrets } = require('./crunchys');
|
||||||
await extractSecrets();
|
|
||||||
})();
|
extractSecrets();
|
||||||
|
|||||||
+5
-4
@@ -25,9 +25,7 @@ const downloadLatestApk = async () => {
|
|||||||
const decompileApk = (apkPath) => {
|
const decompileApk = (apkPath) => {
|
||||||
try {
|
try {
|
||||||
execSync(`jadx ${apkPath}`, { stdio: 'inherit' });
|
execSync(`jadx ${apkPath}`, { stdio: 'inherit' });
|
||||||
} catch (error) {
|
} catch (error) {}
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
return apkPath.replace('.xapk', '');
|
return apkPath.replace('.xapk', '');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +62,7 @@ const parseSecrets = (contents) => {
|
|||||||
return { id, secret, encoded, header };
|
return { id, secret, encoded, header };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const extractSecrets = async ({ cleanup = true } = {}) => {
|
const extractSecrets = async ({ cleanup = true } = {}) => {
|
||||||
console.log('Downloading latest APK...');
|
console.log('Downloading latest APK...');
|
||||||
const apkPath = await downloadLatestApk();
|
const apkPath = await downloadLatestApk();
|
||||||
|
|
||||||
@@ -74,6 +72,7 @@ export const extractSecrets = async ({ cleanup = true } = {}) => {
|
|||||||
console.log('Searching for secrets...');
|
console.log('Searching for secrets...');
|
||||||
const sourcesDir = join(decompiledDir, 'sources');
|
const sourcesDir = join(decompiledDir, 'sources');
|
||||||
const configurationImpl = await findConfigurationImpl(sourcesDir);
|
const configurationImpl = await findConfigurationImpl(sourcesDir);
|
||||||
|
if (!configurationImpl) return console.error('Could not find ConfigurationImpl.kt');
|
||||||
|
|
||||||
console.log('Parsing secrets...');
|
console.log('Parsing secrets...');
|
||||||
const { id, secret, encoded, header } = parseSecrets(configurationImpl);
|
const { id, secret, encoded, header } = parseSecrets(configurationImpl);
|
||||||
@@ -88,3 +87,5 @@ export const extractSecrets = async ({ cleanup = true } = {}) => {
|
|||||||
|
|
||||||
return { id, secret, encoded, header };
|
return { id, secret, encoded, header };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = { extractSecrets };
|
||||||
|
|||||||
+2
-1
@@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "crunchys",
|
"name": "crunchys",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "A utility to extract secrets from Crunchyroll mobile app",
|
"description": "A utility to extract secrets from Crunchyroll mobile app",
|
||||||
"main": "crunchys.js",
|
"main": "crunchys.js",
|
||||||
"types": "crunchys.d.ts",
|
"types": "crunchys.d.ts",
|
||||||
"bin": "crunchys-cli.js",
|
"bin": "crunchys-cli.js",
|
||||||
|
"type": "commonjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user