-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathtech-stack.js
More file actions
40 lines (35 loc) · 1 KB
/
tech-stack.js
File metadata and controls
40 lines (35 loc) · 1 KB
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
import Wappalyzer from 'wappalyzer';
import middleware from './_common/middleware.js';
const techStackHandler = async (url) => {
const options = {
browsers: ['chromium'],
puppeteerArgs: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--single-process',
],
executablePath: process.env.CHROME_PATH || '/usr/bin/chromium',
};
const wappalyzer = new Wappalyzer(options);
try {
await wappalyzer.init();
const headers = {};
const storage = {
local: {},
session: {},
};
const site = await wappalyzer.open(url, headers, storage);
const results = await site.analyze();
if (!results.technologies || results.technologies.length === 0) {
throw new Error('Unable to find any technologies for site');
}
return results;
} catch (error) {
throw new Error(error.message);
} finally {
await wappalyzer.destroy();
}
};
export const handler = middleware(techStackHandler);
export default handler;