Created
December 12, 2018 13:32
-
-
Save jan-osch/e43474441ce50f94e70c76a8d11cff05 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env node | |
/* eslint-disable no-console */ | |
const superagent = require('superagent'); | |
const stream = require('stream'); | |
// Tests if the server is not vulnerable for this issue | |
// https://github.com/expressjs/body-parser/blob/master/README.md#request-aborted | |
const main = async () => { | |
const request = superagent.post('http://localhost:8001/v1/rexio') | |
.set('Content-Type', 'application/octet-stream'); | |
const s = new stream.Transform({ | |
transform(data, encoding, callback) { | |
this.push(data); | |
callback(); | |
}, | |
}); | |
setInterval(() => { | |
s.write('f'); | |
}, 10); | |
s.pipe(request); | |
setTimeout(() => { | |
request.abort(); | |
process.exit(0); | |
}, 1000); | |
}; | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment