Created
July 6, 2023 20:29
-
-
Save mendes5/6331d0bf3de1dd56c2a8d6ce946f5210 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const { stat, statfs, statSync, statfsSync } = fs; | |
Object.assign(fs, { | |
stat(){ | |
console.log('Running stat', arguments[0], new Error().stack); | |
return stat.call(fs, ...[...arguments]); | |
}, | |
statfs(){ | |
console.log('Running statfs', arguments[0], new Error().stack); | |
return statfs.call(fs, ...[...arguments]); | |
}, | |
statSync(){ | |
console.log('Running statSync', arguments[0], new Error().stack); | |
return statSync.call(fs, ...[...arguments]); | |
}, | |
statfsSync(){ | |
console.log('Running statfsSync', arguments[0], new Error().stack); | |
return statfsSync.call(fs, ...[...arguments]); | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node -r hack.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment