-
Notifications
You must be signed in to change notification settings - Fork 3
/
routes.js
49 lines (35 loc) · 1.21 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const url = require("url");
const express = require("express");
const routes = express.Router();
routes.get("/", (req, res) => {
console.log("Connection received: " + req.connection.remoteAddress);
return res.sendFile("./htmls/js-exploits.html", {root:__dirname});
});
routes.get("/log", (req, res) => {
console.log("Connection received: " + req.connection.remoteAddress);
console.log(req.url);
return res.send("Ok");
});
routes.get("/openredirect*", (req, res) => {
console.log("Connection received: " + req.connection.remoteAddress);
var urlParts = url.parse(req.url, true);
var query = urlParts.query;
var redirectUrl = query.url;
if (redirectUrl != undefined){
return res.redirect(redirectUrl);
}else{
return res.send("Missing 'url' parameter.");
}
});
routes.post("/openredirect*", (req, res) => {
console.log("Connection received: " + req.connection.remoteAddress);
var urlParts = url.parse(req.url, true);
var query = urlParts.query;
var redirectUrl = query.url;
if (redirectUrl != undefined){
return res.redirect(redirectUrl);
}else{
return res.send("Missing 'url' parameter.");
}
});
module.exports = routes;