pentest-tool-lite 3.10.8 → 3.11.2
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/dist/Pentest.d.ts +0 -9
- package/dist/Test.d.ts +4 -15
- package/dist/Test.js +1 -0
- package/dist/command.d.ts +2 -0
- package/dist/dns/A.d.ts +1 -1
- package/dist/dns/DMARC.d.ts +1 -1
- package/dist/dns/NS.d.ts +1 -1
- package/dist/dns/RegistrationDate.d.ts +1 -1
- package/dist/dns/index.d.ts +1 -1
- package/dist/html/Anchor.d.ts +1 -1
- package/dist/html/CSS.d.ts +1 -1
- package/dist/html/DuplicateId.d.ts +1 -1
- package/dist/html/Generator.d.ts +1 -1
- package/dist/html/Image.d.ts +1 -1
- package/dist/html/JavaScript.d.ts +2 -2
- package/dist/html/JavaScript.js +4 -8
- package/dist/html/index.d.ts +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +11 -0
- package/dist/metadata/HTML.d.ts +1 -1
- package/dist/metadata/Markdown.d.ts +1 -1
- package/dist/metadata/ResponseTime.d.ts +1 -1
- package/dist/metadata/Text.d.ts +12 -0
- package/dist/metadata/Text.js +94 -0
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.js +2 -0
- package/dist/report/CommandLine.d.ts +1 -2
- package/dist/report/Json.d.ts +1 -2
- package/dist/report/Report.d.ts +1 -2
- package/dist/request/Request.d.ts +4 -4
- package/dist/security/ContentEncoding.d.ts +1 -1
- package/dist/security/ContentSecurityPolicy.d.ts +1 -1
- package/dist/security/Cookies.d.ts +1 -1
- package/dist/security/FingerPrint.d.ts +1 -1
- package/dist/security/GoogleWebRisk.d.ts +1 -1
- package/dist/security/HSTS.d.ts +1 -1
- package/dist/security/HTTPS.d.ts +1 -1
- package/dist/security/HTTPVersion.d.ts +1 -1
- package/dist/security/PermissionsPolicy.d.ts +1 -1
- package/dist/security/Redirect.d.ts +1 -1
- package/dist/security/ReferrerPolicy.d.ts +1 -1
- package/dist/security/RobotsTXT.d.ts +1 -1
- package/dist/security/SSL.d.ts +1 -1
- package/dist/security/XFrameOptions.d.ts +1 -1
- package/dist/security/XXSSProtection.d.ts +1 -1
- package/dist/security/index.d.ts +1 -1
- package/dist/seo/Heading.d.ts +1 -1
- package/dist/seo/Robots.d.ts +1 -1
- package/dist/seo/Sitemap.d.ts +1 -1
- package/dist/seo/Title.d.ts +1 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/wordpress/DefaultFiles.d.ts +1 -1
- package/dist/wordpress/Generator.d.ts +1 -1
- package/dist/wordpress/index.d.ts +1 -1
- package/package.json +12 -11
- /package/{dist/README.md → README.md} +0 -0
- /package/dist/{index → command.js} +0 -0
package/dist/Pentest.d.ts
CHANGED
package/dist/Test.d.ts
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
export type TestParameters = {
|
|
2
|
-
url: string;
|
|
3
|
-
};
|
|
4
|
-
export type Status = 'FATAL' | 'ERROR' | 'WARNING' | 'SUCCESS';
|
|
5
|
-
export type Result = {
|
|
6
|
-
status: Status;
|
|
7
|
-
title: string;
|
|
8
|
-
description: string;
|
|
9
|
-
metadata?: Record<string, string | number | boolean>;
|
|
10
|
-
results?: Array<Result>;
|
|
11
|
-
};
|
|
12
1
|
export default abstract class Test {
|
|
13
2
|
abstract name: string;
|
|
14
|
-
protected tests:
|
|
15
|
-
run(params: TestParameters): Promise<Result |
|
|
16
|
-
protected abstract test(params: TestParameters): Promise<Result |
|
|
17
|
-
protected getTests():
|
|
3
|
+
protected tests: Test[];
|
|
4
|
+
run(params: TestParameters): Promise<Result | Result[]>;
|
|
5
|
+
protected abstract test(params: TestParameters): Promise<Result | Result[]>;
|
|
6
|
+
protected getTests(): Test[];
|
|
18
7
|
protected canRunTest(fullName: string): boolean;
|
|
19
8
|
getFullName(): string;
|
|
20
9
|
protected getStatus(statuses: Status[]): Status;
|
package/dist/Test.js
CHANGED
|
@@ -8,6 +8,7 @@ const logger_1 = __importDefault(require("./logger"));
|
|
|
8
8
|
/**
|
|
9
9
|
* @see https://stackoverflow.com/questions/13651945/what-is-the-use-of-module-parent-in-node-js-how-can-i-refer-to-the-requireing
|
|
10
10
|
*/
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
11
12
|
delete require.cache[__filename];
|
|
12
13
|
class Test {
|
|
13
14
|
tests = [];
|
package/dist/dns/A.d.ts
CHANGED
package/dist/dns/DMARC.d.ts
CHANGED
package/dist/dns/NS.d.ts
CHANGED
package/dist/dns/index.d.ts
CHANGED
package/dist/html/Anchor.d.ts
CHANGED
package/dist/html/CSS.d.ts
CHANGED
package/dist/html/Generator.d.ts
CHANGED
package/dist/html/Image.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Test
|
|
1
|
+
import Test from '../Test';
|
|
2
2
|
declare class JavaScript extends Test {
|
|
3
3
|
name: string;
|
|
4
4
|
test({ url }: TestParameters): Promise<Result>;
|
|
@@ -6,7 +6,7 @@ declare class JavaScript extends Test {
|
|
|
6
6
|
protected isFileAvailable(result: any): boolean;
|
|
7
7
|
protected isCached(result: any): boolean;
|
|
8
8
|
protected hasXContentTypeOptionsHeader(result: any): boolean;
|
|
9
|
-
protected isMinified(result: any): boolean
|
|
9
|
+
protected isMinified(result: any): Promise<boolean>;
|
|
10
10
|
protected hasConsoleLogs(result: any): boolean;
|
|
11
11
|
}
|
|
12
12
|
export default JavaScript;
|
package/dist/html/JavaScript.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const terser_1 = require("terser");
|
|
7
7
|
const Test_1 = __importDefault(require("../Test"));
|
|
8
8
|
const request_1 = __importDefault(require("../request"));
|
|
9
9
|
const logger_1 = __importDefault(require("../logger"));
|
|
@@ -45,7 +45,7 @@ class JavaScript extends Test_1.default {
|
|
|
45
45
|
description: '',
|
|
46
46
|
};
|
|
47
47
|
const isMinified = {
|
|
48
|
-
status: this.isMinified(result) ? 'SUCCESS' : 'WARNING',
|
|
48
|
+
status: (await this.isMinified(result)) ? 'SUCCESS' : 'WARNING',
|
|
49
49
|
title: 'Minified',
|
|
50
50
|
description: '',
|
|
51
51
|
};
|
|
@@ -91,12 +91,8 @@ class JavaScript extends Test_1.default {
|
|
|
91
91
|
return result.response.headers.has('x-content-type-options');
|
|
92
92
|
}
|
|
93
93
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
94
|
-
isMinified(result) {
|
|
95
|
-
const r =
|
|
96
|
-
if (Object.prototype.hasOwnProperty.call(r, 'error')) {
|
|
97
|
-
logger_1.default.error('JavaScript syntax error!');
|
|
98
|
-
throw r.error;
|
|
99
|
-
}
|
|
94
|
+
async isMinified(result) {
|
|
95
|
+
const r = await (0, terser_1.minify)(result.body, { mangle: false, output: { comments: true } });
|
|
100
96
|
return result.body.length /* - (result.body.length * 0.05)*/ <= r.code.length;
|
|
101
97
|
}
|
|
102
98
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
package/dist/html/index.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
exports.Test = exports.Pentest = void 0;
|
|
7
|
+
const Pentest_1 = __importDefault(require("./Pentest"));
|
|
8
|
+
exports.Pentest = Pentest_1.default;
|
|
9
|
+
const Test_1 = __importDefault(require("./Test"));
|
|
10
|
+
exports.Test = Test_1.default;
|
|
11
|
+
exports.default = Pentest_1.default;
|
package/dist/metadata/HTML.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Test from '../Test';
|
|
2
|
+
declare class Text extends Test {
|
|
3
|
+
name: string;
|
|
4
|
+
test({ url }: TestParameters): Promise<Result>;
|
|
5
|
+
protected getSentences(text: string): string[];
|
|
6
|
+
protected countWords(text: string): number;
|
|
7
|
+
protected countCharacters(text: string): number;
|
|
8
|
+
protected countSyllables(text: string): number;
|
|
9
|
+
protected countSlovakSyllables(text: string): number;
|
|
10
|
+
protected countFleschKincaid(sentences: number, words: number, syllables: number): number;
|
|
11
|
+
}
|
|
12
|
+
export default Text;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 html_to_text_1 = require("html-to-text");
|
|
7
|
+
const Test_1 = __importDefault(require("../Test"));
|
|
8
|
+
const request_1 = __importDefault(require("../request"));
|
|
9
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
10
|
+
class Text extends Test_1.default {
|
|
11
|
+
name = 'Text';
|
|
12
|
+
async test({ url }) {
|
|
13
|
+
logger_1.default.info(`Starting ${this.constructor.name} test...`);
|
|
14
|
+
const response = await request_1.default.get(url);
|
|
15
|
+
const html = response.body;
|
|
16
|
+
const text = (0, html_to_text_1.convert)(html);
|
|
17
|
+
const sentences = this.getSentences(text);
|
|
18
|
+
const words = sentences.reduce((acc, sentence) => acc + this.countWords(sentence), 0);
|
|
19
|
+
const syllables = sentences
|
|
20
|
+
.map((sentence) => sentence
|
|
21
|
+
.split(/\s+/)
|
|
22
|
+
.filter((word) => word.length > 0 &&
|
|
23
|
+
word.length < 20 &&
|
|
24
|
+
word.match(/[1-9-#*\\/]+/) === null)
|
|
25
|
+
.reduce((acc, word) => acc + this.countSyllables(word), 0))
|
|
26
|
+
.reduce((acc, syllable) => acc + syllable, 0);
|
|
27
|
+
const characters = this.countCharacters(text);
|
|
28
|
+
const fleschKincaid = this.countFleschKincaid(sentences.length, words, syllables);
|
|
29
|
+
return {
|
|
30
|
+
status: 'SUCCESS',
|
|
31
|
+
title: this.constructor.name,
|
|
32
|
+
description: '',
|
|
33
|
+
metadata: {
|
|
34
|
+
sentences: sentences.length,
|
|
35
|
+
words: words,
|
|
36
|
+
characters: characters,
|
|
37
|
+
syllables: syllables,
|
|
38
|
+
fleschKincaid: fleschKincaid,
|
|
39
|
+
},
|
|
40
|
+
results: [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
getSentences(text) {
|
|
44
|
+
const lines = text.split(/\n+/);
|
|
45
|
+
// Filter out headings and list items
|
|
46
|
+
const contentLines = lines.filter((line) => {
|
|
47
|
+
const trimmed = line.trim();
|
|
48
|
+
// Skip empty lines
|
|
49
|
+
if (!trimmed)
|
|
50
|
+
return false;
|
|
51
|
+
// Skip lines that look like headings (short lines without ending punctuation)
|
|
52
|
+
// Typically headings are < 80 chars and don't end with sentence punctuation
|
|
53
|
+
if (trimmed.length < 80 && !trimmed.match(/[.!?…]$/)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// Skip list items (start with -, *, •, numbers followed by . or ), etc.)
|
|
57
|
+
if (trimmed.match(/^[-*•]\s|^\d+[.)]\s|^[a-z][.)]\s/i)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// Skip lines that are all caps (likely headings or labels)
|
|
61
|
+
if (trimmed.length < 50 &&
|
|
62
|
+
trimmed === trimmed.toUpperCase() &&
|
|
63
|
+
trimmed.match(/[A-Z]/)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
});
|
|
68
|
+
// Join filtered lines back together
|
|
69
|
+
const contentText = contentLines.join(" ");
|
|
70
|
+
// Count sentences in the filtered text
|
|
71
|
+
const sentences = contentText.match(/[^.!?…]+[.!?…]+/g);
|
|
72
|
+
return sentences ? sentences : [];
|
|
73
|
+
}
|
|
74
|
+
countWords(text) {
|
|
75
|
+
// return text.match(/\b\w+\b/g).length;
|
|
76
|
+
const words = text.split(/\s+/).filter((word) => word.length > 0);
|
|
77
|
+
return words.length;
|
|
78
|
+
}
|
|
79
|
+
countCharacters(text) {
|
|
80
|
+
return text.replaceAll(/\s/g, '').length;
|
|
81
|
+
}
|
|
82
|
+
countSyllables(text) {
|
|
83
|
+
return this.countSlovakSyllables(text);
|
|
84
|
+
}
|
|
85
|
+
countSlovakSyllables(text) {
|
|
86
|
+
const vowelPattern = /[aeiouyáäéíóôúýŕĺ]/gi;
|
|
87
|
+
const matches = text.match(vowelPattern);
|
|
88
|
+
return matches ? matches.length : 0;
|
|
89
|
+
}
|
|
90
|
+
countFleschKincaid(sentences, words, syllables) {
|
|
91
|
+
return 206.835 - 1.015 * (words / sentences) - 84.6 * (syllables / words);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.default = Text;
|
package/dist/metadata/index.d.ts
CHANGED
package/dist/metadata/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const Test_1 = __importDefault(require("../Test"));
|
|
|
7
7
|
const HTML_1 = __importDefault(require("./HTML"));
|
|
8
8
|
const Markdown_1 = __importDefault(require("./Markdown"));
|
|
9
9
|
const ResponseTime_1 = __importDefault(require("./ResponseTime"));
|
|
10
|
+
const Text_1 = __importDefault(require("./Text"));
|
|
10
11
|
class Metadata extends Test_1.default {
|
|
11
12
|
name = 'Metadata';
|
|
12
13
|
constructor() {
|
|
@@ -14,6 +15,7 @@ class Metadata extends Test_1.default {
|
|
|
14
15
|
this.tests = [
|
|
15
16
|
new HTML_1.default(),
|
|
16
17
|
new Markdown_1.default(),
|
|
18
|
+
new Text_1.default(),
|
|
17
19
|
new ResponseTime_1.default(),
|
|
18
20
|
];
|
|
19
21
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Report from './Report';
|
|
2
|
-
import { Result } from '../Test';
|
|
3
2
|
declare class CommandLine implements Report {
|
|
4
|
-
write(results:
|
|
3
|
+
write(results: Result[], level?: number): void;
|
|
5
4
|
private print;
|
|
6
5
|
private printDescription;
|
|
7
6
|
private getFormattedSymbol;
|
package/dist/report/Json.d.ts
CHANGED
package/dist/report/Report.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface Options {
|
|
2
2
|
redirect?: 'follow' | 'manual' | 'error';
|
|
3
3
|
timeout?: number;
|
|
4
4
|
agent?: string;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
5
|
+
}
|
|
6
|
+
export interface Response {
|
|
7
7
|
url: string;
|
|
8
8
|
finalUrl: string;
|
|
9
9
|
body: string;
|
|
@@ -12,7 +12,7 @@ export type Response = {
|
|
|
12
12
|
headers: any;
|
|
13
13
|
response: any;
|
|
14
14
|
duration: number;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export default interface Request {
|
|
17
17
|
get(url: string, options?: Options): Promise<Response>;
|
|
18
18
|
}
|
package/dist/security/HSTS.d.ts
CHANGED
package/dist/security/HTTPS.d.ts
CHANGED
package/dist/security/SSL.d.ts
CHANGED
package/dist/security/index.d.ts
CHANGED
package/dist/seo/Heading.d.ts
CHANGED
package/dist/seo/Robots.d.ts
CHANGED
package/dist/seo/Sitemap.d.ts
CHANGED
package/dist/seo/Title.d.ts
CHANGED
package/dist/seo/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pentest-tool-lite",
|
|
3
3
|
"description": "Check your website ( or any other website ) for common vulnerabilities.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.11.2",
|
|
5
5
|
"homepage": "https://pentest-tool-lite.com",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"email": "juffalow@juffalow.com",
|
|
10
10
|
"url": "https://juffalow.com"
|
|
11
11
|
},
|
|
12
|
-
"bin": "./dist/
|
|
12
|
+
"bin": "./dist/command.js",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
@@ -23,10 +23,11 @@
|
|
|
23
23
|
"commander": "^6.0.0",
|
|
24
24
|
"csso": "^5.0.5",
|
|
25
25
|
"domhandler": "^4.2.2",
|
|
26
|
+
"html-to-text": "^9.0.5",
|
|
26
27
|
"htmlparser2": "^7.1.2",
|
|
27
28
|
"node-html-markdown": "^2.0.0",
|
|
28
29
|
"ssl-checker": "^2.0.7",
|
|
29
|
-
"
|
|
30
|
+
"terser": "^5.46.0",
|
|
30
31
|
"whois": "^2.14.2",
|
|
31
32
|
"xml2js": "^0.6.2"
|
|
32
33
|
},
|
|
@@ -38,25 +39,25 @@
|
|
|
38
39
|
"url": "https://github.com/juffalow/pentest-tool-lite/issues"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
|
-
"start": "tsc && node dist/
|
|
42
|
+
"start": "tsc && node dist/command.js",
|
|
42
43
|
"start-build": "tsc -w --preserveWatchOutput",
|
|
43
|
-
"start-test": "node dist/
|
|
44
|
+
"start-test": "node dist/command.js",
|
|
44
45
|
"build": "tsc",
|
|
45
|
-
"lint": "eslint",
|
|
46
|
+
"lint": "eslint .",
|
|
46
47
|
"test": "jest"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@eslint/js": "^9.
|
|
50
|
+
"@eslint/js": "^9.39.2",
|
|
51
|
+
"@types/html-to-text": "^9",
|
|
50
52
|
"@types/jest": "^29.4.0",
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"@types/uglify-js": "^3.0.4",
|
|
53
|
+
"@types/node": "^24.10.4",
|
|
53
54
|
"@types/xml2js": "^0.4.5",
|
|
54
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.39.2",
|
|
55
56
|
"globals": "^15.14.0",
|
|
56
57
|
"jest": "^29.4.3",
|
|
57
58
|
"ts-jest": "^29.0.5",
|
|
58
59
|
"typescript": "^5.2.2",
|
|
59
|
-
"typescript-eslint": "^8.
|
|
60
|
+
"typescript-eslint": "^8.54.0"
|
|
60
61
|
},
|
|
61
62
|
"keywords": [
|
|
62
63
|
"pentest-tool",
|
|
File without changes
|
|
File without changes
|