Chapter 9: Malicious input samples
This commit is contained in:
@@ -2,8 +2,9 @@ require("http")
|
|||||||
.createServer((req, res) => {
|
.createServer((req, res) => {
|
||||||
console.log(
|
console.log(
|
||||||
req.connection.remoteAddress,
|
req.connection.remoteAddress,
|
||||||
Buffer(req.url.split("/attack/")[1], "base64").toString().trim()
|
Buffer.from(req.url.split("/attack/")[1], "base64").toString().trim()
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.listen(3001);
|
.listen(3001, () => {
|
||||||
|
console.log("Collection Server listening on port 3001");
|
||||||
|
});
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ const express = require("express");
|
|||||||
const app = express();
|
const app = express();
|
||||||
const he = require("he");
|
const he = require("he");
|
||||||
|
|
||||||
app.get("*", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
const { previous, lang, token } = req.query;
|
const { previous, lang, token } = req.query;
|
||||||
getServiceStatus((status) => {
|
getServiceStatus((status) => {
|
||||||
const href = he.encode(`${previous}${token}/${lang}`);
|
const href = he.encode(`${previous}${token}/${lang}`);
|
||||||
res.send(`
|
res.send(`
|
||||||
<h1>Service Status</h1>
|
<h1>Service Status</h1>
|
||||||
<div id=status>
|
<div id=status>
|
||||||
${status}
|
${status}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -26,4 +26,3 @@ getServiceStatus = (callback) => {
|
|||||||
app.listen(3000, () => {
|
app.listen(3000, () => {
|
||||||
console.log("Server listening on port 3000");
|
console.log("Server listening on port 3000");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ const express = require("express");
|
|||||||
const app = express();
|
const app = express();
|
||||||
const escapeHTML = require("escape-html");
|
const escapeHTML = require("escape-html");
|
||||||
|
|
||||||
app.get("*", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
const { previous, lang, token } = req.query;
|
const { previous, lang, token } = req.query;
|
||||||
getServiceStatus((status) => {
|
getServiceStatus((status) => {
|
||||||
const href = escapeHTML(`/${previous}${token}/${lang}`);
|
const href = escapeHTML(`/${previous}${token}/${lang}`);
|
||||||
res.send(`
|
res.send(`
|
||||||
<h1>Service Status</h1>
|
<h1>Service Status</h1>
|
||||||
<div id=status>
|
<div id=status>
|
||||||
${status}
|
${status}
|
||||||
@@ -26,4 +26,3 @@ getServiceStatus = (callback) => {
|
|||||||
app.listen(3000, () => {
|
app.listen(3000, () => {
|
||||||
console.log("Server listening on port 3000");
|
console.log("Server listening on port 3000");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.get("*", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
const { previous, lang, token } = req.query;
|
const { previous, lang, token } = req.query;
|
||||||
getServiceStatus((status) => {
|
getServiceStatus((status) => {
|
||||||
res.send(`
|
res.send(`
|
||||||
<h1>Service Status</h1>
|
<h1>Service Status</h1>
|
||||||
<div id=status>
|
<div id=status>
|
||||||
${status}
|
${status}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -24,4 +24,3 @@ getServiceStatus = (callback) => {
|
|||||||
app.listen(3000, () => {
|
app.listen(3000, () => {
|
||||||
console.log("Server listening on port 3000");
|
console.log("Server listening on port 3000");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user