|
|
@ -57,43 +57,6 @@ function sleep(ms) {
|
|
|
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
|
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getJs() {
|
|
|
|
|
|
|
|
const dereference = (obj, level = 0) => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
|
|
|
if (level > 5 || (level && obj === window)) {
|
|
|
|
|
|
|
|
return '[Removed]'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(obj)) {
|
|
|
|
|
|
|
|
obj = obj.map((item) => dereference(item, level + 1))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
typeof obj === 'function' ||
|
|
|
|
|
|
|
|
(typeof obj === 'object' && obj !== null)
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
const newObj = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.keys(obj)
|
|
|
|
|
|
|
|
.filter((key) => obj.hasOwnProperty(key))
|
|
|
|
|
|
|
|
.forEach((key) => {
|
|
|
|
|
|
|
|
newObj[key] = dereference(obj[key], level + 1)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return newObj
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return obj
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
|
|
|
return dereference(window)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function analyzeJs(js) {
|
|
|
|
function analyzeJs(js) {
|
|
|
|
return Array.prototype.concat.apply(
|
|
|
|
return Array.prototype.concat.apply(
|
|
|
|
[],
|
|
|
|
[],
|
|
|
@ -375,12 +338,9 @@ class Site {
|
|
|
|
).jsonValue()
|
|
|
|
).jsonValue()
|
|
|
|
|
|
|
|
|
|
|
|
// JavaScript
|
|
|
|
// JavaScript
|
|
|
|
const win = await page.evaluate(getJs)
|
|
|
|
const js = await page.evaluate(
|
|
|
|
|
|
|
|
(technologies) => {
|
|
|
|
const js = Wappalyzer.technologies
|
|
|
|
return technologies.reduce((technologies, { name, chains }) => {
|
|
|
|
.filter(({ js }) => Object.keys(js).length)
|
|
|
|
|
|
|
|
.map(({ name, js }) => ({ name, chains: Object.keys(js) }))
|
|
|
|
|
|
|
|
.reduce((technologies, { name, chains }) => {
|
|
|
|
|
|
|
|
chains.forEach((chain) => {
|
|
|
|
chains.forEach((chain) => {
|
|
|
|
const value = chain
|
|
|
|
const value = chain
|
|
|
|
.split('.')
|
|
|
|
.split('.')
|
|
|
@ -389,7 +349,7 @@ class Site {
|
|
|
|
value && value.hasOwnProperty(method)
|
|
|
|
value && value.hasOwnProperty(method)
|
|
|
|
? value[method]
|
|
|
|
? value[method]
|
|
|
|
: undefined,
|
|
|
|
: undefined,
|
|
|
|
win
|
|
|
|
window
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
@ -406,6 +366,11 @@ class Site {
|
|
|
|
|
|
|
|
|
|
|
|
return technologies
|
|
|
|
return technologies
|
|
|
|
}, [])
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Wappalyzer.technologies
|
|
|
|
|
|
|
|
.filter(({ js }) => Object.keys(js).length)
|
|
|
|
|
|
|
|
.map(({ name, js }) => ({ name, chains: Object.keys(js) }))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Cookies
|
|
|
|
// Cookies
|
|
|
|
const cookies = (await page.cookies()).reduce(
|
|
|
|
const cookies = (await page.cookies()).reduce(
|
|
|
|