Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeatReq | Extend webcrack instance #48

Open
gokaybiz opened this issue Jan 8, 2024 · 3 comments · May be fixed by #51
Open

FeatReq | Extend webcrack instance #48

gokaybiz opened this issue Jan 8, 2024 · 3 comments · May be fixed by #51
Labels
enhancement New feature or request

Comments

@gokaybiz
Copy link

gokaybiz commented Jan 8, 2024

It'd be great If we can extend rules/scripts. Depends on choice, before or after deobfuscation.

For example:

import {
    webcrack
} from 'webcrack';

const result = await webcrack(input);
result.code.extend(async ({
    types
}) => {
    Identifier(path) {
        //....
    }
});
console.log(result.code)
@gokaybiz gokaybiz added the enhancement New feature or request label Jan 8, 2024
@gokaybiz gokaybiz changed the title Extend webcrack instance FeatReq | Extend webcrack instance Jan 8, 2024
@j4k0xb
Copy link
Owner

j4k0xb commented Jan 9, 2024

Sounds like a good idea
I'd rather pass them as options so it works with async and can edit the AST directly instead of having to parse/generate result.code again
And also change the format to be compatible with babel plugins (https://babeljs.io/docs/plugins#plugin-development)

How about such an API?

function myPlugin({ types }) {
  return {
    runAfter: 'deobfuscate', // 'parse' | 'prepare' | 'unminify' | 'deobfuscate' | 'unpack'
    visitor: {
      Identifier(path) {}
    },
  };
}

const result = await webcrack(input, { plugins: [myPlugin] });
console.log(result.code);

@0xdevalias
Copy link

And also change the format to be compatible with babel plugins

I 🖤 that idea!

@gokaybiz
Copy link
Author

Sounds like a good idea I'd rather pass them as options so it works with async and can edit the AST directly instead of having to parse/generate result.code again And also change the format to be compatible with babel plugins (https://babeljs.io/docs/plugins#plugin-development)

How about such an API?

function myPlugin({ types }) {
  return {
    runAfter: 'deobfuscate', // 'parse' | 'prepare' | 'unminify' | 'deobfuscate' | 'unpack'
    visitor: {
      Identifier(path) {}
    },
  };
}

const result = await webcrack(input, { plugins: [myPlugin] });
console.log(result.code);

Great!

@j4k0xb j4k0xb linked a pull request Jan 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants