|
|
@ -7,7 +7,8 @@ const {
|
|
|
|
setCategories,
|
|
|
|
setCategories,
|
|
|
|
analyze,
|
|
|
|
analyze,
|
|
|
|
analyzeManyToMany,
|
|
|
|
analyzeManyToMany,
|
|
|
|
resolve
|
|
|
|
resolve,
|
|
|
|
|
|
|
|
open
|
|
|
|
} = Wappalyzer
|
|
|
|
} = Wappalyzer
|
|
|
|
const { agent, promisify, getOption, setOption } = Utils
|
|
|
|
const { agent, promisify, getOption, setOption } = Utils
|
|
|
|
|
|
|
|
|
|
|
@ -17,9 +18,10 @@ const Driver = {
|
|
|
|
lastPing: Date.now(),
|
|
|
|
lastPing: Date.now(),
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Initialize Chrome extension.
|
|
|
|
* Initialise driver
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async init() {
|
|
|
|
async init() {
|
|
|
|
|
|
|
|
// Enable messaging between scripts
|
|
|
|
chrome.runtime.onConnect.addListener(Driver.onRuntimeConnect)
|
|
|
|
chrome.runtime.onConnect.addListener(Driver.onRuntimeConnect)
|
|
|
|
|
|
|
|
|
|
|
|
await Driver.loadTechnologies()
|
|
|
|
await Driver.loadTechnologies()
|
|
|
@ -69,16 +71,16 @@ const Driver = {
|
|
|
|
const upgradeMessage = await getOption('upgradeMessage', true)
|
|
|
|
const upgradeMessage = await getOption('upgradeMessage', true)
|
|
|
|
|
|
|
|
|
|
|
|
if (previous === null) {
|
|
|
|
if (previous === null) {
|
|
|
|
Driver.open('https://www.wappalyzer.com/installed')
|
|
|
|
open('https://www.wappalyzer.com/installed')
|
|
|
|
} else if (version !== previous && upgradeMessage) {
|
|
|
|
} else if (version !== previous && upgradeMessage) {
|
|
|
|
Driver.open(`https://www.wappalyzer.com/upgraded?v${version}`, false)
|
|
|
|
open(`https://www.wappalyzer.com/upgraded?v${version}`, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await setOption('version', version)
|
|
|
|
await setOption('version', version)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Logging utility function.
|
|
|
|
* Log debug messages to the console
|
|
|
|
* @param {String} message
|
|
|
|
* @param {String} message
|
|
|
|
* @param {String} source
|
|
|
|
* @param {String} source
|
|
|
|
* @param {String} type
|
|
|
|
* @param {String} type
|
|
|
@ -89,7 +91,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Error utility function.
|
|
|
|
* Log errors to the console
|
|
|
|
* @param {String} error
|
|
|
|
* @param {String} error
|
|
|
|
* @param {String} source
|
|
|
|
* @param {String} source
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -98,16 +100,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Open browser tab utility function.
|
|
|
|
* Load technologies and categories into memory
|
|
|
|
* @param {String} url
|
|
|
|
|
|
|
|
* @param {Boolean} active
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
open(url, active = true) {
|
|
|
|
|
|
|
|
chrome.tabs.create({ url, active })
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Load technologies into memory.
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async loadTechnologies() {
|
|
|
|
async loadTechnologies() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -123,7 +116,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Post-wrapper for fetch.
|
|
|
|
* Perform a HTTP POST request
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} body
|
|
|
|
* @param {String} body
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -139,7 +132,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Analyize JavaScript detections.
|
|
|
|
* Analyse JavaScript variables
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} url
|
|
|
|
* @param {Array} js
|
|
|
|
* @param {Array} js
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -160,7 +153,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Initialize PostMessage interface.
|
|
|
|
* Enable scripts to call Driver functions through messaging
|
|
|
|
* @param {Object} port
|
|
|
|
* @param {Object} port
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
onRuntimeConnect(port) {
|
|
|
|
onRuntimeConnect(port) {
|
|
|
@ -187,7 +180,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Callback for WebRequestComplete listener.
|
|
|
|
* Analyse response headers
|
|
|
|
* @param {Object} request
|
|
|
|
* @param {Object} request
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async onWebRequestComplete(request) {
|
|
|
|
async onWebRequestComplete(request) {
|
|
|
@ -224,7 +217,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Callback for onContentLoad listener.
|
|
|
|
* Process return values from content.js
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} url
|
|
|
|
* @param {Object} items
|
|
|
|
* @param {Object} items
|
|
|
|
* @param {String} language
|
|
|
|
* @param {String} language
|
|
|
@ -252,14 +245,14 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get technology detections.
|
|
|
|
* Get all technologies
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
getTechnologies() {
|
|
|
|
getTechnologies() {
|
|
|
|
return Wappalyzer.technologies
|
|
|
|
return Wappalyzer.technologies
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Callback for detections.
|
|
|
|
* Callback for detections
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} url
|
|
|
|
* @param {Array} detections
|
|
|
|
* @param {Array} detections
|
|
|
|
* @param {String} language
|
|
|
|
* @param {String} language
|
|
|
@ -350,7 +343,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Callback for onAd listener.
|
|
|
|
* Callback for onAd listener
|
|
|
|
* @param {Object} ad
|
|
|
|
* @param {Object} ad
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async onAd(ad) {
|
|
|
|
async onAd(ad) {
|
|
|
@ -360,7 +353,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Generate linked icon for detections.
|
|
|
|
* Update the extension icon
|
|
|
|
* @param {String} url
|
|
|
|
* @param {String} url
|
|
|
|
* @param {Object} technologies
|
|
|
|
* @param {Object} technologies
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -400,7 +393,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get detections from site.
|
|
|
|
* Get the detected technologies for the current tab
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async getDetections() {
|
|
|
|
async getDetections() {
|
|
|
|
const [{ id }] = await promisify(chrome.tabs, 'query', {
|
|
|
|
const [{ id }] = await promisify(chrome.tabs, 'query', {
|
|
|
@ -412,7 +405,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Check for robot rules on site.
|
|
|
|
* Fetch the website's robots.txt rules
|
|
|
|
* @param {String} hostname
|
|
|
|
* @param {String} hostname
|
|
|
|
* @param {Boolean} secure
|
|
|
|
* @param {Boolean} secure
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -484,7 +477,7 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Check for robots.txt rules.
|
|
|
|
* Check if the website allows indexing of a URL
|
|
|
|
* @param {String} href
|
|
|
|
* @param {String} href
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async checkRobots(href) {
|
|
|
|
async checkRobots(href) {
|
|
|
@ -505,7 +498,8 @@ const Driver = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Ping back home.
|
|
|
|
* Anonymously send identified technologies to wappalyzer.com
|
|
|
|
|
|
|
|
* This function can be disabled in the extension settings
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async ping() {
|
|
|
|
async ping() {
|
|
|
|
const tracking = await getOption('tracking', true)
|
|
|
|
const tracking = await getOption('tracking', true)
|
|
|
|