|
|
@ -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,37 +338,39 @@ 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)
|
|
|
|
chains.forEach((chain) => {
|
|
|
|
.map(({ name, js }) => ({ name, chains: Object.keys(js) }))
|
|
|
|
const value = chain
|
|
|
|
.reduce((technologies, { name, chains }) => {
|
|
|
|
.split('.')
|
|
|
|
chains.forEach((chain) => {
|
|
|
|
.reduce(
|
|
|
|
const value = chain
|
|
|
|
(value, method) =>
|
|
|
|
.split('.')
|
|
|
|
value && value.hasOwnProperty(method)
|
|
|
|
.reduce(
|
|
|
|
? value[method]
|
|
|
|
(value, method) =>
|
|
|
|
: undefined,
|
|
|
|
value && value.hasOwnProperty(method)
|
|
|
|
window
|
|
|
|
? value[method]
|
|
|
|
)
|
|
|
|
: undefined,
|
|
|
|
|
|
|
|
win
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
|
)
|
|
|
|
technologies.push({
|
|
|
|
|
|
|
|
name,
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
|
chain,
|
|
|
|
technologies.push({
|
|
|
|
value:
|
|
|
|
name,
|
|
|
|
typeof value === 'string' || typeof value === 'number'
|
|
|
|
chain,
|
|
|
|
? value
|
|
|
|
value:
|
|
|
|
: !!value
|
|
|
|
typeof value === 'string' || typeof value === 'number'
|
|
|
|
})
|
|
|
|
? value
|
|
|
|
}
|
|
|
|
: !!value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|