From ef705af3fc65a482a36c5df44ff2db79a9be5456 Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Mon, 22 Jun 2020 09:37:13 +1000 Subject: [PATCH] Deprecate bookmarklet driver --- run | 19 ---- src/README.md | 3 +- src/drivers/bookmarklet/driver.js | 169 ------------------------------ 3 files changed, 2 insertions(+), 189 deletions(-) delete mode 100755 run delete mode 100644 src/drivers/bookmarklet/driver.js diff --git a/run b/run deleted file mode 100755 index 6e8c89a10..000000000 --- a/run +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" - -if [[ -z "$(which docker)" ]]; then - echo "Please install Docker from https://www.docker.com" - - exit 1 -fi - -cmd="docker run --rm -v "$(pwd):/opt/wappalyzer" -it wappalyzer/dev" - -$cmd sh -c "\ - yarn install; \ - cd ../npm; \ - yarn install" - -$cmd ./bin/run links -$cmd ./bin/run $@ diff --git a/src/README.md b/src/README.md index 3c475aa18..bf37bfeab 100644 --- a/src/README.md +++ b/src/README.md @@ -16,7 +16,8 @@ $ npm i wappalyzer-core const fs = require('fs') const Wappalyzer = require('./wappalyzer') -// See https://www.wappalyzer.com/docs/dev/specification +// See https://www.wappalyzer.com/docs/dev/specification or use +// https://raw.githubusercontent.com/AliasIO/wappalyzer/master/src/apps.json const { apps: technologies, categories } = JSON.parse( fs.readFileSync('./apps.json') ) diff --git a/src/drivers/bookmarklet/driver.js b/src/drivers/bookmarklet/driver.js deleted file mode 100644 index a59699358..000000000 --- a/src/drivers/bookmarklet/driver.js +++ /dev/null @@ -1,169 +0,0 @@ -/* eslint-env browser */ -/* globals wappalyzer */ - -;(function() { - wappalyzer.driver.document = document - - const container = document.getElementById('wappalyzer-container') - const url = wappalyzer.parseUrl(window.top.location.href) - const hasOwn = Object.prototype.hasOwnProperty - - /** - * Log messages to console - */ - wappalyzer.driver.log = (message, source, type) => { - // eslint-disable-next-line no-console - console.log(`[wappalyzer ${type}]`, `[${source}]`, message) - } - - function getPageContent() { - wappalyzer.log('func: getPageContent', 'driver') - - const scripts = Array.prototype.slice - .apply(document.scripts) - .filter((s) => s.src) - .map((s) => s.src) - - let html = new window.XMLSerializer() - .serializeToString(document) - .split('\n') - - html = html - .slice(0, 1000) - .concat(html.slice(html.length - 1000)) - .map((line) => line.substring(0, 1000)) - .join('\n') - - wappalyzer.analyze(url, { - html, - scripts - }) - } - - function getResponseHeaders() { - wappalyzer.log('func: getResponseHeaders', 'driver') - - const xhr = new XMLHttpRequest() - - xhr.open('GET', url, true) - - xhr.onreadystatechange = () => { - if (xhr.readyState === 4 && xhr.status) { - const headers = xhr.getAllResponseHeaders().split('\n') - - if (headers.length > 0 && headers[0] !== '') { - wappalyzer.log( - `responseHeaders: ${xhr.getAllResponseHeaders()}`, - 'driver' - ) - - const responseHeaders = {} - - headers.forEach((line) => { - let name, value - - if (line) { - name = line.substring(0, line.indexOf(': ')) - value = line.substring(line.indexOf(': ') + 2, line.length - 1) - - if (!responseHeaders[name.toLowerCase()]) { - responseHeaders[name.toLowerCase()] = [] - } - responseHeaders[name.toLowerCase()].push(value) - } - }) - - wappalyzer.analyze(url, { - headers: responseHeaders - }) - } - } - } - - xhr.send() - } - - /** - * Display apps - */ - wappalyzer.driver.displayApps = (detected) => { - wappalyzer.log('func: displayApps', 'driver') - - let first = true - let app - let category - let html - - html = - '' + - 'Close' + - '' + - '
' - - if (detected != null && Object.keys(detected).length) { - for (app in detected) { - if (!hasOwn.call(detected, app)) { - continue - } - - const version = detected[app].version - const confidence = detected[app].confidence - - html += - `
` + - `` + - '' + - ` ${app}${ - version ? ` ${version}` : '' - }${confidence < 100 ? ` (${confidence}% sure)` : ''}` - - for (const i in wappalyzer.apps[app].cats) { - if (!hasOwn.call(wappalyzer.apps[app].cats, i)) { - continue - } - - category = wappalyzer.categories[wappalyzer.apps[app].cats[i]].name - - html += `${category}` - } - - html += '
' - - first = false - } - } else { - html += '
No applications detected
' - } - - html += '
' - - container.innerHTML = html - } - - /** - * Open a tab - */ - // function openTab(args) { - // open(args.url) - // } - - function slugify(string) { - return string - .toLowerCase() - .replace(/[^a-z0-9-]/g, '-') - .replace(/--+/g, '-') - .replace(/(?:^-|-$)/, '') - } - - getPageContent() - getResponseHeaders() -})()