mirror of
https://github.com/Lissy93/web-check.git
synced 2024-11-25 17:53:19 +01:00
32 lines
787 B
JavaScript
32 lines
787 B
JavaScript
const Wappalyzer = require('wappalyzer');
|
|
const middleware = require('./_common/middleware');
|
|
|
|
const handler = async (url) => {
|
|
const options = {};
|
|
|
|
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();
|
|
}
|
|
};
|
|
|
|
module.exports = middleware(handler);
|
|
module.exports.handler = middleware(handler);
|