From d9c504a19cdd061d695b0e3c118d05d636e8b5b0 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Tue, 26 May 2020 14:59:28 +1000 Subject: [PATCH] Update README --- src/drivers/puppeteer/README.md | 48 ++++++++++++++++----------------- src/drivers/puppeteer/cli.js | 2 -- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/drivers/puppeteer/README.md b/src/drivers/puppeteer/README.md index 72f39600b..acfd9cbea 100644 --- a/src/drivers/puppeteer/README.md +++ b/src/drivers/puppeteer/README.md @@ -31,8 +31,7 @@ wappalyzer [options] ### Options ``` --b, --browser=... Specify which headless browser to use (zombie or puppeteer) --c, --chunk-size=... Process links in chunks +-b, --batch-size=... Process links in batches -d, --debug Output debug messages -t, --delay=ms Wait for ms milliseconds between requests -h, --help This text @@ -41,12 +40,9 @@ wappalyzer [options] -D, --max-depth=... Don't analyse pages more than num levels deep -m, --max-urls=... Exit when num URLs have been analysed -w, --max-wait=... Wait no more than ms milliseconds for page resources to load --p, --password=... Password to be used for basic HTTP authentication (zombie only) -P, --pretty Pretty-print JSON output ---proxy=... Proxy URL, e.g. 'http://user:pass@proxy:8080' (zombie only) -r, --recursive Follow links on pages (crawler) -a, --user-agent=... Set the user agent string --u, --username=... Username to be used for basic HTTP authentication (zombie only) ``` @@ -58,7 +54,6 @@ const Wappalyzer = require('wappalyzer'); const url = 'https://www.wappalyzer.com'; const options = { - // browser: 'puppeteer', debug: false, delay: 500, maxDepth: 3, @@ -70,27 +65,30 @@ const options = { htmlMaxRows: 2000, }; -const wappalyzer = new Wappalyzer(url, options); +;(async function() { + const wappalyzer = await new Wappalyzer(options) -// Optional: capture log output -// wappalyzer.on('log', params => { -// const { message, source, type } = params; -// }); + try { + await wappalyzer.init() -// Optional: do something on page visit -// wappalyzer.on('visit', params => { -// const { browser, pageUrl } = params; -// }); + const site = await wappalyzer.open(url) -wappalyzer.analyze() - .then((json) => { - process.stdout.write(`${JSON.stringify(json, null, 2)}\n`); + site.on('error', (error) => { + process.stderr.write(`error: ${error}\n`) + }) - process.exit(0); - }) - .catch((error) => { - process.stderr.write(`${error}\n`); + const results = await site.analyze() - process.exit(1); - }); -``` + process.stdout.write(`${JSON.stringify(results, null, 2)}\n`) + + await wappalyzer.destroy() + + process.exit(0) + } catch (error) { + process.stderr.write(error.toString()) + + await wappalyzer.destroy() + + process.exit(1) + } +})() diff --git a/src/drivers/puppeteer/cli.js b/src/drivers/puppeteer/cli.js index 8a9d04f78..9348ce709 100755 --- a/src/drivers/puppeteer/cli.js +++ b/src/drivers/puppeteer/cli.js @@ -88,8 +88,6 @@ Options: process.stderr.write(`page error: ${error}\n`) }) - await new Promise((resolve) => setTimeout(resolve, 1000)) - const results = await site.analyze() process.stdout.write(