Add wappalyzer-core NPM package, fix priority sorting

main
Elbert Alias 5 years ago
parent 4f96ae4a0e
commit 94a4ee5306

@ -0,0 +1,39 @@
# Wappalyzer core
[Wappalyzer](https://www.wappalyzer.com/) indentifies technologies on websites.
## Installation
```shell
$ npm i wappalyzer-core
```
## Usage
```javascript
#!/usr/bin/env node
const fs = require('fs')
const Wappalyzer = require('./wappalyzer')
// See https://www.wappalyzer.com/docs/dev/specification
const { apps: technologies, categories } = JSON.parse(
fs.readFileSync('./apps.json')
)
Wappalyzer.setTechnologies(technologies)
Wappalyzer.setCategories(categories)
const detections = Wappalyzer.analyze({
url: 'https://example.github.io/',
meta: { generator: ['WordPress'] },
headers: { server: ['Nginx'] },
scripts: ['jquery-3.0.0.js'],
cookies: { awselb: [''] },
html: '<div ng-app="">'
})
const results = Wappalyzer.resolve(detections)
console.log(results)
```

@ -0,0 +1,25 @@
#!/usr/bin/env node
const fs = require('fs')
const Wappalyzer = require('./wappalyzer')
// See https://www.wappalyzer.com/docs/dev/specification
const { apps: technologies, categories } = JSON.parse(
fs.readFileSync('./apps.json')
)
Wappalyzer.setTechnologies(technologies)
Wappalyzer.setCategories(categories)
const detections = Wappalyzer.analyze({
url: 'https://example.github.io/',
meta: { generator: ['WordPress'] },
headers: { server: ['Nginx'] },
scripts: ['jquery-3.0.0.js'],
cookies: { awselb: [''] },
html: '<div ng-app="">'
})
const results = Wappalyzer.resolve(detections)
console.log(results)

@ -311,13 +311,7 @@ const Driver = {
categories.some(({ id }) => id === pinnedCategory) categories.some(({ id }) => id === pinnedCategory)
) )
;({ icon } = pinned || ;({ icon } = pinned || technologies[0] || { icon })
technologies.sort(({ categories: a }, { categories: b }) => {
const max = (value) =>
value.reduce((max, { priority }) => Math.max(max, priority))
return max(a) > max(b) ? -1 : 1
})[0] || { icon })
} }
const tabs = await promisify(chrome.tabs, 'query', { url }) const tabs = await promisify(chrome.tabs, 'query', { url })

@ -0,0 +1,30 @@
{
"name": "wappalyzer-core",
"description": "Identify technology on websites",
"keywords": [
"analyze",
"identify",
"detect",
"detector",
"technology",
"cms",
"framework",
"library",
"software"
],
"homepage": "https://www.wappalyzer.com",
"version": "6.0.7",
"author": "Wappalyzer",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/aliasio/wappalyzer"
},
"funding": {
"url": "https://github.com/sponsors/aliasio"
},
"main": "wappalyzer.js",
"files": [
"wappalyzer.js"
]
}

@ -51,21 +51,28 @@ const Wappalyzer = {
Wappalyzer.resolveExcludes(resolved) Wappalyzer.resolveExcludes(resolved)
Wappalyzer.resolveImplies(resolved) Wappalyzer.resolveImplies(resolved)
return resolved.map( const priority = ({ technology: { categories } }) =>
({ categories.reduce((max, id) =>
technology: { name, slug, categories, icon, website }, Math.max(max, Wappalyzer.getCategory(id).priority)
confidence, )
version
}) => ({ return resolved
name, .sort((a, b) => (priority(a) > priority(b) ? 1 : -1))
slug, .map(
categories: categories.map((id) => Wappalyzer.getCategory(id)), ({
confidence, technology: { name, slug, categories, icon, website },
version, confidence,
icon, version
website }) => ({
}) name,
) slug,
categories: categories.map((id) => Wappalyzer.getCategory(id)),
confidence,
version,
icon,
website
})
)
}, },
resolveVersion({ version, regex }, match) { resolveVersion({ version, regex }, match) {