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/html/Generator.js
DELETED
|
@@ -1,45 +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 Generator extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'Generator';
|
|
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 html = yield (0, functions_1.parseHtml)(response);
|
|
29
|
-
const generators = yield (0, functions_1.getGenerator)(html);
|
|
30
|
-
if (generators.length > 0) {
|
|
31
|
-
return {
|
|
32
|
-
status: 'WARNING',
|
|
33
|
-
title: this.name,
|
|
34
|
-
description: 'Page contains inmformation about its generator!',
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
status: 'SUCCESS',
|
|
39
|
-
title: this.name,
|
|
40
|
-
description: 'Page doesn\t contain any information about its generator.',
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.default = Generator;
|
package/src/html/Image.js
DELETED
|
@@ -1,92 +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 Image extends Test_1.default {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.name = 'Image';
|
|
23
|
-
}
|
|
24
|
-
test(_a) {
|
|
25
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
26
|
-
logger_1.default.info('Starting Image test...');
|
|
27
|
-
const response = yield request_1.default.get(url);
|
|
28
|
-
const html = yield (0, functions_1.parseHtml)(response);
|
|
29
|
-
const images = (0, functions_1.getImages)(html);
|
|
30
|
-
const subTests = yield this.checkImages(images);
|
|
31
|
-
return {
|
|
32
|
-
status: this.getStatus(subTests.map(test => test.status)),
|
|
33
|
-
title: 'Image',
|
|
34
|
-
description: '',
|
|
35
|
-
results: subTests,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
checkImages(images) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const results = [];
|
|
42
|
-
for (const image of images) {
|
|
43
|
-
const filename = image.substr(image.lastIndexOf('/') + 1);
|
|
44
|
-
logger_1.default.verbose(`Checking ${filename}...`);
|
|
45
|
-
const result = yield request_1.default.get(image);
|
|
46
|
-
const isFileAvailabe = {
|
|
47
|
-
status: this.isFileAvailable(result) ? 'SUCCESS' : 'ERROR',
|
|
48
|
-
title: 'Available',
|
|
49
|
-
description: '',
|
|
50
|
-
};
|
|
51
|
-
const isCached = {
|
|
52
|
-
status: this.isCached(result) ? 'SUCCESS' : 'ERROR',
|
|
53
|
-
title: 'Cached',
|
|
54
|
-
description: '',
|
|
55
|
-
};
|
|
56
|
-
const hasXContentTypeOptionsHeader = {
|
|
57
|
-
status: this.hasXContentTypeOptionsHeader(result) ? 'SUCCESS' : 'WARNING',
|
|
58
|
-
title: 'X-Content-Type-Options',
|
|
59
|
-
description: '',
|
|
60
|
-
};
|
|
61
|
-
results.push({
|
|
62
|
-
status: this.getStatus([
|
|
63
|
-
isFileAvailabe.status,
|
|
64
|
-
isCached.status,
|
|
65
|
-
hasXContentTypeOptionsHeader.status,
|
|
66
|
-
]),
|
|
67
|
-
title: filename,
|
|
68
|
-
description: '',
|
|
69
|
-
results: [
|
|
70
|
-
isFileAvailabe,
|
|
71
|
-
isCached,
|
|
72
|
-
hasXContentTypeOptionsHeader,
|
|
73
|
-
],
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return results;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
isFileAvailable(result) {
|
|
80
|
-
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
isCached(result) {
|
|
86
|
-
return result.response.headers.has('cache-control');
|
|
87
|
-
}
|
|
88
|
-
hasXContentTypeOptionsHeader(result) {
|
|
89
|
-
return result.response.headers.has('x-content-type-options');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.default = Image;
|
package/src/html/JavaScript.js
DELETED
|
@@ -1,118 +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 uglify_js_1 = __importDefault(require("uglify-js"));
|
|
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 JavaScript extends Test_1.default {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.name = 'JavaScript';
|
|
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 scripts = (0, functions_1.getScripts)(html);
|
|
31
|
-
const subTests = yield this.check(scripts);
|
|
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(scripts) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const results = [];
|
|
43
|
-
for (const script of scripts) {
|
|
44
|
-
const filename = script.substr(script.lastIndexOf('/') + 1);
|
|
45
|
-
logger_1.default.verbose(`Checking ${filename}...`);
|
|
46
|
-
const result = yield request_1.default.get(script);
|
|
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
|
-
const hasConsoleLogs = {
|
|
68
|
-
status: this.hasConsoleLogs(result) ? 'SUCCESS' : 'WARNING',
|
|
69
|
-
title: 'ConsoleLogs',
|
|
70
|
-
description: '',
|
|
71
|
-
};
|
|
72
|
-
results.push({
|
|
73
|
-
status: this.getStatus([
|
|
74
|
-
isFileAvailabe.status,
|
|
75
|
-
isCached.status,
|
|
76
|
-
hasXContentTypeOptionsHeader.status,
|
|
77
|
-
isMinified.status,
|
|
78
|
-
hasConsoleLogs.status,
|
|
79
|
-
]),
|
|
80
|
-
title: filename,
|
|
81
|
-
description: '',
|
|
82
|
-
results: [
|
|
83
|
-
isFileAvailabe,
|
|
84
|
-
isCached,
|
|
85
|
-
hasXContentTypeOptionsHeader,
|
|
86
|
-
isMinified,
|
|
87
|
-
hasConsoleLogs,
|
|
88
|
-
],
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return results;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
isFileAvailable(result) {
|
|
95
|
-
if (result.response.statusCode === 404 || result.response.statusCode === 500) {
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
isCached(result) {
|
|
101
|
-
return result.response.headers.has('cache-control');
|
|
102
|
-
}
|
|
103
|
-
hasXContentTypeOptionsHeader(result) {
|
|
104
|
-
return result.response.headers.has('x-content-type-options');
|
|
105
|
-
}
|
|
106
|
-
isMinified(result) {
|
|
107
|
-
const r = uglify_js_1.default.minify(result.body, { mangle: false, output: { comments: true } });
|
|
108
|
-
if (Object.prototype.hasOwnProperty.call(r, 'error')) {
|
|
109
|
-
logger_1.default.error('JavaScript syntax error!');
|
|
110
|
-
throw r.error;
|
|
111
|
-
}
|
|
112
|
-
return result.body.length /* - (result.body.length * 0.05)*/ <= r.code.length;
|
|
113
|
-
}
|
|
114
|
-
hasConsoleLogs(result) {
|
|
115
|
-
return result.body.indexOf('console.log') !== -1 && result.body.indexOf('console.error') !== -1;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.default = JavaScript;
|
package/src/html/index.js
DELETED
|
@@ -1,62 +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 Image_1 = __importDefault(require("./Image"));
|
|
17
|
-
const DuplicateId_1 = __importDefault(require("./DuplicateId"));
|
|
18
|
-
const CSS_1 = __importDefault(require("./CSS"));
|
|
19
|
-
const JavaScript_1 = __importDefault(require("./JavaScript"));
|
|
20
|
-
const Anchor_1 = __importDefault(require("./Anchor"));
|
|
21
|
-
const Generator_1 = __importDefault(require("./Generator"));
|
|
22
|
-
class HTML extends Test_1.default {
|
|
23
|
-
constructor() {
|
|
24
|
-
super();
|
|
25
|
-
this.name = 'HTML';
|
|
26
|
-
this.tests = [
|
|
27
|
-
new JavaScript_1.default(),
|
|
28
|
-
new CSS_1.default(),
|
|
29
|
-
new Image_1.default(),
|
|
30
|
-
new Anchor_1.default(),
|
|
31
|
-
new DuplicateId_1.default(),
|
|
32
|
-
new Generator_1.default(),
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
test(params) {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const tests = this.getTests();
|
|
38
|
-
const results = [];
|
|
39
|
-
for (const test of tests) {
|
|
40
|
-
let result = null;
|
|
41
|
-
try {
|
|
42
|
-
result = yield test.run(params);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
result = {
|
|
46
|
-
status: 'ERROR',
|
|
47
|
-
title: test.name,
|
|
48
|
-
description: 'Test failed or cannot be run!',
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
results.push(result);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
status: this.getStatus(results.map(result => result.status)),
|
|
55
|
-
title: this.name,
|
|
56
|
-
description: '',
|
|
57
|
-
results,
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.default = HTML;
|
package/src/logger/Console.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import Logger from './Logger';
|
|
2
|
-
export default class Console implements Logger {
|
|
3
|
-
protected levels: string[];
|
|
4
|
-
debug(message: string): void;
|
|
5
|
-
verbose(message: string): void;
|
|
6
|
-
info(message: string): void;
|
|
7
|
-
warning(message: string): void;
|
|
8
|
-
error(message: string): void;
|
|
9
|
-
/**
|
|
10
|
-
* What a terrible failure
|
|
11
|
-
* @param message
|
|
12
|
-
*/
|
|
13
|
-
wtf(message: string): void;
|
|
14
|
-
}
|
package/src/request/NodeFetch.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 node_fetch_1 = __importDefault(require("node-fetch"));
|
|
16
|
-
const config_1 = __importDefault(require("../config"));
|
|
17
|
-
const getHeaders = (headers) => {
|
|
18
|
-
const keyValues = {};
|
|
19
|
-
Object.keys(headers).forEach((header) => {
|
|
20
|
-
if (headers[header].length === 1 && header !== 'set-cookie') {
|
|
21
|
-
keyValues[header] = headers[header][0];
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
keyValues[header] = headers[header];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return keyValues;
|
|
28
|
-
};
|
|
29
|
-
class NodeFetch {
|
|
30
|
-
get(url, options) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const defaultOptions = config_1.default.request.options;
|
|
33
|
-
const response = yield (0, node_fetch_1.default)(url, Object.assign(Object.assign({}, defaultOptions), options));
|
|
34
|
-
const body = yield response.text();
|
|
35
|
-
const statusCode = response.status;
|
|
36
|
-
const statusText = response.statusText;
|
|
37
|
-
const headers = getHeaders(response.headers.raw());
|
|
38
|
-
return {
|
|
39
|
-
response,
|
|
40
|
-
statusCode,
|
|
41
|
-
statusText,
|
|
42
|
-
headers,
|
|
43
|
-
body,
|
|
44
|
-
url,
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.default = NodeFetch;
|
package/src/request/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const NodeFetch_1 = __importDefault(require("./NodeFetch"));
|
|
7
|
-
exports.default = new NodeFetch_1.default();
|
|
@@ -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 request_1 = __importDefault(require("../request"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/content-encoding
|
|
21
|
-
*/
|
|
22
|
-
class ContentEncoding extends Test_1.default {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.name = 'Content-Encoding';
|
|
26
|
-
}
|
|
27
|
-
test(_a) {
|
|
28
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
29
|
-
logger_1.default.info('Starting content-encoding test...');
|
|
30
|
-
const response = yield request_1.default.get(url);
|
|
31
|
-
if (!Object.prototype.hasOwnProperty.call(response.headers, 'content-encoding')) {
|
|
32
|
-
return {
|
|
33
|
-
status: 'ERROR',
|
|
34
|
-
title: 'Content-Encoding',
|
|
35
|
-
description: 'Response headers does not contain content-encoding header!',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
const attributesList = response.headers['content-encoding'];
|
|
39
|
-
const attributes = attributesList.replace(' ', '').split(',');
|
|
40
|
-
const ce1 = attributes.indexOf('gzip') > -1;
|
|
41
|
-
const ce2 = attributes.indexOf('deflate') > -1;
|
|
42
|
-
const ce3 = attributes.indexOf('br') > -1;
|
|
43
|
-
if (ce1 || ce2 || ce3) {
|
|
44
|
-
return {
|
|
45
|
-
status: 'SUCCESS',
|
|
46
|
-
title: 'Content-Encoding',
|
|
47
|
-
description: `The value of content-encoding header is ${attributesList}.`,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
status: 'ERROR',
|
|
52
|
-
title: 'Content-Encoding',
|
|
53
|
-
description: `The value of content-encoding header is ${attributesList}.`,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = ContentEncoding;
|
|
@@ -1,46 +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
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
|
|
21
|
-
*/
|
|
22
|
-
class ContentSecurityPolicy extends Test_1.default {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.name = 'Content-Security-Policy';
|
|
26
|
-
}
|
|
27
|
-
test(_a) {
|
|
28
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
29
|
-
logger_1.default.info('Starting ContentSecurityPolicy test...');
|
|
30
|
-
const response = yield request_1.default.get(url);
|
|
31
|
-
if (!Object.prototype.hasOwnProperty.call(response.headers, 'content-security-policy')) {
|
|
32
|
-
return {
|
|
33
|
-
status: 'ERROR',
|
|
34
|
-
title: 'Content-Security-Policy',
|
|
35
|
-
description: 'Response headers does not contain content-security-policy header!',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
status: 'SUCCESS',
|
|
40
|
-
title: 'Content-Security-Policy',
|
|
41
|
-
description: `The value of content-security-policy header is ${response.headers['content-security-policy']}.`,
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = ContentSecurityPolicy;
|
package/src/security/Cookies.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 request_1 = __importDefault(require("../request"));
|
|
17
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
18
|
-
class Cookies extends Test_1.default {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.name = 'Cookies';
|
|
22
|
-
}
|
|
23
|
-
test(_a) {
|
|
24
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
25
|
-
logger_1.default.info('Starting Cookies test...');
|
|
26
|
-
const response = yield request_1.default.get(url);
|
|
27
|
-
let subChecks = [];
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(response.headers, 'set-cookie')) {
|
|
29
|
-
const cookies = response.headers['set-cookie'];
|
|
30
|
-
subChecks = this.checkCookies(cookies);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
status: subChecks.some(check => check.status === 'WARNING') ? 'WARNING' : 'SUCCESS',
|
|
34
|
-
title: 'Cookies',
|
|
35
|
-
description: '',
|
|
36
|
-
results: subChecks,
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
checkCookies(cookies) {
|
|
41
|
-
const regx = new RegExp('.*(secure; HttpOnly)$', 'i');
|
|
42
|
-
return cookies.map((cookie) => {
|
|
43
|
-
if (!regx.test(cookie)) {
|
|
44
|
-
return {
|
|
45
|
-
status: 'WARNING',
|
|
46
|
-
title: cookie.substr(0, cookie.indexOf('=')),
|
|
47
|
-
description: '',
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
status: 'SUCCESS',
|
|
52
|
-
title: cookie.substr(0, cookie.indexOf('=')),
|
|
53
|
-
description: '',
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.default = Cookies;
|
|
@@ -1,51 +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
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @see https://www.owasp.org/index.php/Fingerprint_Web_Server_(OTG-INFO-002)
|
|
21
|
-
* @see https://www.owasp.org/index.php/Fingerprint_Web_Application_Framework_(OTG-INFO-008)
|
|
22
|
-
*/
|
|
23
|
-
class FingerPrint extends Test_1.default {
|
|
24
|
-
constructor() {
|
|
25
|
-
super(...arguments);
|
|
26
|
-
this.name = 'FingerPrint';
|
|
27
|
-
this.knownHeaders = ['x-powered-by', 'x-generator', 'server'];
|
|
28
|
-
}
|
|
29
|
-
test(_a) {
|
|
30
|
-
return __awaiter(this, arguments, void 0, function* ({ url }) {
|
|
31
|
-
logger_1.default.info('Starting FingerPrint test...');
|
|
32
|
-
const response = yield request_1.default.get(url);
|
|
33
|
-
if (this.hasFingerPrintHeader(response.headers)) {
|
|
34
|
-
return {
|
|
35
|
-
status: 'ERROR',
|
|
36
|
-
title: 'FingerPrint',
|
|
37
|
-
description: 'Response headers includes at least one of finger print headers!',
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
status: 'SUCCESS',
|
|
42
|
-
title: 'FingerPrint',
|
|
43
|
-
description: `Response headers don't inlcude any of finger print headers.`,
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
hasFingerPrintHeader(headers) {
|
|
48
|
-
return Object.keys(headers).filter((header) => this.knownHeaders.includes(header)).length > 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.default = FingerPrint;
|