Skip to content

Commit

Permalink
Split technologies.json into technologies/[a-z].json
Browse files Browse the repository at this point in the history
  • Loading branch information
AliasIO committed Sep 2, 2021
1 parent 22d6c56 commit 2401457
Show file tree
Hide file tree
Showing 43 changed files with 28,411 additions and 28,299 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/build/*
/src/drivers/**/technologies.json
/src/drivers/**/categories.json
/src/drivers/**/technologies/*
/src/drivers/**/wappalyzer.js
/src/drivers/webextension/images/icons/converted/*

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To get started, see the [README](https://github.com/aliasio/wappalyzer/blob/mast

Wappalyzer uses [regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to fingerprint technologies. Refer to the [specification](https://github.com/AliasIO/wappalyzer/blob/master/README.md#specification) for detail.

- Add a new block to [`src/technologies.json`](https://github.com/aliasio/wappalyzer/blob/master/src/technologies.json).
- Add a new block to [`src/technologies/*.json`](https://github.com/aliasio/wappalyzer/blob/master/src/technologies). The filename should match the first letter of the technology name (a-z). Use `_.json` if the first character is a number or symbol.
- Add an icon to [`src/drivers/webextension/images/icons`](https://github.com/aliasio/wappalyzer/tree/master/src/drivers/webextension/images/icons). The image must be square, either SVG or PNG (32 x 32 pixels).

Only widely used technologies are accepted. When creating a pull request, include ten or more links to websites that use the application, a GitHub page with at least 1,000 stars or anything that will help establish the size of the user base.
Expand All @@ -26,7 +26,7 @@ Only widely used technologies are accepted. When creating a pull request, includ

Please [open an issue on GitHub](https://github.com/aliasio/wappalyzer/issues) first to discuss the need for a new category.

To add a category, edit [`src/technologies.json`](https://github.com/aliasio/wappalyzer/blob/master/src/technologies.json) and update every [locale](https://github.com/aliasio/wappalyzer/tree/master/src/drivers/webextension/_locales). You may use the English category name in all of them.
To add a category, edit [`src/categories.json`](https://github.com/aliasio/wappalyzer/blob/master/src/categories.json) and update every [locale](https://github.com/aliasio/wappalyzer/tree/master/src/drivers/webextension/_locales). You may use the English category name in all of them.

## Adding a new translation

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ node src/drivers/npm/cli.js https://example.com

A long list of [regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) is used to identify technologies on web pages. Wappalyzer inspects HTML code, as well as JavaScript variables, response headers and more.

Patterns (regular expressions) are kept in [`src/technologies.json`](https://github.com/aliasio/wappalyzer/blob/master/src/technologies.json). The following is an example of an application fingerprint.
Patterns (regular expressions) are kept in [`src/technologies/`](https://github.com/aliasio/wappalyzer/blob/master/src/technologies). The following is an example of an application fingerprint.

#### Example

Expand Down
21 changes: 16 additions & 5 deletions bin/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ const link = (src, dest) => {
fs.linkSync(src, dest)
}

// WebExtension
link('./src/technologies.json', './src/drivers/webextension/technologies.json')
link('./src/wappalyzer.js', './src/drivers/webextension/js/wappalyzer.js')

// NPM
link('./src/technologies.json', './src/drivers/npm/technologies.json')
link('./src/wappalyzer.js', './src/drivers/npm/wappalyzer.js')

link('./src/categories.json', './src/drivers/webextension/categories.json')
link('./src/categories.json', './src/drivers/npm/categories.json')

for (const index of Array(27).keys()) {
const character = index ? String.fromCharCode(index + 96) : '_'

link(
`./src/technologies/${character}.json`,
`./src/drivers/webextension/technologies/${character}.json`
)
link(
`./src/technologies/${character}.json`,
`./src/drivers/npm/technologies/${character}.json`
)
}
40 changes: 37 additions & 3 deletions bin/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,43 @@ const fs = require('fs')

const iconPath = './src/drivers/webextension/images/icons'

const { technologies, categories } = JSON.parse(
fs.readFileSync('./src/technologies.json')
)
const categories = JSON.parse(fs.readFileSync('./src/categories.json'))

let technologies = {}

for (const index of Array(27).keys()) {
const charCode = index ? index + 96 : 95
const character = String.fromCharCode(charCode)

const _technologies = JSON.parse(
fs.readFileSync(`./src/technologies/${character}.json`)
)

Object.keys(_technologies).forEach((name) => {
const _charCode = name.toLowerCase().charCodeAt(0)

if (charCode !== _charCode) {
if (_charCode < 97 || _charCode > 122) {
if (charCode !== 95) {
throw new Error(
`${name} should be moved from ./src/technologies/${character}.json to ./src/technologies/_.json`
)
}
} else {
throw new Error(
`${name} should be moved from ./src/technologies/${character}.json to ./src/technologies/${String.fromCharCode(
_charCode
)}.json`
)
}
}
})

technologies = {
...technologies,
..._technologies,
}
}

Object.keys(technologies).forEach((name) => {
const technology = technologies[name]
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"link": "node ./bin/link.js",
"lint": "eslint src/**/*.{js,json}",
"lint:fix": "eslint --fix src/**/*.{js,json}",
"validate": "yarn run lint && jsonlint -qV ./schema.json ./src/technologies.json && node ./bin/validate.js",
"validate": "yarn run lint && jsonlint -qV ./schema.json ./src/technologies/*.json && node ./bin/validate.js",
"convert": "node ./bin/convert.js",
"prettify": "jsonlint -si --trim-trailing-commas --enforce-double-quotes ./src/technologies.json",
"prettify": "jsonlint -si --trim-trailing-commas --enforce-double-quotes ./src/categories.json ./src/technologies/*.json",
"build": "yarn run link && yarn run validate && yarn run prettify && yarn run convert && node ./bin/build.js",
"build:safari": "xcrun safari-web-extension-converter --swift --project-location build --force src/drivers/webextension"
}
Expand Down
Loading

0 comments on commit 2401457

Please sign in to comment.