UI updates, probe for Magento version, fix error handling

main
Elbert Alias 4 years ago
parent 1c6317ec72
commit 57a97f10cf

@ -17,6 +17,7 @@ const aliases = {
h: 'help', h: 'help',
D: 'maxDepth', D: 'maxDepth',
m: 'maxUrls', m: 'maxUrls',
p: 'probe',
P: 'pretty', P: 'pretty',
r: 'recursive', r: 'recursive',
w: 'maxWait', w: 'maxWait',
@ -68,6 +69,7 @@ Options:
-D, --max-depth=... Don't analyse pages more than num levels deep -D, --max-depth=... Don't analyse pages more than num levels deep
-m, --max-urls=... Exit when num URLs have been analysed -m, --max-urls=... Exit when num URLs have been analysed
-w, --max-wait=... Wait no more than ms milliseconds for page resources to load -w, --max-wait=... Wait no more than ms milliseconds for page resources to load
-p, --probe Perform a deeper scan by making additional network requests
-P, --pretty Pretty-print JSON output -P, --pretty Pretty-print JSON output
-r, --recursive Follow links on pages (crawler) -r, --recursive Follow links on pages (crawler)
-a, --user-agent=... Set the user agent string -a, --user-agent=... Set the user agent string

@ -468,7 +468,7 @@ class Site {
}) })
) )
) )
).catch(() => []) ).catch(() => ({ jsonValue: () => [] }))
).jsonValue() ).jsonValue()
).catch(() => []) ).catch(() => [])
@ -499,7 +499,7 @@ class Site {
return css.join('\n') return css.join('\n')
}, this.options.htmlMaxRows) }, this.options.htmlMaxRows)
).catch(() => '') ).catch(() => ({ jsonValue: () => '' }))
).jsonValue() ).jsonValue()
).catch(() => '') ).catch(() => '')
@ -512,7 +512,7 @@ class Site {
.map(({ src }) => src) .map(({ src }) => src)
.filter((src) => src) .filter((src) => src)
) )
).catch(() => []) ).catch(() => ({ jsonValue: () => [] }))
).jsonValue() ).jsonValue()
).catch(() => []) ).catch(() => [])
@ -535,7 +535,7 @@ class Site {
{} {}
) )
) )
).catch(() => []) ).catch(() => ({ jsonValue: () => [] }))
).jsonValue() ).jsonValue()
).catch(() => []) ).catch(() => [])
@ -833,15 +833,15 @@ class Site {
await sleep(this.options.delay * index) await sleep(this.options.delay * index)
} }
if (this.options.probe) {
await this.probe(url)
}
const links = await this.goto(url) const links = await this.goto(url)
if (links && this.options.recursive && depth < this.options.maxDepth) { if (links && this.options.recursive && depth < this.options.maxDepth) {
await this.batch(links.slice(0, this.options.maxUrls), depth + 1) await this.batch(links.slice(0, this.options.maxUrls), depth + 1)
} }
if (this.options.probe) {
await this.probe(url)
}
} catch (error) { } catch (error) {
this.analyzedUrls[url.href] = { this.analyzedUrls[url.href] = {
status: 0, status: 0,
@ -888,6 +888,7 @@ class Site {
async probe(url) { async probe(url) {
const files = { const files = {
robots: '/robots.txt', robots: '/robots.txt',
magento: '/magento_version',
} }
for (const file of Object.keys(files)) { for (const file of Object.keys(files)) {

@ -95,7 +95,7 @@ a, a:focus, a:hover {
.footer__heading-text { .footer__heading-text {
flex: 1 0; flex: 1 0;
font-size: 1rem; font-size: .9rem;
font-weight: bold; font-weight: bold;
} }

@ -11305,6 +11305,7 @@
"Mage": "", "Mage": "",
"VarienForm": "" "VarienForm": ""
}, },
"magento": "Magento/([0-9.]+)\\;version:\\1",
"oss": true, "oss": true,
"scripts": [ "scripts": [
"js/mage", "js/mage",

@ -197,6 +197,7 @@ const Wappalyzer = {
html, html,
css, css,
robots, robots,
magento,
meta, meta,
headers, headers,
dns, dns,
@ -222,6 +223,7 @@ const Wappalyzer = {
oo(technology, 'html', html), oo(technology, 'html', html),
oo(technology, 'css', css), oo(technology, 'css', css),
oo(technology, 'robots', robots), oo(technology, 'robots', robots),
oo(technology, 'magento', magento),
oo(technology, 'certIssuer', certIssuer), oo(technology, 'certIssuer', certIssuer),
om(technology, 'scripts', scripts), om(technology, 'scripts', scripts),
mm(technology, 'cookies', cookies), mm(technology, 'cookies', cookies),
@ -255,6 +257,7 @@ const Wappalyzer = {
html, html,
css, css,
robots, robots,
magento,
meta, meta,
headers, headers,
dns, dns,
@ -295,6 +298,7 @@ const Wappalyzer = {
css: transform(css), css: transform(css),
certIssuer: transform(certIssuer), certIssuer: transform(certIssuer),
robots: transform(robots), robots: transform(robots),
magento: transform(magento),
meta: transform(meta), meta: transform(meta),
scripts: transform(scripts), scripts: transform(scripts),
js: transform(js, true), js: transform(js, true),