-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add progress bar #97
base: master
Are you sure you want to change the base?
Add progress bar #97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This could be implemented using the var outputObject = await JsConfuser.debugObfuscation(
CODE,
{
target: "node",
preset: "high"
},
(transformName, index, totalTransforms) => {
console.log(transformName + " is done!", index, "/", totalTransforms);
},
require("perf_hooks").performance
);
var output: string = outputObject.obfuscated; // The obfuscated code
console.log(outputObject.transformationTimes); // Object of transformation times
/*
Preparation is done! 1 / 21
ObjectExtraction is done! 2 / 21
Flatten is done! 3 / 21
Dispatcher is done! 4 / 21
DeadCode is done! 5 / 21
Calculator is done! 6 / 21
ControlFlowFlattening is done! 7 / 21
GlobalConcealing is done! 8 / 21
OpaquePredicates is done! 9 / 21
StringSplitting is done! 10 / 21
StringConcealing is done! 11 / 21
StringCompression is done! 12 / 21
Stack is done! 13 / 21
DuplicateLiteralsRemoval is done! 14 / 21
Shuffle is done! 15 / 21
MovedDeclarations is done! 16 / 21
RenameLabels is done! 17 / 21
Minify is done! 18 / 21
RenameVariables is done! 19 / 21
AntiTooling is done! 20 / 21
Finalizer is done! 21 / 21
[Object: null prototype] {
Preparation: 1.0094190000090748,
ObjectExtraction: 0.9722220000112429,
Flatten: 2.585480000008829,
Dispatcher: 6.410395000013523,
DeadCode: 7.101765999919735,
Calculator: 4.634364000055939,
ControlFlowFlattening: 65.66039700002875,
GlobalConcealing: 40.353111999924295,
OpaquePredicates: 8.849830999970436,
StringSplitting: 6.999255000031553,
StringConcealing: 19.94320500001777,
StringCompression: 14.935447999974713,
Stack: 116.39931500004604,
DuplicateLiteralsRemoval: 37.37533099995926,
Shuffle: 12.675785999977961,
MovedDeclarations: 12.70788200001698,
RenameLabels: 32.359866000013426,
Minify: 70.36959400004707,
RenameVariables: 216.08912899997085,
AntiTooling: 13.917390999966301,
Finalizer: 22.79970700002741
}
*/ |
cli-progress is a very small library and providers helpers for repeatedly updating stdout, I think there is no need to reinvent the wheel here |
Add 'progress' to Options, which displays a visual progress bar of the obfuscation process in STDOUT
![image](https://private-user-images.githubusercontent.com/54221024/245574923-6fe55c74-425b-4fd5-9ffd-b73c63bf2262.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MzgyOTMsIm5iZiI6MTcyMTQzNzk5MywicGF0aCI6Ii81NDIyMTAyNC8yNDU1NzQ5MjMtNmZlNTVjNzQtNDI1Yi00ZmQ1LTlmZmQtYjczYzYzYmYyMjYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIwVDAxMTMxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE2OTg2NTVjYWZmNzJiM2FiYmRiZGQ0M2I4NGZlNzM4NTU2ZmIyNDU2MjQ3Zjg0MmQzNTgwN2Y0NmE5Y2I4ODUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.38bSiKrCpa_wUUtB8spK3FEO5RP0kgsR2HvK2axxJOU)
Example: