-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (37 loc) · 1.08 KB
/
app.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
50
51
52
53
54
55
56
const express = require('express')
const Wappalyzer = require('wappalyzer');
const { response } = require('express');
const app = express()
const port = 3000
//app.get('/', (req, res) => res.send('Hello World!'))
const options = {
debug: false,
delay: 500,
maxDepth: 0,
maxUrls: 1,
maxWait: 5000,
recursive: true,
userAgent: 'Wappalyzer',
htmlMaxCols: 2000,
htmlMaxRows: 2000,
};
app.get('/', async(req, res) => {
let url = req.query.url;
if (!url) {
res.send('Invalid URL')
} else {
const wappalyzer = await new Wappalyzer(options)
try {
await wappalyzer.init()
const site = await wappalyzer.open(url)
// Optionally capture and output errors
site.on('error', console.error)
const results = await site.analyze()
res.json(results, null, 2)
} catch (error) {
response.send(error)
}
await wappalyzer.destroy()
}
});
app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))