-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
35 lines (27 loc) · 1.09 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
const express = require('express');
const app = express();
const port = 3000; //you can custom your port
const backdoorList = require('./list.json');
app.get('/', (req, res) => {
res.send('Server is running');
});
app.get('/upload', (req, res) => {
const { path, ip } = req.query;
const dateTime = new Date().toISOString();
const fs = require('fs');
const fileContent = fs.readFileSync(path, 'utf8');
const isBackdoor = backdoorList.some(({ backdoorRegex }) => {
const regex = new RegExp(backdoorRegex, 'gm');
return regex.test(fileContent);
});
if (isBackdoor) {
console.log(`File diunggah oleh ${ip} ke ${path} pada ${dateTime} dan terdeteksi backdoor`);
res.send(`File diunggah oleh ${ip} ke ${path} pada ${dateTime}<br>Backdoor: true`); //you can delete this
} else {
console.log(`File diunggah oleh ${ip} ke ${path} pada ${dateTime} dan tidak terdeteksi backdoor`);
res.send(`File diunggah oleh ${ip} ke ${path} pada ${dateTime}<br>Backdoor: false`); //you can delete this
}
});
app.listen(port, () => {
console.log(`Server is listening on port ${port}`);
});