Open Anooxy17 opened 4 days ago
I have the same problem, but no clear solution has been found
Thank you for the detailed issue! I'll look into it. It seems that this line is indeed missing a ,
:
static Qp(_static calculateQualityParameter, qualityParameter) {
Tha does seem super strange to me, as there should definitely not be a space there. I'll have a look at it a bit later.
Thank you for the detailed issue! I'll look into it. It seems that this line is indeed missing a
,
:static Qp(_static calculateQualityParameter, qualityParameter) {
Tha does seem super strange to me, as there should definitely not be a space there. I'll have a look at it a bit later.
If you have time, could you also look at my problem, I would be very grateful https://github.com/jehna/humanify/issues/111
It seems that this line is indeed missing a
,
:
@jehna @Anooxy17 Looking at the attached obfuscated.txt
, on what appears to be that same lines of code:
# ..snip..
static Qp(a, b) {
let c = new ib;
var d = w.J(a.d0, Ob)
, e = w.J(a.d1, Ob);
let f = a.color
, g = a.strength;
# ..snip..
It looks like the problem is less that there should be a ,
, and more that that something is adding the _static
prefix to the variable where it presumably shouldn't be.
I can see that a lot of the function names have a static
prefix; not sure if that ended up confusing the LLM when it was trying to come up with useful param renames or similar; but that is where I would start looking.
I wonder if running it again with --verbose
or similar would provide better info for debugging this further? May help narrow down where/why the _static
prefix is being introduced to things?
Another theory is that the _
is being prefixed onto static
to avoid it clashing with a JS keyword. I still don't know that it should be present for this param at all in general though.
I have the same problem, but no clear solution has been found
@Yusufkulcu Your problem in https://github.com/jehna/humanify/issues/111 (which is a duplicate of https://github.com/jehna/humanify/issues/54) isn't the same as the problem in this issue.
If you have time, could you also look at my problem, I would be very grateful
@Yusufkulcu Spamming other issues trying to draw more attention to an issue you raised is generally considered rude and bad practice in open-source.
Looking at the attached
obfuscated.txt
, on what appears to be that same lines of code:# ..snip.. static Qp(a, b) { let c = new ib; var d = w.J(a.d0, Ob) , e = w.J(a.d1, Ob); let f = a.color , g = a.strength; # ..snip..
I tried running this locally with the --verbose
flag. I didn't let it complete, but I did let it get past the above Qp
code, without running into any errors:
..snip..
[2024-09-26 03:46:49] Processing: 5%
[2024-09-26 03:46:49] Renaming a
[2024-09-26 03:46:49] Context: static Qp(a, b) {
let c = new ib();
var d = w.J(a.d0, Ob);
var e = w.J(a.d1, Ob);
let f = a.color;
let g = a.strength;
a = a.length;
if (d >= b.length || d < 0) {
throw v.C(null);
[2024-09-26 03:46:49] Renamed to qpInstance
[2024-09-26 03:46:49] Processing: 5%
[2024-09-26 03:46:50] Renaming b
[2024-09-26 03:46:50] Context: static Qp(qpInstance, b) {
let c = new ib();
var d = w.J(qpInstance.d0, Ob);
var e = w.J(qpInstance.d1, Ob);
let f = qpInstance.color;
let g = qpInstance.strength;
qpInstance = qpInstance.
[2024-09-26 03:46:50] Renamed to strengthValue
[2024-09-26 03:46:50] Processing: 5%
[2024-09-26 03:46:50] Renaming c
[2024-09-26 03:46:50] Context: static Qp(qpInstance, strengthValue) {
let c = new ib();
var d = w.J(qpInstance.d0, Ob);
var e = w.J(qpInstance.d1, Ob);
let f = qpInstance.color;
let g = qpInstance.strength;
qpInstance =
[2024-09-26 03:46:51] Renamed to createIbInstance
[2024-09-26 03:46:51] Processing: 5%
[2024-09-26 03:46:51] Renaming d
[2024-09-26 03:46:51] Context: static Qp(qpInstance, strengthValue) {
let createIbInstance = new ib();
var d = w.J(qpInstance.d0, Ob);
var e = w.J(qpInstance.d1, Ob);
let f = qpInstance.color;
let g = qpInstance.strength;
[2024-09-26 03:46:52] Renamed to distanceCalculation
[2024-09-26 03:46:52] Processing: 5%
[2024-09-26 03:46:52] Renaming e
[2024-09-26 03:46:52] Context: static Qp(qpInstance, strengthValue) {
let createIbInstance = new ib();
var distanceCalculation = w.J(qpInstance.d0, Ob);
var e = w.J(qpInstance.d1, Ob);
let f = qpInstance.color;
let g = qp
[2024-09-26 03:46:53] Renamed to distanceCalculationD1
[2024-09-26 03:46:53] Processing: 5%
[2024-09-26 03:46:53] Renaming f
[2024-09-26 03:46:53] Context: static Qp(qpInstance, strengthValue) {
let createIbInstance = new ib();
var distanceCalculation = w.J(qpInstance.d0, Ob);
var distanceCalculationD1 = w.J(qpInstance.d1, Ob);
let f = qpInstance
[2024-09-26 03:46:53] Renamed to currentQpInstance
[2024-09-26 03:46:53] Processing: 5%
[2024-09-26 03:46:53] Renaming g
[2024-09-26 03:46:53] Context: static Qp(qpInstance, strengthValue) {
let createIbInstance = new ib();
var distanceCalculation = w.J(qpInstance.d0, Ob);
var distanceCalculationD1 = w.J(qpInstance.d1, Ob);
let currentQpInsta
[2024-09-26 03:46:54] Renamed to calculateDistance
..snip..
@Anooxy17 Are you able to run this again with --verbose
and see if you get the error again? And if so, can you paste the relevant logs (or maybe the full logs as an attachment)? That may help narrow down where the issue might be coming from.
It looks like the problem is less that there should be a
,
, and more that that something is adding the_static
prefix to the variable where it presumably shouldn't be.I can see that a lot of the function names have a
static
prefix; not sure if that ended up confusing the LLM when it was trying to come up with useful param renames or similar; but that is where I would start looking.
This is still my main theory though, particularly given the same _static calculateQualityParameter
'variable name' can be seen on lines 1327, 1329, 1330:
SyntaxError: Unexpected token, expected "," (1327:23)
1325 | return dataPointDetails;
1326 | }
> 1327 | static Qp(_static calculateQualityParameter, qualityParameter) {
| ^
1328 | let qualityCalculator = new InvestmentBalance();
1329 | var qualityParameterValue = _UtilityClass.J(_static calculateQualityParameter.d0, getPeWithEmptyStringUtil);
1330 | var qualityData = _UtilityClass.J(_static calculateQualityParameter.d1, getPeWithEmptyStringUtil);
at vr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15472)
at Lr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15798)
I haven't looked deeply at the code that handles variable names returned from openai, but I am assuming OpenAI said to use static calculateQualityParameter
as a variable name, and then humanify
prefixed it with _
; or similar based on something like this:
So should I open it on openai again or try it locally? With which model?
@0xdevalias errors.txt It was made in OpenAI, not even went into over 70% now
errors.txt It was made in OpenAI, not even went into over 70% now
This error seems to be related to the attempt to assign a value to an object within a for
loop, which isn't allowed:
SyntaxError: Unexpected token (3562:43)
3560 | if (this.M == null) {
3561 | this.M = new CustomAnimationHandler();
> 3562 | for (var _________index = 0, _this.kLength = this.K; _________index < _this.kLength.length;) {
| ^
3563 | let kLengthValue = _this.kLength[_________index];
3564 | ++_________index;
3565 | kLengthValue.I = null;
at vr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15472)
at Lr (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:14:15798)
at Object.parse (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/babel-C_YYVHCf.mjs:15:2885)
at parse4 (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:21902:24)
at async coreFormat (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:22355:7)
at async formatWithCursor (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:22557:14)
at async Object.format2 (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:23932:25)
at async unminify (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:214:27)
at async Command.<anonymous> (file:///C:/Users/ktepe/AppData/Roaming/npm/node_modules/humanifyjs/dist/index.mjs:56814:3) {
loc: { start: { line: 3562, column: 43 } },
While I haven't looked deeply into it, this part makes me wonder if it's an issue with webcrack
and how it's choosing to inline certain variables/etc within for
loops.
It seems humanify
is currently using webcrack
2.13.0
:
https://github.com/jehna/humanify/blob/c2e0be679dcab43ec684668202d709f41452c0e9/package.json#L61
Looking at the releases we can see that the latest version is 2.14.1
:
Looking at the release notes for 2.14.0
, there is a line that talks about extracting sequences from for loops; I wonder if that would also fix this issue:
Extract sequence from for-of:
for (let value of (a = 1, array)) {}
->a = 1; for (let value of array) {}
It also seems to change how variables/parameters are named by default, which might give better starting names to pass to the LLM:
Mangle: names are inferred based on type (variable, function, parameter, class) and some expressions
@Anooxy17 You could potentially try cloning the humanify
repo, bumping webcrack
to the latest version in package.json
, and then seeing if that resolves this issue.
I'll also note that this seems like it might actually be a different issue to what was reported initially, so even if bumping webcrack
to the latest version helps solve it, it may still be worth looking deeper into the cause of the original issue.
@0xdevalias Yeees, it exactly looks like different error now, im crazy right now, doesnt matter how much I try, I cant really deobfuscate this file 😆 I will try when I came back to home and let u know then, ty
Looks like @Yusufkulcu is hitting a similar sort of error now, so perhaps they can try the workaround steps above and see if that helps in their case too:
SyntaxError: Unexpected token, expected "," (74:70)
72 | });
73 | };
74 | subscribeHandler.prototype._subscribe = function (_subscribeHandler.syncErrorThrown) {
| ^
75 | var sourceObject = this.source;
76 | return sourceObject && sourceObject.subscribe(_subscribeHandler.syncErrorThrown);
77 | };
Thanks for the suggestion, it doesn't give that error anymore, but now I'm getting another error. I get the following error in file 63. I've added the original file and the file where I got the error below. It's a pretty long mistake, so I added some more pictures.
..snip..
..snip..
@Yusufkulcu I'm glad that workaround helped get around the first issue :)
That new error you're running into seems to now be the same/similar to the errors being discussed in this issue:
You might like to try the potential solution I described in this comment, RE: cloning the
humanify
repo and bumping thewebcrack
version inpackage.json
to the latest version (2.14.1
):Originally posted by @0xdevalias in https://github.com/jehna/humanify/issues/111#issuecomment-2378407904
Looks like @Yusufkulcu is hitting a similar sort of error now
SyntaxError: Unexpected token, expected "," (74:70) 72 | }); 73 | }; 74 | subscribeHandler.prototype._subscribe = function (_subscribeHandler.syncErrorThrown) { | ^ 75 | var sourceObject = this.source; 76 | return sourceObject && sourceObject.subscribe(_subscribeHandler.syncErrorThrown); 77 | };
I made a few patches to my locally checked out version of humanify
to help provide better output info + skip through to the relevant files that seem to be causing errors:
src/unminify.ts
:
diff --git a/src/unminify.ts b/src/unminify.ts
index 948b4df..ff95ae0 100644
--- a/src/unminify.ts
+++ b/src/unminify.ts
@@ -9,22 +9,42 @@ export async function unminify(
plugins: ((code: string) => Promise<string>)[] = []
) {
ensureFileExists(filename);
+
+ console.log(`Reading input file: ${filename}`);
const bundledCode = await fs.readFile(filename, "utf-8");
+
+ console.log('Running webcrack to extract/decrypt bundled code...');
const extractedFiles = await webcrack(bundledCode, outputDir);
+ console.log(`Unbundled ${extractedFiles.length} files from ${filename} into ${outputDir}`);
+
for (let i = 0; i < extractedFiles.length; i++) {
- console.log(`Processing file ${i + 1}/${extractedFiles.length}`);
-
const file = extractedFiles[i];
+
+ console.log(`Processing file ${i + 1}/${extractedFiles.length} (${file.path})`);
+
+ // Skip extracted files till we find the one we actually want to try and process
+ if (file.path !== `${outputDir}/6blF.js`) {
+ console.log(' [hack] Skipping files that are not the one we want to process');
+ continue;
+ }
+
const code = await fs.readFile(file.path, "utf-8");
- const formattedCode = await plugins.reduce(
- (p, next) => p.then(next),
- Promise.resolve(code)
- );
+ if (code) {
+ const formattedCode = await plugins.reduce(
+ (p, next) => p.then(next),
+ Promise.resolve(code)
+ );
- verbose.log("Input: ", code);
- verbose.log("Output: ", formattedCode);
+ verbose.log(" Input: ", code);
+ verbose.log(" Output: ", formattedCode);
- await fs.writeFile(file.path, formattedCode);
+ await fs.writeFile(file.path, formattedCode);
+ }
+ else {
+ verbose.log(` Skipping empty file ${i + 1} (${file.path})`);
+ }
}
+
+ console.log(`Unminified (or skipped) ${extractedFiles.length} files from ${filename} into ${outputDir}`);
}
Then tried running it against main.txt
, configured to skip all of the extracted files except for output/6blF.js
; but I didn't seem to run into an error when I ran it (for reference, I hadn't bumped my version of webcrack
to the latest before running this):
This is how the lines that originally caused the error seemed to look like after being extracted with webcrack
:
// ..snip..
_0x223285.prototype._subscribe = function (_0x3becc8) {
var _0x2e0ffb = this.source;
return _0x2e0ffb && _0x2e0ffb.subscribe(_0x3becc8);
};
// ..snip..
And this is how the equivalent code looked after my run of humanify
had finished with it:
// ..snip..
createSubscription.prototype._subscribe = function (___dataProcessor) {
var sourceSubscription = this.source;
return sourceSubscription && sourceSubscription.subscribe(___dataProcessor);
};
// ..snip..
Which we can contrast against the version that @Yusufkulcu got the error with, which seemed to end up as:
// ..snip..
subscribeHandler.prototype._subscribe = function (_subscribeHandler.syncErrorThrown) {
var sourceObject = this.source;
return sourceObject && sourceObject.subscribe(_subscribeHandler.syncErrorThrown);
};
// ..snip..
In the original code, the _0x3becc8
seems to only exist in that functions parameter + the usage of it within the function. That is the same for ___dataProcessor
within my version. So my best guess is that with @Yusufkulcu's version, the LLM must have chosen the invalid variable name _subscribeHandler.syncErrorThrown
as a replacement or similar, but I can't really validate that as the screenshots/output shown in this comment https://github.com/jehna/humanify/issues/111#issuecomment-2378375379 seem to not mention what variable renames were being applied; which should have been shown in the output from openaiRename
(Ref) (assuming they were running humanify openai
, and not humanify local
or similar?)
@jehna probably knows the answer to this better.. but from memory of skimming through the humanify
code I don't think there is any context shared between the files being processed; so I wouldn't have expected the 'skip other files' hack I implemented above should have impacted the outcome.. so I'm even more confused as to why I can't reproduce the error that @Yusufkulcu was seeing.
Edit: One thing I noticed is that when @Yusufkulcu was unpacking it output/6blF.js
was file 63, yet when I was running unpacking it was file 66, so it seems webcrack
's file order may not be the same each time it's run (even though the filenames seem consistent, at least based on this one example)
Looks like @Yusufkulcu is hitting a similar sort of error now, so perhaps they can try the workaround steps above and see if that helps in their case too:
SyntaxError: Unexpected token, expected "," (74:70) 72 | }); 73 | }; 74 | subscribeHandler.prototype._subscribe = function (_subscribeHandler.syncErrorThrown) { | ^ 75 | var sourceObject = this.source; 76 | return sourceObject && sourceObject.subscribe(_subscribeHandler.syncErrorThrown); 77 | };
Thanks for the suggestion, it doesn't give that error anymore, but now I'm getting another error. I get the following error in file 63. I've added the original file and the file where I got the error below. It's a pretty long mistake, so I added some more pictures.
..snip.. ..snip..
@Yusufkulcu I'm glad that workaround helped get around the first issue :) That new error you're running into seems to now be the same/similar to the errors being discussed in this issue:
You might like to try the potential solution I described in this comment, RE: cloning the
humanify
repo and bumping thewebcrack
version inpackage.json
to the latest version (2.14.1
):Originally posted by @0xdevalias in #111 (comment)
Thank you very much for your reply. I updated the "webcrack" package, but the same problem persists. The problem is another file this time. Interestingly, I can't find the file with the error.
@0xdevalias I am also grateful for your detailed Explanations
Instead of writing it on my own record, I mixed it up and wrote it here. Sorry
I updated the "webcrack" package, but the same problem persists. The problem is another file this time. Interestingly, I can't find the file with the error.
@Yusufkulcu Are you running humanify openai
or one of the other commands?
Are you running with --verbose
?
It looks like the screenshots of your latest output are still missing the critical detail I mentioned above; of what the before and after names are when the variables are renamed.
Instead of writing it on my own record, I mixed it up and wrote it here. Sorry
@Yusufkulcu Thats fine; now that you're getting the same types of errors; this is a good place to centralise the discussion of these types of error.
I updated the "webcrack" package, but the same problem persists. The problem is another file this time. Interestingly, I can't find the file with the error.
@Yusufkulcu Are you running
humanify openai
or one of the other commands?Are you running with
--verbose
?It looks like the screenshots of your latest output are still missing the critical detail I mentioned above; of what the before and after names are when the variables are renamed.
Instead of writing it on my own record, I mixed it up and wrote it here. Sorry
@Yusufkulcu Thats fine; now that you're getting the same types of errors; this is a good place to centralise the discussion of these types of error.
I'm using OpenAI. Right now - I ran it with -verbose . How can I post the Verbose log here
Right now - I ran it with -verbose . How can I post the Verbose log here
@Yusufkulcu Cool, does it have the log lines that talk about 'Renaming VAR' and 'Renamed to NEWVAR' or similar? Did it still get the error?
It should look something like this:
..snip..
Processing file 66/559 (output/6blF.js)
[2024-09-27 05:35:05] Renaming _0x29881a
[2024-09-27 05:35:05] Context: var _0x29881a = require("./FFOo.js");
var _0x21aff1 = require("./L/V9.js");
var _0x332379 = require("./6ahw.js");
var _0x51037e = require("./xTla.js");
var _0x456d11 = require("./y3By.js");
var _0x2ad
[2024-09-27 05:35:06] Renamed to FFOoModule
[2024-09-27 05:35:06] Processing: 2%
[2024-09-27 05:35:06] Renaming _0x21aff1
[2024-09-27 05:35:06] Context: var FFOoModule = require("./FFOo.js");
var _0x21aff1 = require("./L/V9.js");
var _0x332379 = require("./6ahw.js");
var _0x51037e = require("./xTla.js");
var _0x456d11 = require("./y3By.js");
var _0x2a
[2024-09-27 05:35:06] Renamed to versionChecker
..snip..
I usually copy/paste all of the text output from my terminal into a .txt
file (eg. With notepad if you're on windows); then you should be able to attach that to a comment here.
Right now - I ran it with -verbose . How can I post the Verbose log here
@Yusufkulcu Cool, does it have the log lines that talk about 'Renaming VAR' and 'Renamed to NEWVAR' or similar? Did it still get the error?
It should look something like this:
..snip.. Processing file 66/559 (output/6blF.js) [2024-09-27 05:35:05] Renaming _0x29881a [2024-09-27 05:35:05] Context: var _0x29881a = require("./FFOo.js"); var _0x21aff1 = require("./L/V9.js"); var _0x332379 = require("./6ahw.js"); var _0x51037e = require("./xTla.js"); var _0x456d11 = require("./y3By.js"); var _0x2ad [2024-09-27 05:35:06] Renamed to FFOoModule [2024-09-27 05:35:06] Processing: 2% [2024-09-27 05:35:06] Renaming _0x21aff1 [2024-09-27 05:35:06] Context: var FFOoModule = require("./FFOo.js"); var _0x21aff1 = require("./L/V9.js"); var _0x332379 = require("./6ahw.js"); var _0x51037e = require("./xTla.js"); var _0x456d11 = require("./y3By.js"); var _0x2a [2024-09-27 05:35:06] Renamed to versionChecker ..snip..
I usually copy/paste all of the text output from my terminal into a
.txt
file (eg. With notepad if you're on windows); then you should be able to attach that to a comment here.
@0xdevalias
I noticed that the syntax error appears in a different file every time. This is something I don't understand.
It's really strange, the error occurs in a different file each time. I am adding the error logs below. "main.txt" is the original file, "+Branch.txt" is the file from which the error was received.
I use the "humanify openi" command
obfuscated.txt
It's on OPENAI. Cant decode this file in OpenAI, cant on Gemini, local etc, nothing :(