pentest-tool-lite 3.9.3 → 3.10.8
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 +19 -0
- package/{src → dist}/Pentest.d.ts +1 -0
- package/dist/Pentest.js +46 -0
- package/{src → dist}/Test.d.ts +1 -0
- package/{src → dist}/Test.js +12 -27
- package/{src → dist}/commands/Sitemap.d.ts +4 -4
- package/dist/commands/Sitemap.js +79 -0
- package/dist/dns/A.js +49 -0
- package/dist/dns/DMARC.js +59 -0
- package/dist/dns/NS.js +36 -0
- package/dist/dns/RegistrationDate.js +39 -0
- package/dist/dns/index.js +47 -0
- package/dist/functions/findEvery.d.ts +2 -0
- package/{src → dist}/functions/getDuplicates.js +1 -0
- package/dist/functions/getGenerator.d.ts +2 -0
- package/{src → dist}/functions/getGenerator.js +3 -0
- package/{src → dist}/functions/getHeading.js +4 -0
- package/{src → dist}/functions/getImages.js +1 -0
- package/dist/functions/getObject.d.ts +2 -0
- package/{src → dist}/functions/getScripts.js +1 -0
- package/{src → dist}/functions/getStylesheets.js +1 -0
- package/{src → dist}/functions/getTitle.js +1 -0
- package/{src → dist}/functions/parseHtml.js +4 -0
- package/dist/functions/parseSitemap.js +12 -0
- package/dist/html/Anchor.js +56 -0
- package/dist/html/CSS.js +92 -0
- package/dist/html/DuplicateId.js +35 -0
- package/dist/html/Generator.js +31 -0
- package/dist/html/Image.js +79 -0
- package/dist/html/JavaScript.js +107 -0
- package/{src → dist}/html/__TESTS__/Generator.test.js +12 -19
- package/dist/html/index.js +51 -0
- package/{src → dist}/index +39 -28
- package/dist/logger/Console.d.ts +14 -0
- package/{src → dist}/logger/Console.js +13 -15
- package/dist/metadata/HTML.d.ts +6 -0
- package/dist/metadata/HTML.js +26 -0
- package/dist/metadata/Markdown.d.ts +6 -0
- package/dist/metadata/Markdown.js +28 -0
- package/dist/metadata/ResponseTime.d.ts +6 -0
- package/dist/metadata/ResponseTime.js +25 -0
- package/dist/metadata/index.d.ts +6 -0
- package/dist/metadata/index.js +45 -0
- package/{src → dist}/request/NodeFetch.d.ts +2 -0
- package/dist/request/NodeFetch.js +58 -0
- package/{src → dist}/request/Request.d.ts +2 -0
- package/dist/request/cache/BlackHoleCache.d.ts +7 -0
- package/{src → dist}/request/cache/BlackHoleCache.js +4 -3
- package/{src → dist}/request/cache/UnlimitedCache.d.ts +1 -2
- package/{src → dist}/request/cache/UnlimitedCache.js +4 -0
- package/dist/request/index.js +11 -0
- package/dist/security/ContentEncoding.js +44 -0
- package/dist/security/ContentSecurityPolicy.js +32 -0
- package/dist/security/Cookies.js +44 -0
- package/dist/security/FingerPrint.js +37 -0
- package/dist/security/GoogleWebRisk.js +44 -0
- package/dist/security/HSTS.js +48 -0
- package/dist/security/HTTPS.js +78 -0
- package/dist/security/HTTPVersion.js +50 -0
- package/dist/security/PermissionsPolicy.js +53 -0
- package/dist/security/Redirect.d.ts +6 -0
- package/dist/security/Redirect.js +37 -0
- package/dist/security/ReferrerPolicy.js +32 -0
- package/dist/security/RobotsTXT.js +28 -0
- package/dist/security/SSL.js +36 -0
- package/dist/security/XFrameOptions.js +32 -0
- package/dist/security/XXSSProtection.js +32 -0
- package/{src → dist}/security/__TESTS__/ContentSecurityPolicy.test.js +12 -19
- package/{src → dist}/security/__TESTS__/FingerPrint.test.js +12 -19
- package/{src → dist}/security/__TESTS__/HSTS.test.js +18 -24
- package/{src → dist}/security/__TESTS__/HTTPS.test.js +18 -24
- package/dist/security/__TESTS__/XFrameOptions.test.js +37 -0
- package/{src → dist}/security/__TESTS__/XXSSProtection.test.js +12 -19
- package/{src → dist}/security/index.js +22 -35
- package/dist/seo/Heading.js +51 -0
- package/dist/seo/Robots.js +21 -0
- package/dist/seo/Sitemap.js +32 -0
- package/dist/seo/Title.js +44 -0
- package/dist/seo/index.js +47 -0
- package/dist/wordpress/DefaultFiles.js +50 -0
- package/dist/wordpress/Generator.js +58 -0
- package/dist/wordpress/index.js +43 -0
- package/package.json +68 -59
- package/src/Pentest.js +0 -43
- package/src/commands/Sitemap.js +0 -94
- package/src/dns/A.js +0 -64
- package/src/dns/DMARC.js +0 -72
- package/src/dns/NS.js +0 -52
- package/src/dns/RegistrationDate.js +0 -55
- package/src/dns/index.js +0 -58
- package/src/functions/findEvery.d.ts +0 -2
- package/src/functions/getGenerator.d.ts +0 -2
- package/src/functions/getObject.d.ts +0 -2
- package/src/functions/parseSitemap.js +0 -22
- package/src/html/Anchor.js +0 -71
- package/src/html/CSS.js +0 -104
- package/src/html/DuplicateId.js +0 -49
- package/src/html/Generator.js +0 -45
- package/src/html/Image.js +0 -92
- package/src/html/JavaScript.js +0 -118
- package/src/html/index.js +0 -62
- package/src/logger/Console.d.ts +0 -14
- package/src/request/NodeFetch.js +0 -49
- package/src/request/cache/BlackHoleCache.d.ts +0 -8
- package/src/request/cache/Cache.d.ts +0 -6
- package/src/request/cache/Cache.js +0 -2
- package/src/request/index.js +0 -7
- package/src/security/ContentEncoding.js +0 -58
- package/src/security/ContentSecurityPolicy.js +0 -46
- package/src/security/Cookies.js +0 -58
- package/src/security/FingerPrint.js +0 -51
- package/src/security/GoogleWebRisk.js +0 -58
- package/src/security/HSTS.js +0 -62
- package/src/security/HTTPS.js +0 -73
- package/src/security/HTTPVersion.js +0 -64
- package/src/security/PermissionsPolicy.js +0 -67
- package/src/security/ReferrerPolicy.js +0 -46
- package/src/security/RobotsTXT.js +0 -42
- package/src/security/SSL.js +0 -50
- package/src/security/XFrameOptions.js +0 -46
- package/src/security/XXSSProtection.js +0 -46
- package/src/security/__TESTS__/XFrameOptions.test.js +0 -44
- package/src/seo/Heading.js +0 -65
- package/src/seo/Robots.js +0 -35
- package/src/seo/Sitemap.js +0 -46
- package/src/seo/Title.js +0 -58
- package/src/seo/index.js +0 -58
- package/src/types/Sitemap.d.ts +0 -9
- package/src/types/Sitemap.js +0 -0
- package/src/wordpress/DefaultFiles.js +0 -66
- package/src/wordpress/Generator.js +0 -75
- package/src/wordpress/index.js +0 -54
- /package/{README.md → dist/README.md} +0 -0
- /package/{src → dist}/config.d.ts +0 -0
- /package/{src → dist}/config.js +0 -0
- /package/{src → dist}/dns/A.d.ts +0 -0
- /package/{src → dist}/dns/DMARC.d.ts +0 -0
- /package/{src → dist}/dns/NS.d.ts +0 -0
- /package/{src → dist}/dns/RegistrationDate.d.ts +0 -0
- /package/{src → dist}/dns/index.d.ts +0 -0
- /package/{src → dist}/functions/findEvery.js +0 -0
- /package/{src → dist}/functions/getAnchors.d.ts +0 -0
- /package/{src → dist}/functions/getAnchors.js +0 -0
- /package/{src → dist}/functions/getDomain.d.ts +0 -0
- /package/{src → dist}/functions/getDomain.js +0 -0
- /package/{src → dist}/functions/getDuplicates.d.ts +0 -0
- /package/{src → dist}/functions/getHeading.d.ts +0 -0
- /package/{src → dist}/functions/getImages.d.ts +0 -0
- /package/{src → dist}/functions/getObject.js +0 -0
- /package/{src → dist}/functions/getScripts.d.ts +0 -0
- /package/{src → dist}/functions/getStylesheets.d.ts +0 -0
- /package/{src → dist}/functions/getTitle.d.ts +0 -0
- /package/{src → dist}/functions/index.d.ts +0 -0
- /package/{src → dist}/functions/index.js +0 -0
- /package/{src → dist}/functions/parseHtml.d.ts +0 -0
- /package/{src → dist}/functions/parseSitemap.d.ts +0 -0
- /package/{src → dist}/functions/parseXml.d.ts +0 -0
- /package/{src → dist}/functions/parseXml.js +0 -0
- /package/{src → dist}/html/Anchor.d.ts +0 -0
- /package/{src → dist}/html/CSS.d.ts +0 -0
- /package/{src → dist}/html/DuplicateId.d.ts +0 -0
- /package/{src → dist}/html/Generator.d.ts +0 -0
- /package/{src → dist}/html/Image.d.ts +0 -0
- /package/{src → dist}/html/JavaScript.d.ts +0 -0
- /package/{src → dist}/html/__TESTS__/Generator.test.d.ts +0 -0
- /package/{src → dist}/html/index.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/logger/Logger.d.ts +0 -0
- /package/{src → dist}/logger/Logger.js +0 -0
- /package/{src → dist}/logger/index.d.ts +0 -0
- /package/{src → dist}/logger/index.js +0 -0
- /package/{src → dist}/report/CommandLine.d.ts +0 -0
- /package/{src → dist}/report/CommandLine.js +0 -0
- /package/{src → dist}/report/Json.d.ts +0 -0
- /package/{src → dist}/report/Json.js +0 -0
- /package/{src → dist}/report/Report.d.ts +0 -0
- /package/{src → dist}/report/Report.js +0 -0
- /package/{src → dist}/report/Symbols.d.ts +0 -0
- /package/{src → dist}/report/Symbols.js +0 -0
- /package/{src → dist}/report/index.d.ts +0 -0
- /package/{src → dist}/report/index.js +0 -0
- /package/{src → dist}/request/Request.js +0 -0
- /package/{src → dist}/request/index.d.ts +0 -0
- /package/{src → dist}/security/ContentEncoding.d.ts +0 -0
- /package/{src → dist}/security/ContentSecurityPolicy.d.ts +0 -0
- /package/{src → dist}/security/Cookies.d.ts +0 -0
- /package/{src → dist}/security/FingerPrint.d.ts +0 -0
- /package/{src → dist}/security/GoogleWebRisk.d.ts +0 -0
- /package/{src → dist}/security/HSTS.d.ts +0 -0
- /package/{src → dist}/security/HTTPS.d.ts +0 -0
- /package/{src → dist}/security/HTTPVersion.d.ts +0 -0
- /package/{src → dist}/security/PermissionsPolicy.d.ts +0 -0
- /package/{src → dist}/security/ReferrerPolicy.d.ts +0 -0
- /package/{src → dist}/security/RobotsTXT.d.ts +0 -0
- /package/{src → dist}/security/SSL.d.ts +0 -0
- /package/{src → dist}/security/XFrameOptions.d.ts +0 -0
- /package/{src → dist}/security/XXSSProtection.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/ContentSecurityPolicy.test.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/FingerPrint.test.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/HSTS.test.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/HTTPS.test.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/XFrameOptions.test.d.ts +0 -0
- /package/{src → dist}/security/__TESTS__/XXSSProtection.test.d.ts +0 -0
- /package/{src → dist}/security/index.d.ts +0 -0
- /package/{src → dist}/seo/Heading.d.ts +0 -0
- /package/{src → dist}/seo/Robots.d.ts +0 -0
- /package/{src → dist}/seo/Sitemap.d.ts +0 -0
- /package/{src → dist}/seo/Title.d.ts +0 -0
- /package/{src → dist}/seo/index.d.ts +0 -0
- /package/{src → dist}/wordpress/DefaultFiles.d.ts +0 -0
- /package/{src → dist}/wordpress/Generator.d.ts +0 -0
- /package/{src → dist}/wordpress/index.d.ts +0 -0
package/src/commands/Sitemap.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const request_1 = __importDefault(require("../request"));
|
|
16
|
-
const functions_1 = require("../functions");
|
|
17
|
-
/**
|
|
18
|
-
* Check URL if contains sitemap data. If URL is not direct link
|
|
19
|
-
* to *.xml file, it will try to search it. For example by default
|
|
20
|
-
* it is located in the root of the page (/sitemap.xml) or it can
|
|
21
|
-
* be mentioned in /robots.txt.
|
|
22
|
-
*
|
|
23
|
-
* There are 2 types of sitemap. One is common, which starts with
|
|
24
|
-
* <urlset> tag and then there is sitemap index, wich is used
|
|
25
|
-
* to group multiple sitemap files. This starts with <sitemapindex>
|
|
26
|
-
* tag.
|
|
27
|
-
*
|
|
28
|
-
* Example:
|
|
29
|
-
*
|
|
30
|
-
* <?xml version="1.0" encoding="utf-8"?>
|
|
31
|
-
* <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
32
|
-
* <url>
|
|
33
|
-
* <loc>http://example.com/</loc>
|
|
34
|
-
* </url>
|
|
35
|
-
* </urlset>
|
|
36
|
-
*
|
|
37
|
-
* <?xml version="1.0" encoding="UTF-8"?>
|
|
38
|
-
* <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
39
|
-
* <sitemap>
|
|
40
|
-
* <loc>http://www.example.com/sitemap.xml</loc>
|
|
41
|
-
* </sitemap>
|
|
42
|
-
* </sitemapindex>
|
|
43
|
-
*
|
|
44
|
-
* @see https://en.wikipedia.org/wiki/Sitemaps
|
|
45
|
-
* @see https://www.sitemaps.org/protocol.html
|
|
46
|
-
* @see https://technicalseo.com/tools/docs/robots-txt/
|
|
47
|
-
*/
|
|
48
|
-
class Sitemap {
|
|
49
|
-
run(url) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
/*
|
|
52
|
-
if (!url.endsWith('.xml')) {}
|
|
53
|
-
*/
|
|
54
|
-
const sitemap = yield this.loadSitemap(url);
|
|
55
|
-
// console.log(sitemap);
|
|
56
|
-
return sitemap.urlset.url.map((line) => line.loc[0]);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
searchSitemaps(url) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
// check /sitemap.xml
|
|
62
|
-
// check /robots.txt
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
loadSitemap(url) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const xml = yield request_1.default.get(url);
|
|
68
|
-
const sitemap = yield (0, functions_1.parseXml)(xml);
|
|
69
|
-
if (!this.isIndex(sitemap)) {
|
|
70
|
-
return sitemap;
|
|
71
|
-
}
|
|
72
|
-
const sitemapUrls = this.getSitemapUrls(sitemap);
|
|
73
|
-
return this.loadMultiple(sitemapUrls);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
isIndex(sitemap) {
|
|
77
|
-
return 'sitemapindex' in sitemap;
|
|
78
|
-
}
|
|
79
|
-
getSitemapUrls(sitemapIndex) {
|
|
80
|
-
return sitemapIndex.sitemapindex.sitemap.map((sitemap) => sitemap.loc[0]);
|
|
81
|
-
}
|
|
82
|
-
loadMultiple(sitemapUrls) {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const sitemaps = yield Promise.all(sitemapUrls.map((sitemapUrl) => __awaiter(this, void 0, void 0, function* () { return yield this.loadSitemap(sitemapUrl); })));
|
|
85
|
-
const urls = sitemaps.map((s) => s.urlset.url).reduce((arr, s) => arr.concat(s), []);
|
|
86
|
-
return {
|
|
87
|
-
urlset: {
|
|
88
|
-
url: urls,
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.default = Sitemap;
|
package/src/dns/A.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const dns_1 = __importDefault(require("dns"));
|
|
16
|
-
const whois_1 = __importDefault(require("whois"));
|
|
17
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
18
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
19
|
-
class A extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'A';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
-
const response = yield new Promise((resolve, reject) => {
|
|
28
|
-
dns_1.default.lookup((new URL(url).hostname), { all: true }, (err, addresses) => {
|
|
29
|
-
if (err) {
|
|
30
|
-
return reject(err);
|
|
31
|
-
}
|
|
32
|
-
resolve(addresses);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
const addresses = yield Promise.all(response.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const organization = yield this.getOrganization(address.address);
|
|
37
|
-
return `${address.address} - ${organization}`;
|
|
38
|
-
})));
|
|
39
|
-
return {
|
|
40
|
-
status: 'SUCCESS',
|
|
41
|
-
title: this.constructor.name,
|
|
42
|
-
description: addresses.join('\n'),
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
getOrganization(ip) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const organization = yield new Promise((resolve, reject) => {
|
|
49
|
-
whois_1.default.lookup(ip, function (err, data) {
|
|
50
|
-
if (err) {
|
|
51
|
-
return reject(err);
|
|
52
|
-
}
|
|
53
|
-
const organization = data.split('\n')
|
|
54
|
-
.filter((line) => line.includes('OrgName'))
|
|
55
|
-
.map((line) => line.split(':')[1].trim())
|
|
56
|
-
.pop();
|
|
57
|
-
resolve(organization);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
return organization;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.default = A;
|
package/src/dns/DMARC.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const dns_1 = __importDefault(require("dns"));
|
|
16
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
const getDomain_1 = __importDefault(require("../functions/getDomain"));
|
|
19
|
-
class DMARC extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'DMARC';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
-
const response = yield new Promise((resolve, reject) => {
|
|
28
|
-
dns_1.default.resolveTxt(`_dmarc.${(0, getDomain_1.default)(url)}`, (err, records) => {
|
|
29
|
-
if (err) {
|
|
30
|
-
return reject(err);
|
|
31
|
-
}
|
|
32
|
-
resolve(records);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
if (response.length === 0) {
|
|
36
|
-
return {
|
|
37
|
-
status: 'WARNING',
|
|
38
|
-
title: this.constructor.name,
|
|
39
|
-
description: 'No DMARC record found for this domain.',
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const record = response.shift().shift();
|
|
43
|
-
if (record.includes('p=none')) {
|
|
44
|
-
return {
|
|
45
|
-
status: 'ERROR',
|
|
46
|
-
title: this.constructor.name,
|
|
47
|
-
description: 'Email that fails DMARC Compliance tests will be delivered to the recipient\'s inbox.',
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (record.includes('p=quarantine')) {
|
|
51
|
-
return {
|
|
52
|
-
status: 'WARNING',
|
|
53
|
-
title: this.constructor.name,
|
|
54
|
-
description: 'Email that fails DMARC Compliance tests will be marked as spam.',
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
if (record.includes('p=reject')) {
|
|
58
|
-
return {
|
|
59
|
-
status: 'SUCCESS',
|
|
60
|
-
title: this.constructor.name,
|
|
61
|
-
description: 'Email that fails DMARC Compliance tests will be rejected.',
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
status: 'ERROR',
|
|
66
|
-
title: this.constructor.name,
|
|
67
|
-
description: 'Invalid DMARC policy found!',
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.default = DMARC;
|
package/src/dns/NS.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const whois_1 = __importDefault(require("whois"));
|
|
16
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
const getDomain_1 = __importDefault(require("../functions/getDomain"));
|
|
19
|
-
class NS extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'NS';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
-
const nameServers = yield this.getNameServers((0, getDomain_1.default)(url));
|
|
28
|
-
return {
|
|
29
|
-
status: 'SUCCESS',
|
|
30
|
-
title: this.constructor.name,
|
|
31
|
-
description: nameServers.join('\n'),
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
getNameServers(domain) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const nameServers = yield new Promise((resolve, reject) => {
|
|
38
|
-
whois_1.default.lookup(domain, function (err, data) {
|
|
39
|
-
if (err) {
|
|
40
|
-
return reject(err);
|
|
41
|
-
}
|
|
42
|
-
const nameServers = data.split('\n')
|
|
43
|
-
.filter((line) => line.includes('Name Server'))
|
|
44
|
-
.map((line) => line.split(':')[1].trim());
|
|
45
|
-
resolve(nameServers);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return nameServers;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.default = NS;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const whois_1 = __importDefault(require("whois"));
|
|
16
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
const getDomain_1 = __importDefault(require("../functions/getDomain"));
|
|
19
|
-
class RegistrationDate extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'RegistrationDate';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
-
const registrationDate = yield this.getRegistrationDate((0, getDomain_1.default)(url));
|
|
28
|
-
const diffInMs = (new Date(registrationDate)).getTime() - (new Date()).getTime();
|
|
29
|
-
const diffInDays = diffInMs / (1000 * 60 * 60 * 24);
|
|
30
|
-
return {
|
|
31
|
-
status: diffInDays < 7 ? 'ERROR' : diffInDays < 30 ? 'WARNING' : 'SUCCESS',
|
|
32
|
-
title: this.constructor.name,
|
|
33
|
-
description: `Approximately ${Math.floor(diffInDays)} days until domain expires.`,
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
getRegistrationDate(domain) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const date = yield new Promise((resolve, reject) => {
|
|
40
|
-
whois_1.default.lookup(domain, function (err, data) {
|
|
41
|
-
if (err) {
|
|
42
|
-
return reject(err);
|
|
43
|
-
}
|
|
44
|
-
const d = data.split('\n')
|
|
45
|
-
.filter((line) => line.includes('Expiration Date'))
|
|
46
|
-
.map((line) => line.split(': ')[1].trim())
|
|
47
|
-
.shift();
|
|
48
|
-
resolve(d);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
return date;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.default = RegistrationDate;
|
package/src/dns/index.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
16
|
-
const A_1 = __importDefault(require("./A"));
|
|
17
|
-
const NS_1 = __importDefault(require("./NS"));
|
|
18
|
-
const DMARC_1 = __importDefault(require("./DMARC"));
|
|
19
|
-
const RegistrationDate_1 = __importDefault(require("./RegistrationDate"));
|
|
20
|
-
class DNS extends Test_1.default {
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
this.name = 'DNS';
|
|
24
|
-
this.tests = [
|
|
25
|
-
new RegistrationDate_1.default(),
|
|
26
|
-
new NS_1.default(),
|
|
27
|
-
new A_1.default(),
|
|
28
|
-
new DMARC_1.default(),
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
test(params) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const tests = this.getTests();
|
|
34
|
-
const results = [];
|
|
35
|
-
for (const test of tests) {
|
|
36
|
-
let result = null;
|
|
37
|
-
try {
|
|
38
|
-
result = yield test.run(params);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
result = {
|
|
42
|
-
status: 'ERROR',
|
|
43
|
-
title: test.name,
|
|
44
|
-
description: 'Test failed or cannot be run!',
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
results.push(result);
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
status: this.getStatus(results.map(result => result.status)),
|
|
51
|
-
title: this.name,
|
|
52
|
-
description: '',
|
|
53
|
-
results,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = DNS;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.default = default_1;
|
|
16
|
-
const parseXml_1 = __importDefault(require("./parseXml"));
|
|
17
|
-
function default_1(sitemap) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
const data = yield (0, parseXml_1.default)(sitemap);
|
|
20
|
-
return data.urlset.url.map((url) => url.loc[0]);
|
|
21
|
-
});
|
|
22
|
-
}
|
package/src/html/Anchor.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
16
|
-
const request_1 = __importDefault(require("../request"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
const functions_1 = require("../functions");
|
|
19
|
-
class Anchor extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'Anchor';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
-
const response = yield request_1.default.get(url);
|
|
28
|
-
const html = yield (0, functions_1.parseHtml)(response);
|
|
29
|
-
const anchors = (0, functions_1.getAnchors)(html);
|
|
30
|
-
const subTests = yield this.check(anchors);
|
|
31
|
-
return {
|
|
32
|
-
status: this.getStatus(subTests.map(test => test.status)),
|
|
33
|
-
title: this.constructor.name,
|
|
34
|
-
description: '',
|
|
35
|
-
results: subTests,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
check(anchors) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const results = [];
|
|
42
|
-
for (const anchor of anchors) {
|
|
43
|
-
logger_1.default.verbose(`Checking ${anchor}...`);
|
|
44
|
-
const result = yield request_1.default.get(anchor);
|
|
45
|
-
const isFileAvailabe = {
|
|
46
|
-
status: this.isFileAvailable(result) ? 'SUCCESS' : 'ERROR',
|
|
47
|
-
title: 'Available',
|
|
48
|
-
description: '',
|
|
49
|
-
};
|
|
50
|
-
results.push({
|
|
51
|
-
status: this.getStatus([
|
|
52
|
-
isFileAvailabe.status,
|
|
53
|
-
]),
|
|
54
|
-
title: anchor,
|
|
55
|
-
description: '',
|
|
56
|
-
results: [
|
|
57
|
-
isFileAvailabe,
|
|
58
|
-
],
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return results;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
isFileAvailable(result) {
|
|
65
|
-
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.default = Anchor;
|
package/src/html/CSS.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const csso_1 = __importDefault(require("csso"));
|
|
16
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
17
|
-
const request_1 = __importDefault(require("../request"));
|
|
18
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
19
|
-
const functions_1 = require("../functions");
|
|
20
|
-
class CSS extends Test_1.default {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.name = 'CSS';
|
|
24
|
-
}
|
|
25
|
-
test(_a) {
|
|
26
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
27
|
-
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
28
|
-
const response = yield request_1.default.get(url);
|
|
29
|
-
const html = yield (0, functions_1.parseHtml)(response);
|
|
30
|
-
const stylesheets = (0, functions_1.getStylesheets)(html);
|
|
31
|
-
const subTests = yield this.check(stylesheets);
|
|
32
|
-
return {
|
|
33
|
-
status: this.getStatus(subTests.map(test => test.status)),
|
|
34
|
-
title: this.constructor.name,
|
|
35
|
-
description: '',
|
|
36
|
-
results: subTests,
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
check(stylesheets) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const results = [];
|
|
43
|
-
for (const stylesheet of stylesheets) {
|
|
44
|
-
const filename = stylesheet.substr(stylesheet.lastIndexOf('/') + 1);
|
|
45
|
-
logger_1.default.verbose(`Checking ${filename}...`);
|
|
46
|
-
const result = yield request_1.default.get(stylesheet);
|
|
47
|
-
const isFileAvailabe = {
|
|
48
|
-
status: this.isFileAvailable(result) ? 'SUCCESS' : 'ERROR',
|
|
49
|
-
title: 'Available',
|
|
50
|
-
description: '',
|
|
51
|
-
};
|
|
52
|
-
const isCached = {
|
|
53
|
-
status: this.isCached(result) ? 'SUCCESS' : 'ERROR',
|
|
54
|
-
title: 'Cached',
|
|
55
|
-
description: '',
|
|
56
|
-
};
|
|
57
|
-
const hasXContentTypeOptionsHeader = {
|
|
58
|
-
status: this.hasXContentTypeOptionsHeader(result) ? 'SUCCESS' : 'WARNING',
|
|
59
|
-
title: 'X-Content-Type-Options',
|
|
60
|
-
description: '',
|
|
61
|
-
};
|
|
62
|
-
const isMinified = {
|
|
63
|
-
status: this.isMinified(result) ? 'SUCCESS' : 'WARNING',
|
|
64
|
-
title: 'Minified',
|
|
65
|
-
description: '',
|
|
66
|
-
};
|
|
67
|
-
results.push({
|
|
68
|
-
status: this.getStatus([
|
|
69
|
-
isFileAvailabe.status,
|
|
70
|
-
isCached.status,
|
|
71
|
-
hasXContentTypeOptionsHeader.status,
|
|
72
|
-
isMinified.status,
|
|
73
|
-
]),
|
|
74
|
-
title: filename,
|
|
75
|
-
description: '',
|
|
76
|
-
results: [
|
|
77
|
-
isFileAvailabe,
|
|
78
|
-
isCached,
|
|
79
|
-
hasXContentTypeOptionsHeader,
|
|
80
|
-
isMinified,
|
|
81
|
-
],
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return results;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
isFileAvailable(result) {
|
|
88
|
-
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
isCached(result) {
|
|
94
|
-
return result.response.headers.has('cache-control');
|
|
95
|
-
}
|
|
96
|
-
hasXContentTypeOptionsHeader(result) {
|
|
97
|
-
return result.response.headers.has('x-content-type-options');
|
|
98
|
-
}
|
|
99
|
-
isMinified(result) {
|
|
100
|
-
const r = csso_1.default.minify(result.body, { restructure: false }).css;
|
|
101
|
-
return r.length === result.body.length;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.default = CSS;
|
package/src/html/DuplicateId.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const Test_1 = __importDefault(require("../Test"));
|
|
16
|
-
const request_1 = __importDefault(require("../request"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
const functions_1 = require("../functions");
|
|
19
|
-
class DuplicateId extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'Duplicate ID';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info('Starting DuplicateId test...');
|
|
27
|
-
const response = yield request_1.default.get(url);
|
|
28
|
-
const duplicates = yield (0, functions_1.getDuplicates)(response);
|
|
29
|
-
if (duplicates.length > 0) {
|
|
30
|
-
return {
|
|
31
|
-
status: 'WARNING',
|
|
32
|
-
title: 'Duplicate IDs',
|
|
33
|
-
description: '',
|
|
34
|
-
results: duplicates.map(duplicate => ({
|
|
35
|
-
status: 'WARNING',
|
|
36
|
-
title: `<${duplicate.name} id="${duplicate.attribs.id}" ... />`,
|
|
37
|
-
description: '',
|
|
38
|
-
}))
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
status: 'SUCCESS',
|
|
43
|
-
title: 'Duplicate IDs',
|
|
44
|
-
description: ''
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.default = DuplicateId;
|