diff --git a/bin/cli.js b/bin/cli.js index 9098c25..b26a983 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -8,12 +8,18 @@ const inquirer = require('inquirer'); const chalk = require('chalk'); const Table = require('cli-table2'); const VERSION = meow().pkg.version; + +const Wappalyzer = require('wappalyzer'); + const options = { + debug: false, + delay: 500, + maxDepth: 3, + maxUrls: 10, + maxWait: 5000, + recursive: true, userAgent: 'Wappalyzer', - maxWait: 8000, - debug: false }; -const wappalyzer = require('wappalyzer')(options); let stackInfo = []; @@ -79,8 +85,8 @@ let search = function(website) { const spinner = ora('📊 Analyzing .... ').start(); // should be dynamic by user prompt - // wappalyzer.analyze(website) - wappalyzer.analyze(website) + const wappalyzer = new Wappalyzer(website, options); + wappalyzer.analyze() .then(json => { spinner.stop(); @@ -89,61 +95,60 @@ let search = function(website) { process.exit(); } - for (let num = 0; num < json.length; num ++) { + let resources = json.applications; + for (let num in resources) { stackInfo.push(new Array()); - if (json[num].name.toLowerCase().includes('google')) { + if (resources[num].name.toLowerCase().includes('google')) { stackInfo[num].push('🇬'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('cdn')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('cdn')) { stackInfo[num].push('📡'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('video')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('video')) { stackInfo[num].push('📹'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('analytics')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('analytics')) { stackInfo[num].push('📈'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('widgets')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('widgets')) { stackInfo[num].push('🔧'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('advertising')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('advertising')) { stackInfo[num].push('📺'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('font')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('font')) { stackInfo[num].push('🔠'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('server')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('server')) { stackInfo[num].push('🍪'); - } else if (Object.values(json[num].categories[0])[0].toLowerCase().includes('cache')) { + } else if (Object.values(resources[num].categories[0])[0].toLowerCase().includes('cache')) { stackInfo[num].push('⚡'); - } else if (json[num].name.toLowerCase().includes('js') || Object.values(json[num].categories[0])[0].toLowerCase().includes('javascript')) { + } else if (resources[num].name.toLowerCase().includes('js') || Object.values(resources[num].categories[0])[0].toLowerCase().includes('javascript')) { stackInfo[num].push('📝'); - } else if (json[num].name.toLowerCase().includes('bootstrap')) { + } else if (resources[num].name.toLowerCase().includes('bootstrap')) { stackInfo[num].push('🅱'); - } else if (json[num].name.toLowerCase().includes('php')) { + } else if (resources[num].name.toLowerCase().includes('php')) { stackInfo[num].push('🐘'); - } else if (json[num].name.toLowerCase().includes('webpack')) { + } else if (resources[num].name.toLowerCase().includes('webpack')) { stackInfo[num].push('🗃'); - } else if (json[num].name.toLowerCase().includes('ruby')) { + } else if (resources[num].name.toLowerCase().includes('ruby')) { stackInfo[num].push('💎'); - } else if (json[num].name.toLowerCase().includes('rails')) { + } else if (resources[num].name.toLowerCase().includes('rails')) { stackInfo[num].push('🚊'); - } else if (json[num].name.toLowerCase().includes('java')) { + } else if (resources[num].name.toLowerCase().includes('java')) { stackInfo[num].push('☕'); - } else if (json[num].name.toLowerCase().includes('python') || json[num].name.toLowerCase().includes('django')) { + } else if (resources[num].name.toLowerCase().includes('python') || resources[num].name.toLowerCase().includes('django')) { stackInfo[num].push('🐍'); } else { stackInfo[num].push('❓'); } - stackInfo[num].push(chalk.bold(chalk.white(json[num].name))); + stackInfo[num].push(chalk.bold(chalk.white(resources[num].name))); - if (json[num].confidence > 60) { - stackInfo[num].push(chalk.green(json[num].confidence) + chalk.green(' % sure 👍')); + if (resources[num].confidence > 60) { + stackInfo[num].push(chalk.green(resources[num].confidence) + chalk.green(' % sure 👍')); } else { - stackInfo[num].push(chalk.red(json[num].confidence) + chalk.red(' % sure 😭')); + stackInfo[num].push(chalk.red(resources[num].confidence) + chalk.red(' % sure 😭')); } - stackInfo[num].push(chalk.white(Object.values(json[num].categories[0])[0])); - stackInfo[num].push(chalk.white(json[num].website)); + stackInfo[num].push(chalk.white(Object.values(resources[num].categories[0])[0])); + stackInfo[num].push(chalk.white(resources[num].website)); } - // console.log(JSON.stringify(json, null, 2)); - // console.log(stackInfo); for (let number = 0; number < stackInfo.length; number++) { table.push(stackInfo[number]); } diff --git a/package-lock.json b/package-lock.json index 17b0558..b39f8c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "stacks-cli", - "version": "0.1.28", + "version": "0.1.46", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -23,9 +23,9 @@ } }, "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", @@ -2566,7 +2566,7 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.3.0", + "ajv": "5.5.2", "har-schema": "2.0.0" } }, @@ -3141,9 +3141,9 @@ } }, "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { "version": "1.30.0", @@ -3796,7 +3796,7 @@ "stringstream": "0.0.5", "tough-cookie": "2.3.3", "tunnel-agent": "0.6.0", - "uuid": "3.1.0" + "uuid": "3.2.1" } }, "requires-port": { @@ -4191,9 +4191,9 @@ "optional": true }, "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" }, "v8flags": { "version": "2.1.1", @@ -4224,9 +4224,9 @@ } }, "wappalyzer": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/wappalyzer/-/wappalyzer-5.1.6.tgz", - "integrity": "sha1-kAgdRyQshR+aKPZ1e3ju3CRTupo=", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/wappalyzer/-/wappalyzer-5.4.3.tgz", + "integrity": "sha512-5AcIFpTnoHqkZDc7lp/yPKWN/zap5l6EFzmg57yR+4y4O5iStHc7gnSzHQnMF8MTMp4AF9nzSdomFqvoLm07+Q==", "requires": { "request": "2.83.0", "zombie": "5.0.7" @@ -4287,7 +4287,7 @@ "iconv-lite": "0.4.19", "jsdom": "7.2.2", "lodash": "3.10.1", - "mime": "1.4.1", + "mime": "1.6.0", "ms": "0.7.3", "request": "2.83.0", "tough-cookie": "2.3.3", diff --git a/package.json b/package.json index 974c4fa..1262b97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stacks-cli", - "version": "0.1.46", + "version": "1.0.0", "description": "Check website stack from the terminal.", "bin": { "stacks-cli": "bin/cli.js" @@ -32,7 +32,6 @@ }, "homepage": "https://github.com/WeiChiaChang/stacks-cli#readme", "dependencies": { - "babel-runtime": "^6.26.0", "cfonts": "^1.1.3", "chalk": "^2.3.0", "cli-table2": "^0.2.0", @@ -40,14 +39,9 @@ "meow": "^3.7.0", "opn": "^5.1.0", "ora": "^1.3.0", - "wappalyzer": "5.1.6" + "wappalyzer": "5.4.3" }, "devDependencies": { - "babel-cli": "^6.26.0", - "babel-core": "^6.26.0", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.6.1", - "babel-preset-es2015": "^6.24.1", "mocha": "^4.0.1", "should": "^13.1.3" }