simple-wappalyzer 1.1.90 → 1.1.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
File without changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "simple-wappalyzer",
3
3
  "description": "A simple way to interacting with Wappalyzer.",
4
4
  "homepage": "https://github.com/Kikobeats/simple-wappalyzer",
5
- "version": "1.1.90",
5
+ "version": "1.1.91",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -61,18 +61,6 @@
61
61
  "scripts",
62
62
  "src"
63
63
  ],
64
- "scripts": {
65
- "clean": "rm -rf node_modules",
66
- "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
67
- "lint": "standard",
68
- "postinstall": "node scripts/postinstall",
69
- "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
70
- "pretest": "npm run lint",
71
- "release": "standard-version -a",
72
- "release:github": "github-generate-release",
73
- "release:tags": "git push --follow-tags origin HEAD:master",
74
- "test": "c8 ava"
75
- },
76
64
  "license": "MIT",
77
65
  "commitlint": {
78
66
  "extends": [
@@ -96,5 +84,17 @@
96
84
  "simple-git-hooks": {
97
85
  "commit-msg": "npx commitlint --edit",
98
86
  "pre-commit": "npx nano-staged"
87
+ },
88
+ "scripts": {
89
+ "clean": "rm -rf node_modules",
90
+ "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
91
+ "lint": "standard",
92
+ "postinstall": "node scripts/postinstall",
93
+ "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
94
+ "pretest": "npm run lint",
95
+ "release": "standard-version -a",
96
+ "release:github": "github-generate-release",
97
+ "release:tags": "git push --follow-tags origin HEAD:master",
98
+ "test": "c8 ava"
99
99
  }
100
- }
100
+ }
package/src/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const { chain, mapValues } = require('lodash')
4
4
  const wappalyzer = require('wappalyzer-core')
5
5
  const { Cookie } = require('tough-cookie')
6
- const { Browser } = require('happy-dom')
6
+ const { Window } = require('happy-dom')
7
7
 
8
8
  const technologies = require('./technologies.json')
9
9
  const categories = require('./categories.json')
@@ -41,36 +41,32 @@ const getMeta = document =>
41
41
  return acc
42
42
  }, {})
43
43
 
44
- module.exports = async ({ url, headers, html }) => {
45
- const browser = new Browser({
46
- settings: {
47
- disableComputedStyleRendering: true,
48
- disableCSSFileLoading: true,
49
- disableIframePageLoading: true,
50
- disableJavaScriptEvaluation: true,
51
- disableJavaScriptFileLoading: true
52
- }
53
- })
54
-
55
- const page = browser.newPage()
56
- page.url = url
57
- page.content = html
58
-
59
- const document = page.mainFrame.document
60
-
61
- const detections = await wappalyzer.analyze({
62
- url,
63
- meta: getMeta(document),
64
- headers: getHeaders(headers),
65
- scripts: getScripts(document.scripts),
66
- cookies: getCookies(getHeader(headers, 'set-cookie')),
67
- html: document.documentElement.outerHTML
68
- })
69
-
70
- const result = wappalyzer.resolve(detections)
71
- await browser.close()
44
+ const DOCUMENT_SETTINGS = {
45
+ disableComputedStyleRendering: true,
46
+ disableCSSFileLoading: true,
47
+ disableIframePageLoading: true,
48
+ disableJavaScriptEvaluation: true,
49
+ disableJavaScriptFileLoading: true
50
+ }
72
51
 
73
- return result
52
+ module.exports = async ({ url, headers, html }) => {
53
+ const window = new Window({ url, settings: DOCUMENT_SETTINGS })
54
+ window.document.documentElement.innerHTML = html
55
+
56
+ try {
57
+ const detections = await wappalyzer.analyze({
58
+ url,
59
+ meta: getMeta(window.document),
60
+ headers: getHeaders(headers),
61
+ scripts: getScripts(window.document.scripts),
62
+ cookies: getCookies(getHeader(headers, 'set-cookie')),
63
+ html: window.document.documentElement.outerHTML
64
+ })
65
+
66
+ return wappalyzer.resolve(detections)
67
+ } finally {
68
+ await window.close()
69
+ }
74
70
  }
75
71
 
76
72
  module.exports.getHeader = getHeader