mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
20
tests/dynamic_fixtures/javascript/commonjs_export/benign.js
Normal file
20
tests/dynamic_fixtures/javascript/commonjs_export/benign.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Phase 13 — CommonJS export, benign control.
|
||||
|
||||
'use strict';
|
||||
const { execFileSync } = require('child_process');
|
||||
|
||||
function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
execFileSync('true', [host], {
|
||||
encoding: 'utf8',
|
||||
timeout: 5000,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
return 'ok';
|
||||
} catch (_e) {
|
||||
return 'err';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { runPing };
|
||||
21
tests/dynamic_fixtures/javascript/commonjs_export/vuln.js
Normal file
21
tests/dynamic_fixtures/javascript/commonjs_export/vuln.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Phase 13 — CommonJS export, vulnerable.
|
||||
//
|
||||
// Synchronous `execSync` with shell:true via string concat. Stdlib only.
|
||||
|
||||
'use strict';
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const out = execSync('echo hello ' + host, { encoding: 'utf8', timeout: 5000 });
|
||||
process.stdout.write(out);
|
||||
return out;
|
||||
} catch (e) {
|
||||
const out = (e.stdout || '') + (e.stderr || '');
|
||||
process.stdout.write(out);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { runPing };
|
||||
Loading…
Add table
Add a link
Reference in a new issue