pentest-tool-lite 3.9.2 → 3.10.6
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/dist/package.json +61 -0
- package/{src → dist/src}/Pentest.d.ts +1 -0
- package/{src → dist/src}/Pentest.js +19 -5
- package/{src → dist/src}/Test.d.ts +1 -0
- package/{src → dist/src}/Test.js +5 -7
- package/{src → dist/src}/commands/Sitemap.d.ts +4 -4
- package/{src → dist/src}/commands/Sitemap.js +3 -1
- package/{src → dist/src}/dns/A.js +4 -3
- package/{src → dist/src}/dns/DMARC.js +2 -1
- package/{src → dist/src}/dns/NS.js +2 -2
- package/{src → dist/src}/dns/RegistrationDate.js +3 -3
- package/{src → dist/src}/dns/index.js +1 -1
- package/dist/src/functions/findEvery.d.ts +2 -0
- package/{src → dist/src}/functions/getDuplicates.js +1 -0
- package/dist/src/functions/getGenerator.d.ts +2 -0
- package/{src → dist/src}/functions/getGenerator.js +3 -0
- package/{src → dist/src}/functions/getHeading.js +4 -0
- package/{src → dist/src}/functions/getImages.js +1 -0
- package/dist/src/functions/getObject.d.ts +2 -0
- package/{src → dist/src}/functions/getScripts.js +1 -0
- package/{src → dist/src}/functions/getStylesheets.js +1 -0
- package/{src → dist/src}/functions/getTitle.js +1 -0
- package/{src → dist/src}/functions/parseHtml.js +4 -0
- package/{src → dist/src}/functions/parseSitemap.js +1 -0
- package/{src → dist/src}/functions/parseXml.js +1 -1
- package/{src → dist/src}/html/Anchor.js +2 -1
- package/{src → dist/src}/html/CSS.js +6 -2
- package/{src → dist/src}/html/Image.js +5 -2
- package/{src → dist/src}/html/JavaScript.js +6 -1
- package/{src → dist/src}/html/__TESTS__/Generator.test.js +2 -0
- package/{src → dist/src}/html/index.js +1 -1
- package/{src → dist/src}/index +18 -8
- package/dist/src/logger/Console.d.ts +14 -0
- package/{src → dist/src}/logger/Console.js +12 -12
- package/dist/src/metadata/HTML.d.ts +6 -0
- package/dist/src/metadata/HTML.js +40 -0
- package/dist/src/metadata/Markdown.d.ts +6 -0
- package/dist/src/metadata/Markdown.js +42 -0
- package/dist/src/metadata/ResponseTime.d.ts +6 -0
- package/dist/src/metadata/ResponseTime.js +39 -0
- package/dist/src/metadata/index.d.ts +6 -0
- package/dist/src/metadata/index.js +56 -0
- package/{src → dist/src}/request/NodeFetch.d.ts +2 -0
- package/{src → dist/src}/request/NodeFetch.js +26 -7
- package/{src → dist/src}/request/Request.d.ts +2 -0
- package/dist/src/request/cache/BlackHoleCache.d.ts +7 -0
- package/{src → dist/src}/request/cache/BlackHoleCache.js +4 -3
- package/{src → dist/src}/request/cache/UnlimitedCache.d.ts +1 -2
- package/{src → dist/src}/request/cache/UnlimitedCache.js +2 -0
- package/dist/src/request/index.js +11 -0
- package/{src → dist/src}/security/HTTPS.js +19 -0
- package/dist/src/security/Redirect.d.ts +6 -0
- package/dist/src/security/Redirect.js +51 -0
- package/{src → dist/src}/security/__TESTS__/ContentSecurityPolicy.test.js +2 -0
- package/{src → dist/src}/security/__TESTS__/FingerPrint.test.js +2 -0
- package/{src → dist/src}/security/__TESTS__/HSTS.test.js +3 -0
- package/{src → dist/src}/security/__TESTS__/HTTPS.test.js +3 -0
- package/{src → dist/src}/security/__TESTS__/XFrameOptions.test.js +2 -0
- package/{src → dist/src}/security/__TESTS__/XXSSProtection.test.js +2 -0
- package/{src → dist/src}/security/index.js +5 -7
- package/{src → dist/src}/seo/Heading.js +1 -1
- package/{src → dist/src}/seo/Title.js +1 -1
- package/{src → dist/src}/seo/index.js +1 -1
- package/{src → dist/src}/wordpress/Generator.js +2 -1
- package/{src → dist/src}/wordpress/index.js +1 -1
- package/package.json +60 -59
- 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/logger/Console.d.ts +0 -14
- 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/types/Sitemap.d.ts +0 -9
- package/src/types/Sitemap.js +0 -0
- /package/{README.md → dist/README.md} +0 -0
- /package/{src → dist/src}/config.d.ts +0 -0
- /package/{src → dist/src}/config.js +0 -0
- /package/{src → dist/src}/dns/A.d.ts +0 -0
- /package/{src → dist/src}/dns/DMARC.d.ts +0 -0
- /package/{src → dist/src}/dns/NS.d.ts +0 -0
- /package/{src → dist/src}/dns/RegistrationDate.d.ts +0 -0
- /package/{src → dist/src}/dns/index.d.ts +0 -0
- /package/{src → dist/src}/functions/findEvery.js +0 -0
- /package/{src → dist/src}/functions/getAnchors.d.ts +0 -0
- /package/{src → dist/src}/functions/getAnchors.js +0 -0
- /package/{src → dist/src}/functions/getDomain.d.ts +0 -0
- /package/{src → dist/src}/functions/getDomain.js +0 -0
- /package/{src → dist/src}/functions/getDuplicates.d.ts +0 -0
- /package/{src → dist/src}/functions/getHeading.d.ts +0 -0
- /package/{src → dist/src}/functions/getImages.d.ts +0 -0
- /package/{src → dist/src}/functions/getObject.js +0 -0
- /package/{src → dist/src}/functions/getScripts.d.ts +0 -0
- /package/{src → dist/src}/functions/getStylesheets.d.ts +0 -0
- /package/{src → dist/src}/functions/getTitle.d.ts +0 -0
- /package/{src → dist/src}/functions/index.d.ts +0 -0
- /package/{src → dist/src}/functions/index.js +0 -0
- /package/{src → dist/src}/functions/parseHtml.d.ts +0 -0
- /package/{src → dist/src}/functions/parseSitemap.d.ts +0 -0
- /package/{src → dist/src}/functions/parseXml.d.ts +0 -0
- /package/{src → dist/src}/html/Anchor.d.ts +0 -0
- /package/{src → dist/src}/html/CSS.d.ts +0 -0
- /package/{src → dist/src}/html/DuplicateId.d.ts +0 -0
- /package/{src → dist/src}/html/DuplicateId.js +0 -0
- /package/{src → dist/src}/html/Generator.d.ts +0 -0
- /package/{src → dist/src}/html/Generator.js +0 -0
- /package/{src → dist/src}/html/Image.d.ts +0 -0
- /package/{src → dist/src}/html/JavaScript.d.ts +0 -0
- /package/{src → dist/src}/html/__TESTS__/Generator.test.d.ts +0 -0
- /package/{src → dist/src}/html/index.d.ts +0 -0
- /package/{src → dist/src}/index.d.ts +0 -0
- /package/{src → dist/src}/logger/Logger.d.ts +0 -0
- /package/{src → dist/src}/logger/Logger.js +0 -0
- /package/{src → dist/src}/logger/index.d.ts +0 -0
- /package/{src → dist/src}/logger/index.js +0 -0
- /package/{src → dist/src}/report/CommandLine.d.ts +0 -0
- /package/{src → dist/src}/report/CommandLine.js +0 -0
- /package/{src → dist/src}/report/Json.d.ts +0 -0
- /package/{src → dist/src}/report/Json.js +0 -0
- /package/{src → dist/src}/report/Report.d.ts +0 -0
- /package/{src → dist/src}/report/Report.js +0 -0
- /package/{src → dist/src}/report/Symbols.d.ts +0 -0
- /package/{src → dist/src}/report/Symbols.js +0 -0
- /package/{src → dist/src}/report/index.d.ts +0 -0
- /package/{src → dist/src}/report/index.js +0 -0
- /package/{src → dist/src}/request/Request.js +0 -0
- /package/{src → dist/src}/request/index.d.ts +0 -0
- /package/{src → dist/src}/security/ContentEncoding.d.ts +0 -0
- /package/{src → dist/src}/security/ContentEncoding.js +0 -0
- /package/{src → dist/src}/security/ContentSecurityPolicy.d.ts +0 -0
- /package/{src → dist/src}/security/ContentSecurityPolicy.js +0 -0
- /package/{src → dist/src}/security/Cookies.d.ts +0 -0
- /package/{src → dist/src}/security/Cookies.js +0 -0
- /package/{src → dist/src}/security/FingerPrint.d.ts +0 -0
- /package/{src → dist/src}/security/FingerPrint.js +0 -0
- /package/{src → dist/src}/security/GoogleWebRisk.d.ts +0 -0
- /package/{src → dist/src}/security/GoogleWebRisk.js +0 -0
- /package/{src → dist/src}/security/HSTS.d.ts +0 -0
- /package/{src → dist/src}/security/HSTS.js +0 -0
- /package/{src → dist/src}/security/HTTPS.d.ts +0 -0
- /package/{src → dist/src}/security/HTTPVersion.d.ts +0 -0
- /package/{src → dist/src}/security/HTTPVersion.js +0 -0
- /package/{src → dist/src}/security/PermissionsPolicy.d.ts +0 -0
- /package/{src → dist/src}/security/PermissionsPolicy.js +0 -0
- /package/{src → dist/src}/security/ReferrerPolicy.d.ts +0 -0
- /package/{src → dist/src}/security/ReferrerPolicy.js +0 -0
- /package/{src → dist/src}/security/RobotsTXT.d.ts +0 -0
- /package/{src → dist/src}/security/RobotsTXT.js +0 -0
- /package/{src → dist/src}/security/SSL.d.ts +0 -0
- /package/{src → dist/src}/security/SSL.js +0 -0
- /package/{src → dist/src}/security/XFrameOptions.d.ts +0 -0
- /package/{src → dist/src}/security/XFrameOptions.js +0 -0
- /package/{src → dist/src}/security/XXSSProtection.d.ts +0 -0
- /package/{src → dist/src}/security/XXSSProtection.js +0 -0
- /package/{src → dist/src}/security/__TESTS__/ContentSecurityPolicy.test.d.ts +0 -0
- /package/{src → dist/src}/security/__TESTS__/FingerPrint.test.d.ts +0 -0
- /package/{src → dist/src}/security/__TESTS__/HSTS.test.d.ts +0 -0
- /package/{src → dist/src}/security/__TESTS__/HTTPS.test.d.ts +0 -0
- /package/{src → dist/src}/security/__TESTS__/XFrameOptions.test.d.ts +0 -0
- /package/{src → dist/src}/security/__TESTS__/XXSSProtection.test.d.ts +0 -0
- /package/{src → dist/src}/security/index.d.ts +0 -0
- /package/{src → dist/src}/seo/Heading.d.ts +0 -0
- /package/{src → dist/src}/seo/Robots.d.ts +0 -0
- /package/{src → dist/src}/seo/Robots.js +0 -0
- /package/{src → dist/src}/seo/Sitemap.d.ts +0 -0
- /package/{src → dist/src}/seo/Sitemap.js +0 -0
- /package/{src → dist/src}/seo/Title.d.ts +0 -0
- /package/{src → dist/src}/seo/index.d.ts +0 -0
- /package/{src → dist/src}/wordpress/DefaultFiles.d.ts +0 -0
- /package/{src → dist/src}/wordpress/DefaultFiles.js +0 -0
- /package/{src → dist/src}/wordpress/Generator.d.ts +0 -0
- /package/{src → dist/src}/wordpress/index.d.ts +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2017 juffalow
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pentest-tool-lite",
|
|
3
|
+
"description": "Check your website ( or any other website ) for common vulnerabilities.",
|
|
4
|
+
"version": "3.10.6",
|
|
5
|
+
"homepage": "https://pentest-tool-lite.com",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Matej Jellus",
|
|
9
|
+
"email": "juffalow@juffalow.com",
|
|
10
|
+
"url": "https://juffalow.com"
|
|
11
|
+
},
|
|
12
|
+
"bin": "./src/index",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@google-cloud/web-risk": "^4.0.1",
|
|
15
|
+
"commander": "^6.0.0",
|
|
16
|
+
"csso": "^5.0.5",
|
|
17
|
+
"domhandler": "^4.2.2",
|
|
18
|
+
"htmlparser2": "^7.1.2",
|
|
19
|
+
"node-html-markdown": "^2.0.0",
|
|
20
|
+
"ssl-checker": "^2.0.7",
|
|
21
|
+
"uglify-js": "^3.6.1",
|
|
22
|
+
"whois": "^2.14.2",
|
|
23
|
+
"xml2js": "^0.6.2"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/juffalow/pentest-tool-lite.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/juffalow/pentest-tool-lite/issues"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"start": "tsc && node dist/src/index.js",
|
|
34
|
+
"start-build": "tsc -w --preserveWatchOutput",
|
|
35
|
+
"start-test": "node dist/src/index.js",
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"lint": "eslint",
|
|
38
|
+
"test": "jest"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@eslint/js": "^9.17.0",
|
|
42
|
+
"@types/jest": "^29.4.0",
|
|
43
|
+
"@types/node": "^22.5.0",
|
|
44
|
+
"@types/uglify-js": "^3.0.4",
|
|
45
|
+
"@types/xml2js": "^0.4.5",
|
|
46
|
+
"eslint": "^9.17.0",
|
|
47
|
+
"globals": "^15.14.0",
|
|
48
|
+
"jest": "^29.4.3",
|
|
49
|
+
"ts-jest": "^29.0.5",
|
|
50
|
+
"typescript": "^5.2.2",
|
|
51
|
+
"typescript-eslint": "^8.18.1"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"pentest-tool",
|
|
55
|
+
"pentesting",
|
|
56
|
+
"penetration-test",
|
|
57
|
+
"analyzer",
|
|
58
|
+
"analyser"
|
|
59
|
+
],
|
|
60
|
+
"packageManager": "yarn@4.12.0"
|
|
61
|
+
}
|
|
@@ -17,6 +17,7 @@ const dns_1 = __importDefault(require("./dns"));
|
|
|
17
17
|
const html_1 = __importDefault(require("./html"));
|
|
18
18
|
const seo_1 = __importDefault(require("./seo"));
|
|
19
19
|
const wordpress_1 = __importDefault(require("./wordpress"));
|
|
20
|
+
const metadata_1 = __importDefault(require("./metadata"));
|
|
20
21
|
class Pentest {
|
|
21
22
|
run(url) {
|
|
22
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -25,17 +26,30 @@ class Pentest {
|
|
|
25
26
|
const html = new html_1.default();
|
|
26
27
|
const seo = new seo_1.default();
|
|
27
28
|
const wordPress = new wordpress_1.default();
|
|
28
|
-
const
|
|
29
|
-
const securityResult = yield
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const metadata = new metadata_1.default();
|
|
30
|
+
const [generalResult, securityResult, htmlResult, seoResult, wordPressResult, metadataResult] = yield Promise.all([
|
|
31
|
+
general.run({ url }),
|
|
32
|
+
security.run({ url }),
|
|
33
|
+
html.run({ url }),
|
|
34
|
+
seo.run({ url }),
|
|
35
|
+
wordPress.run({ url }),
|
|
36
|
+
metadata.run({ url }),
|
|
37
|
+
]);
|
|
38
|
+
// const [ generalResult, securityResult, htmlResult, seoResult, wordPressResult ] = result.map(promise => promise.status === 'fulfilled' ? promise.value : {});
|
|
39
|
+
// const [ generalResult, securityResult, htmlResult, seoResult, wordPressResult ] = result;
|
|
40
|
+
// const generalResult = <Result> await general.run({ url });
|
|
41
|
+
// const securityResult = <Result> await security.run({ url });
|
|
42
|
+
// const htmlResult = <Result> await html.run({ url });
|
|
43
|
+
// const seoResult = <Result> await seo.run({ url });
|
|
44
|
+
// const wordPressResult = <Result> await wordPress.run({ url });
|
|
45
|
+
// console.log(metadataResult);
|
|
33
46
|
return {
|
|
34
47
|
security: securityResult,
|
|
35
48
|
dns: generalResult,
|
|
36
49
|
html: htmlResult,
|
|
37
50
|
seo: seoResult,
|
|
38
51
|
wordpress: wordPressResult,
|
|
52
|
+
metadata: metadataResult,
|
|
39
53
|
};
|
|
40
54
|
});
|
|
41
55
|
}
|
package/{src → dist/src}/Test.js
RENAMED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const config_1 = __importDefault(require("./config"));
|
|
16
|
+
const logger_1 = __importDefault(require("./logger"));
|
|
16
17
|
/**
|
|
17
18
|
* @see https://stackoverflow.com/questions/13651945/what-is-the-use-of-module-parent-in-node-js-how-can-i-refer-to-the-requireing
|
|
18
19
|
*/
|
|
@@ -23,18 +24,15 @@ class Test {
|
|
|
23
24
|
}
|
|
24
25
|
run(params) {
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
result = yield this.test(params);
|
|
29
|
-
}
|
|
30
|
-
catch (err) {
|
|
27
|
+
logger_1.default.debug(`Running ${this.name} tests...`);
|
|
28
|
+
const result = yield this.test(params).catch((err) => {
|
|
31
29
|
console.error(err);
|
|
32
|
-
|
|
30
|
+
return {
|
|
33
31
|
status: 'ERROR',
|
|
34
32
|
title: test.name,
|
|
35
33
|
description: 'Test failed or cannot be run!',
|
|
36
34
|
};
|
|
37
|
-
}
|
|
35
|
+
});
|
|
38
36
|
return result;
|
|
39
37
|
});
|
|
40
38
|
}
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
*/
|
|
32
32
|
declare class Sitemap {
|
|
33
33
|
run(url: string): Promise<string[]>;
|
|
34
|
-
protected searchSitemaps(
|
|
35
|
-
protected loadSitemap(url: string): Promise<
|
|
36
|
-
protected isIndex(sitemap:
|
|
34
|
+
protected searchSitemaps(): Promise<void>;
|
|
35
|
+
protected loadSitemap(url: string): Promise<SitemapFile>;
|
|
36
|
+
protected isIndex(sitemap: SitemapFile): boolean;
|
|
37
37
|
protected getSitemapUrls(sitemapIndex: any): string[];
|
|
38
|
-
protected loadMultiple(sitemapUrls: string[]): Promise<
|
|
38
|
+
protected loadMultiple(sitemapUrls: string[]): Promise<SitemapFile>;
|
|
39
39
|
}
|
|
40
40
|
export default Sitemap;
|
|
@@ -56,7 +56,7 @@ class Sitemap {
|
|
|
56
56
|
return sitemap.urlset.url.map((line) => line.loc[0]);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
searchSitemaps(
|
|
59
|
+
searchSitemaps() {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
// check /sitemap.xml
|
|
62
62
|
// check /robots.txt
|
|
@@ -76,7 +76,9 @@ class Sitemap {
|
|
|
76
76
|
isIndex(sitemap) {
|
|
77
77
|
return 'sitemapindex' in sitemap;
|
|
78
78
|
}
|
|
79
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
79
80
|
getSitemapUrls(sitemapIndex) {
|
|
81
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
80
82
|
return sitemapIndex.sitemapindex.sitemap.map((sitemap) => sitemap.loc[0]);
|
|
81
83
|
}
|
|
82
84
|
loadMultiple(sitemapUrls) {
|
|
@@ -27,11 +27,12 @@ class A extends Test_1.default {
|
|
|
27
27
|
const response = yield new Promise((resolve, reject) => {
|
|
28
28
|
dns_1.default.lookup((new URL(url).hostname), { all: true }, (err, addresses) => {
|
|
29
29
|
if (err) {
|
|
30
|
-
reject(err);
|
|
30
|
+
return reject(err);
|
|
31
31
|
}
|
|
32
32
|
resolve(addresses);
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
35
36
|
const addresses = yield Promise.all(response.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
36
37
|
const organization = yield this.getOrganization(address.address);
|
|
37
38
|
return `${address.address} - ${organization}`;
|
|
@@ -48,9 +49,9 @@ class A extends Test_1.default {
|
|
|
48
49
|
const organization = yield new Promise((resolve, reject) => {
|
|
49
50
|
whois_1.default.lookup(ip, function (err, data) {
|
|
50
51
|
if (err) {
|
|
51
|
-
reject(err);
|
|
52
|
+
return reject(err);
|
|
52
53
|
}
|
|
53
|
-
const organization = data.split('\n')
|
|
54
|
+
const organization = (typeof data === 'string' ? data.split('\n') : data)
|
|
54
55
|
.filter((line) => line.includes('OrgName'))
|
|
55
56
|
.map((line) => line.split(':')[1].trim())
|
|
56
57
|
.pop();
|
|
@@ -24,10 +24,11 @@ class DMARC extends Test_1.default {
|
|
|
24
24
|
test(_a) {
|
|
25
25
|
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
26
|
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
27
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
27
28
|
const response = yield new Promise((resolve, reject) => {
|
|
28
29
|
dns_1.default.resolveTxt(`_dmarc.${(0, getDomain_1.default)(url)}`, (err, records) => {
|
|
29
30
|
if (err) {
|
|
30
|
-
reject(err);
|
|
31
|
+
return reject(err);
|
|
31
32
|
}
|
|
32
33
|
resolve(records);
|
|
33
34
|
});
|
|
@@ -37,9 +37,9 @@ class NS extends Test_1.default {
|
|
|
37
37
|
const nameServers = yield new Promise((resolve, reject) => {
|
|
38
38
|
whois_1.default.lookup(domain, function (err, data) {
|
|
39
39
|
if (err) {
|
|
40
|
-
reject(err);
|
|
40
|
+
return reject(err);
|
|
41
41
|
}
|
|
42
|
-
const nameServers = data.split('\n')
|
|
42
|
+
const nameServers = (typeof data === 'string' ? data.split('\n') : data)
|
|
43
43
|
.filter((line) => line.includes('Name Server'))
|
|
44
44
|
.map((line) => line.split(':')[1].trim());
|
|
45
45
|
resolve(nameServers);
|
|
@@ -39,10 +39,10 @@ class RegistrationDate extends Test_1.default {
|
|
|
39
39
|
const date = yield new Promise((resolve, reject) => {
|
|
40
40
|
whois_1.default.lookup(domain, function (err, data) {
|
|
41
41
|
if (err) {
|
|
42
|
-
reject(err);
|
|
42
|
+
return reject(err);
|
|
43
43
|
}
|
|
44
|
-
const d = data.split('\n')
|
|
45
|
-
.filter((line) => line.includes('Expiration Date'))
|
|
44
|
+
const d = (typeof data === 'string' ? data.split('\n') : data)
|
|
45
|
+
.filter((line) => line.includes('Expiration Date') || line.includes('Valid Until'))
|
|
46
46
|
.map((line) => line.split(': ')[1].trim())
|
|
47
47
|
.shift();
|
|
48
48
|
resolve(d);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const htmlparser2_1 = require("htmlparser2");
|
|
5
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
5
6
|
function default_1(result) {
|
|
6
7
|
return new Promise((resolve) => {
|
|
7
8
|
let elementsWithId = [];
|
|
@@ -12,6 +12,9 @@ const getGenerator = (result) => {
|
|
|
12
12
|
Object.prototype.hasOwnProperty.call(meta.attribs, 'content');
|
|
13
13
|
})
|
|
14
14
|
.filter((meta) => {
|
|
15
|
+
if ('attribs' in meta === false || typeof meta.attribs !== 'object' || 'name' in meta.attribs === false || typeof meta.attribs.name !== 'string') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
15
18
|
return meta.attribs.name === 'generator';
|
|
16
19
|
});
|
|
17
20
|
};
|
|
@@ -4,7 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const getObject_1 = __importDefault(require("./getObject"));
|
|
7
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
7
8
|
const getHeading = (result) => {
|
|
9
|
+
if (typeof result === 'object' && 'html' in result === false) {
|
|
10
|
+
throw new Error('The result object does not contain an HTML property.');
|
|
11
|
+
}
|
|
8
12
|
const titles = (0, getObject_1.default)(result.html, 'name', 'h1')
|
|
9
13
|
.map((title) => {
|
|
10
14
|
return title.children[0].data;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const url_1 = require("url");
|
|
7
7
|
const getObject_1 = __importDefault(require("./getObject"));
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
9
|
const getImages = (result) => {
|
|
9
10
|
const origin = (new url_1.URL(result.url)).origin;
|
|
10
11
|
return (0, getObject_1.default)(result.html, 'name', 'img')
|
|
@@ -15,6 +15,7 @@ const getObject_1 = __importDefault(require("./getObject"));
|
|
|
15
15
|
* It returns an array of links to JavaScript files. Every URL
|
|
16
16
|
* is full URL.
|
|
17
17
|
*/
|
|
18
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
18
19
|
const getScripts = (result) => {
|
|
19
20
|
const origin = (new url_1.URL(result.url)).origin;
|
|
20
21
|
return (0, getObject_1.default)(result.html, 'type', 'script')
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const url_1 = require("url");
|
|
7
7
|
const getObject_1 = __importDefault(require("./getObject"));
|
|
8
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
8
9
|
const getStylesheets = (result) => {
|
|
9
10
|
const origin = (new url_1.URL(result.url)).origin;
|
|
10
11
|
return (0, getObject_1.default)(result.html, 'name', 'link')
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const getObject_1 = __importDefault(require("./getObject"));
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
8
|
const getTitle = (result) => {
|
|
8
9
|
const titles = (0, getObject_1.default)(result.html, 'name', 'title')
|
|
9
10
|
.map((title) => {
|
|
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = default_1;
|
|
7
7
|
const domhandler_1 = __importDefault(require("domhandler"));
|
|
8
8
|
const htmlparser2_1 = require("htmlparser2");
|
|
9
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
9
10
|
function default_1(result) {
|
|
10
11
|
return new Promise((resolve, reject) => {
|
|
11
12
|
const handler = new domhandler_1.default((error, dom) => {
|
|
13
|
+
if (error) {
|
|
14
|
+
reject(error);
|
|
15
|
+
}
|
|
12
16
|
resolve({
|
|
13
17
|
html: dom,
|
|
14
18
|
url: result.url,
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.default = default_1;
|
|
16
16
|
const parseXml_1 = __importDefault(require("./parseXml"));
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
18
|
function default_1(sitemap) {
|
|
18
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
const data = yield (0, parseXml_1.default)(sitemap);
|
|
@@ -50,7 +50,7 @@ class Anchor extends Test_1.default {
|
|
|
50
50
|
results.push({
|
|
51
51
|
status: this.getStatus([
|
|
52
52
|
isFileAvailabe.status,
|
|
53
|
-
]),
|
|
53
|
+
]), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
54
54
|
title: anchor,
|
|
55
55
|
description: '',
|
|
56
56
|
results: [
|
|
@@ -61,6 +61,7 @@ class Anchor extends Test_1.default {
|
|
|
61
61
|
return results;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
64
65
|
isFileAvailable(result) {
|
|
65
66
|
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
66
67
|
return false;
|
|
@@ -41,7 +41,7 @@ class CSS extends Test_1.default {
|
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
const results = [];
|
|
43
43
|
for (const stylesheet of stylesheets) {
|
|
44
|
-
const filename = stylesheet.
|
|
44
|
+
const filename = stylesheet.substring(stylesheet.lastIndexOf('/') + 1);
|
|
45
45
|
logger_1.default.verbose(`Checking ${filename}...`);
|
|
46
46
|
const result = yield request_1.default.get(stylesheet);
|
|
47
47
|
const isFileAvailabe = {
|
|
@@ -70,7 +70,7 @@ class CSS extends Test_1.default {
|
|
|
70
70
|
isCached.status,
|
|
71
71
|
hasXContentTypeOptionsHeader.status,
|
|
72
72
|
isMinified.status,
|
|
73
|
-
]),
|
|
73
|
+
]), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
74
74
|
title: filename,
|
|
75
75
|
description: '',
|
|
76
76
|
results: [
|
|
@@ -84,18 +84,22 @@ class CSS extends Test_1.default {
|
|
|
84
84
|
return results;
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
87
88
|
isFileAvailable(result) {
|
|
88
89
|
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
89
90
|
return false;
|
|
90
91
|
}
|
|
91
92
|
return true;
|
|
92
93
|
}
|
|
94
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
93
95
|
isCached(result) {
|
|
94
96
|
return result.response.headers.has('cache-control');
|
|
95
97
|
}
|
|
98
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
96
99
|
hasXContentTypeOptionsHeader(result) {
|
|
97
100
|
return result.response.headers.has('x-content-type-options');
|
|
98
101
|
}
|
|
102
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
99
103
|
isMinified(result) {
|
|
100
104
|
const r = csso_1.default.minify(result.body, { restructure: false }).css;
|
|
101
105
|
return r.length === result.body.length;
|
|
@@ -40,7 +40,7 @@ class Image extends Test_1.default {
|
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
const results = [];
|
|
42
42
|
for (const image of images) {
|
|
43
|
-
const filename = image.
|
|
43
|
+
const filename = image.substring(image.lastIndexOf('/') + 1);
|
|
44
44
|
logger_1.default.verbose(`Checking ${filename}...`);
|
|
45
45
|
const result = yield request_1.default.get(image);
|
|
46
46
|
const isFileAvailabe = {
|
|
@@ -63,7 +63,7 @@ class Image extends Test_1.default {
|
|
|
63
63
|
isFileAvailabe.status,
|
|
64
64
|
isCached.status,
|
|
65
65
|
hasXContentTypeOptionsHeader.status,
|
|
66
|
-
]),
|
|
66
|
+
]), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
67
67
|
title: filename,
|
|
68
68
|
description: '',
|
|
69
69
|
results: [
|
|
@@ -76,15 +76,18 @@ class Image extends Test_1.default {
|
|
|
76
76
|
return results;
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
79
80
|
isFileAvailable(result) {
|
|
80
81
|
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
81
82
|
return false;
|
|
82
83
|
}
|
|
83
84
|
return true;
|
|
84
85
|
}
|
|
86
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
85
87
|
isCached(result) {
|
|
86
88
|
return result.response.headers.has('cache-control');
|
|
87
89
|
}
|
|
90
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
88
91
|
hasXContentTypeOptionsHeader(result) {
|
|
89
92
|
return result.response.headers.has('x-content-type-options');
|
|
90
93
|
}
|
|
@@ -76,7 +76,7 @@ class JavaScript extends Test_1.default {
|
|
|
76
76
|
hasXContentTypeOptionsHeader.status,
|
|
77
77
|
isMinified.status,
|
|
78
78
|
hasConsoleLogs.status,
|
|
79
|
-
]),
|
|
79
|
+
]), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
80
80
|
title: filename,
|
|
81
81
|
description: '',
|
|
82
82
|
results: [
|
|
@@ -91,18 +91,22 @@ class JavaScript extends Test_1.default {
|
|
|
91
91
|
return results;
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
94
95
|
isFileAvailable(result) {
|
|
95
96
|
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
96
97
|
return false;
|
|
97
98
|
}
|
|
98
99
|
return true;
|
|
99
100
|
}
|
|
101
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
100
102
|
isCached(result) {
|
|
101
103
|
return result.response.headers.has('cache-control');
|
|
102
104
|
}
|
|
105
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
103
106
|
hasXContentTypeOptionsHeader(result) {
|
|
104
107
|
return result.response.headers.has('x-content-type-options');
|
|
105
108
|
}
|
|
109
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
106
110
|
isMinified(result) {
|
|
107
111
|
const r = uglify_js_1.default.minify(result.body, { mangle: false, output: { comments: true } });
|
|
108
112
|
if (Object.prototype.hasOwnProperty.call(r, 'error')) {
|
|
@@ -111,6 +115,7 @@ class JavaScript extends Test_1.default {
|
|
|
111
115
|
}
|
|
112
116
|
return result.body.length /* - (result.body.length * 0.05)*/ <= r.code.length;
|
|
113
117
|
}
|
|
118
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
114
119
|
hasConsoleLogs(result) {
|
|
115
120
|
return result.body.indexOf('console.log') !== -1 && result.body.indexOf('console.error') !== -1;
|
|
116
121
|
}
|
|
@@ -16,6 +16,7 @@ const Generator_1 = __importDefault(require("../Generator"));
|
|
|
16
16
|
const request_1 = __importDefault(require("../../request"));
|
|
17
17
|
test('Generator test without generator metatag', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const generator = new Generator_1.default();
|
|
19
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
19
20
|
const mock = jest.spyOn(request_1.default, 'get').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
return new Promise((resolve) => {
|
|
21
22
|
resolve({
|
|
@@ -29,6 +30,7 @@ test('Generator test without generator metatag', () => __awaiter(void 0, void 0,
|
|
|
29
30
|
}));
|
|
30
31
|
test('Generator test with generator metatag', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
32
|
const generator = new Generator_1.default();
|
|
33
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
32
34
|
const mock = jest.spyOn(request_1.default, 'get').mockImplementation(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
35
|
return new Promise((resolve) => {
|
|
34
36
|
resolve({
|
package/{src → dist/src}/index
RENAMED
|
@@ -16,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
16
16
|
}) : function(o, v) {
|
|
17
17
|
o["default"] = v;
|
|
18
18
|
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
26
36
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
37
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
38
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -70,7 +80,7 @@ program
|
|
|
70
80
|
const pentest = new Pentest_1.default();
|
|
71
81
|
const results = yield pentest.run(url);
|
|
72
82
|
const report = report_1.default.get(config_1.default.report.format);
|
|
73
|
-
report.write([results.security, results.dns, results.html, results.seo, results.wordpress]);
|
|
83
|
+
report.write([results.security, results.dns, results.html, results.seo, results.wordpress, results.metadata]);
|
|
74
84
|
}));
|
|
75
85
|
program
|
|
76
86
|
.command('sitemap <URL>')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Logger from './Logger';
|
|
2
|
+
export default class Console implements Logger {
|
|
3
|
+
protected levels: string[];
|
|
4
|
+
debug(message: string, ...args: unknown[]): void;
|
|
5
|
+
verbose(message: string, ...args: unknown[]): void;
|
|
6
|
+
info(message: string, ...args: unknown[]): void;
|
|
7
|
+
warning(message: string, ...args: unknown[]): void;
|
|
8
|
+
error(message: string, ...args: unknown[]): void;
|
|
9
|
+
/**
|
|
10
|
+
* What a terrible failure
|
|
11
|
+
* @param message
|
|
12
|
+
*/
|
|
13
|
+
wtf(message: string, ...args: unknown[]): void;
|
|
14
|
+
}
|