Open xOnlyFadi opened 2 years ago
Hello, thank you for reporting. I am about to start investigation in few days after scheduling the work. Before, the investigation, please checkout following items again.
I checked the original file on https://github.com/vercel/pkg/blob/main/prelude/diagnostic.js
but there was no change since 2021.
Hey Thank you for responding when checking the exe and searching for installDiagnostic
I did not find anything about that function and in the package.json i saw
{
"pkg": {
"scripts": [
"source.js",
"mangareader.js",
],
"targets": [
"node10-linux-x64", "node10-macos-x64", "node10-win-x64"
]
}
}
Thanks for checking out. I confirmed that the previous hooker only works on binaries which enabled debug flag when building. The latest commit should work even there is no debug flag set when building. Please, try out.
I just tested it there is no errors anymore but I don't see the patched file to run it
You should see original_filename.patched
in the same folder. Don't you see it?
I don't see a file called original_filename.patched
I just ran it again and saw a dot removed and I still get the same error
snapit-pkg/hookers/pkg.js:122
throw new Error('Failed to find a valid hooking point!'
What's your original file name? Can you give me an example, so I can check my understanding again?
the current file name is localnoderserverunkillable_win.exe
, If you want the file I can give you the file so you can test it on your side
Sure, use your preferred file sharing service. You can email me: seia@outlook.kr
(PGP supported).
just sent a email with the link
I checked it and confirmed the reason is because your binary compiled using pkg version 4. I'll prepare the patch.
oh ok thanks for the help one more question when getting the patched file out do rename the file to exe and just run it right?
Yes, that's right. On macOS, you can use 'chmod +x` command to convert into executable.
and what if I was on windows do I rename the file to exe and run it?
I just ran the command I got filesync error TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received function patch
Yes, I am working on.
are there more fixes for it, so it can be compatible with pkg4?
Yup, I am expecting full refactor soon. I am super busy due to university registration these days. Can you check latest commit?
tested it on windows and I get the file but on macos I get this error Error [ERR_LOADER_CHAIN_INCOMPLETE]: "file:///Users/username/Desktop/snapit-pkg-master/.pnp.loader.mjs 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include
shortCircuit: truein the hook's return.
I can't run the file on windows when it's get patched by snapit
Yarn error on macOS is not reproducible. You should stash local changes and pull again to refresh the repo. Reinstalling the dependencies are recommended.
But about Windows, I think I need take time to setup Windows development environment.
did the patching on mac or windows I get the same error Mac
Windows
It’s late for me we can continue tomorrow or when you have time to fix it
Sorry but I cannot continue soon due to university registration process at least till 17. You should dive into the binary if you're in emergency.
It’s okay I'm not in a emergency you can finish everything that is important in your life and then you can fix it
Hey Seia when reading the error that was given in the console it was from the patch for child_process
patch I don't know what made child_process
not work when requiring it and the error is coming from here
// /////////////////////////////////////////////////////////////////
// PROMISIFY ///////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////
(function () {
var util = require('util');
var promisify = util.promisify;
if (promisify) {
var custom = promisify.custom;
var binding = process.binding('util');
var createPromise = binding.createPromise;
var promiseResolve = binding.promiseResolve;
var promiseReject = binding.promiseReject;
var customPromisifyArgs = require('internal/util').customPromisifyArgs;
// /////////////////////////////////////////////////////////////
// FS //////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
Object.defineProperty(require('fs').exists, custom, {
value: function (path) {
var promise = createPromise();
require('fs').exists(path, function (exists) {
promiseResolve(promise, exists);
});
return promise;
}
});
Object.defineProperty(require('fs').read, customPromisifyArgs, {
value: [ 'bytesRead', 'buffer' ]
});
Object.defineProperty(require('fs').write, customPromisifyArgs, {
value: [ 'bytesWritten', 'buffer' ]
});
// /////////////////////////////////////////////////////////////
// CHILD_PROCESS ///////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
var customPromiseExecFunction = function (orig) {
return function () {
var args = Array.from(arguments);
var promise = createPromise();
orig.apply(undefined, args.concat(function (error, stdout, stderr) {
if (error !== null) {
error.stdout = stdout;
error.stderr = stderr;
promiseReject(promise, error);
} else {
promiseResolve(promise, { stdout: stdout, stderr: stderr });
}
}));
return promise;
};
};
Object.defineProperty(require('child_process').exec, custom, {
value: customPromiseExecFunction(require('child_process').exec)
});
Object.defineProperty(require('child_process').execFile, custom, {
value: customPromiseExecFunction(require('child_process').execFile)
});
}
}());
Hey Seia when are university registration process is gonna end so we can work and know why child_process
is getting broken at that line?
Several major events are ongoing this year such as SAT and interviews. I will process this as I finish tasks at higher priority or requested earlier such as outsourcing projects or educational projects. You can do it yourself since you know what to do now and can access the dead simple sourcecode as I noted: you can do yourself if you need to grab the package content quickly.
I can tell you the exact date of majority events, but unfortunately, I could not give you an exact date to work in this package. I am really focusing in educational goals.
Hi Snapit Pkg author when I used your tool with the same commands that they were given in in readme I get the error meesage
Failed to find a valid hooking point!
is there a way to fix it?