-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
45 lines (37 loc) · 1.06 KB
/
index.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
const express = require("express");
const Sequelize = require("sequelize");
const parseUrl = require("parse-url");
const { createHash } = require("crypto");
const access_token = "a_sample_token";
const app = express();
const sequelize = new Sequelize("database", "username", "password", {
dialect: "sqlite",
storage: "data/juiceshop.sqlite",
});
app.post("/login", function (req, res) {
sequelize.query(
"SELECT * FROM Products WHERE name LIKE " + req.body.username
);
});
app.get("/test", function (req, res) {
const test = null;
const dog = test?.dog;
console.log(dog);
});
app.get("/check", function (req, res) {
const passwordHash = createHash("md5")
.update(argv._[0] || "test")
.digest("hex");
if (passwordHash !== "deadbeefbabe") {
console.log(parseUrl(req.url));
}
});
app.get("/check-redos", function (req, res) {
new RegExp(req.param('pattern')).test("value");
});
app.get("/some/path", function (req, res) {
res.redirect(req.param("target"));
});
window.addEventListener("message", (event) => {
console.log(event.data);
});