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.
Files changed (212) hide show
  1. package/LICENSE +19 -0
  2. package/{src → dist}/Pentest.d.ts +1 -0
  3. package/dist/Pentest.js +46 -0
  4. package/{src → dist}/Test.d.ts +1 -0
  5. package/{src → dist}/Test.js +12 -27
  6. package/{src → dist}/commands/Sitemap.d.ts +4 -4
  7. package/dist/commands/Sitemap.js +79 -0
  8. package/dist/dns/A.js +49 -0
  9. package/dist/dns/DMARC.js +59 -0
  10. package/dist/dns/NS.js +36 -0
  11. package/dist/dns/RegistrationDate.js +39 -0
  12. package/dist/dns/index.js +47 -0
  13. package/dist/functions/findEvery.d.ts +2 -0
  14. package/{src → dist}/functions/getDuplicates.js +1 -0
  15. package/dist/functions/getGenerator.d.ts +2 -0
  16. package/{src → dist}/functions/getGenerator.js +3 -0
  17. package/{src → dist}/functions/getHeading.js +4 -0
  18. package/{src → dist}/functions/getImages.js +1 -0
  19. package/dist/functions/getObject.d.ts +2 -0
  20. package/{src → dist}/functions/getScripts.js +1 -0
  21. package/{src → dist}/functions/getStylesheets.js +1 -0
  22. package/{src → dist}/functions/getTitle.js +1 -0
  23. package/{src → dist}/functions/parseHtml.js +4 -0
  24. package/dist/functions/parseSitemap.js +12 -0
  25. package/dist/html/Anchor.js +56 -0
  26. package/dist/html/CSS.js +92 -0
  27. package/dist/html/DuplicateId.js +35 -0
  28. package/dist/html/Generator.js +31 -0
  29. package/dist/html/Image.js +79 -0
  30. package/dist/html/JavaScript.js +107 -0
  31. package/{src → dist}/html/__TESTS__/Generator.test.js +12 -19
  32. package/dist/html/index.js +51 -0
  33. package/{src → dist}/index +39 -28
  34. package/dist/logger/Console.d.ts +14 -0
  35. package/{src → dist}/logger/Console.js +13 -15
  36. package/dist/metadata/HTML.d.ts +6 -0
  37. package/dist/metadata/HTML.js +26 -0
  38. package/dist/metadata/Markdown.d.ts +6 -0
  39. package/dist/metadata/Markdown.js +28 -0
  40. package/dist/metadata/ResponseTime.d.ts +6 -0
  41. package/dist/metadata/ResponseTime.js +25 -0
  42. package/dist/metadata/index.d.ts +6 -0
  43. package/dist/metadata/index.js +45 -0
  44. package/{src → dist}/request/NodeFetch.d.ts +2 -0
  45. package/dist/request/NodeFetch.js +58 -0
  46. package/{src → dist}/request/Request.d.ts +2 -0
  47. package/dist/request/cache/BlackHoleCache.d.ts +7 -0
  48. package/{src → dist}/request/cache/BlackHoleCache.js +4 -3
  49. package/{src → dist}/request/cache/UnlimitedCache.d.ts +1 -2
  50. package/{src → dist}/request/cache/UnlimitedCache.js +4 -0
  51. package/dist/request/index.js +11 -0
  52. package/dist/security/ContentEncoding.js +44 -0
  53. package/dist/security/ContentSecurityPolicy.js +32 -0
  54. package/dist/security/Cookies.js +44 -0
  55. package/dist/security/FingerPrint.js +37 -0
  56. package/dist/security/GoogleWebRisk.js +44 -0
  57. package/dist/security/HSTS.js +48 -0
  58. package/dist/security/HTTPS.js +78 -0
  59. package/dist/security/HTTPVersion.js +50 -0
  60. package/dist/security/PermissionsPolicy.js +53 -0
  61. package/dist/security/Redirect.d.ts +6 -0
  62. package/dist/security/Redirect.js +37 -0
  63. package/dist/security/ReferrerPolicy.js +32 -0
  64. package/dist/security/RobotsTXT.js +28 -0
  65. package/dist/security/SSL.js +36 -0
  66. package/dist/security/XFrameOptions.js +32 -0
  67. package/dist/security/XXSSProtection.js +32 -0
  68. package/{src → dist}/security/__TESTS__/ContentSecurityPolicy.test.js +12 -19
  69. package/{src → dist}/security/__TESTS__/FingerPrint.test.js +12 -19
  70. package/{src → dist}/security/__TESTS__/HSTS.test.js +18 -24
  71. package/{src → dist}/security/__TESTS__/HTTPS.test.js +18 -24
  72. package/dist/security/__TESTS__/XFrameOptions.test.js +37 -0
  73. package/{src → dist}/security/__TESTS__/XXSSProtection.test.js +12 -19
  74. package/{src → dist}/security/index.js +22 -35
  75. package/dist/seo/Heading.js +51 -0
  76. package/dist/seo/Robots.js +21 -0
  77. package/dist/seo/Sitemap.js +32 -0
  78. package/dist/seo/Title.js +44 -0
  79. package/dist/seo/index.js +47 -0
  80. package/dist/wordpress/DefaultFiles.js +50 -0
  81. package/dist/wordpress/Generator.js +58 -0
  82. package/dist/wordpress/index.js +43 -0
  83. package/package.json +68 -59
  84. package/src/Pentest.js +0 -43
  85. package/src/commands/Sitemap.js +0 -94
  86. package/src/dns/A.js +0 -64
  87. package/src/dns/DMARC.js +0 -72
  88. package/src/dns/NS.js +0 -52
  89. package/src/dns/RegistrationDate.js +0 -55
  90. package/src/dns/index.js +0 -58
  91. package/src/functions/findEvery.d.ts +0 -2
  92. package/src/functions/getGenerator.d.ts +0 -2
  93. package/src/functions/getObject.d.ts +0 -2
  94. package/src/functions/parseSitemap.js +0 -22
  95. package/src/html/Anchor.js +0 -71
  96. package/src/html/CSS.js +0 -104
  97. package/src/html/DuplicateId.js +0 -49
  98. package/src/html/Generator.js +0 -45
  99. package/src/html/Image.js +0 -92
  100. package/src/html/JavaScript.js +0 -118
  101. package/src/html/index.js +0 -62
  102. package/src/logger/Console.d.ts +0 -14
  103. package/src/request/NodeFetch.js +0 -49
  104. package/src/request/cache/BlackHoleCache.d.ts +0 -8
  105. package/src/request/cache/Cache.d.ts +0 -6
  106. package/src/request/cache/Cache.js +0 -2
  107. package/src/request/index.js +0 -7
  108. package/src/security/ContentEncoding.js +0 -58
  109. package/src/security/ContentSecurityPolicy.js +0 -46
  110. package/src/security/Cookies.js +0 -58
  111. package/src/security/FingerPrint.js +0 -51
  112. package/src/security/GoogleWebRisk.js +0 -58
  113. package/src/security/HSTS.js +0 -62
  114. package/src/security/HTTPS.js +0 -73
  115. package/src/security/HTTPVersion.js +0 -64
  116. package/src/security/PermissionsPolicy.js +0 -67
  117. package/src/security/ReferrerPolicy.js +0 -46
  118. package/src/security/RobotsTXT.js +0 -42
  119. package/src/security/SSL.js +0 -50
  120. package/src/security/XFrameOptions.js +0 -46
  121. package/src/security/XXSSProtection.js +0 -46
  122. package/src/security/__TESTS__/XFrameOptions.test.js +0 -44
  123. package/src/seo/Heading.js +0 -65
  124. package/src/seo/Robots.js +0 -35
  125. package/src/seo/Sitemap.js +0 -46
  126. package/src/seo/Title.js +0 -58
  127. package/src/seo/index.js +0 -58
  128. package/src/types/Sitemap.d.ts +0 -9
  129. package/src/types/Sitemap.js +0 -0
  130. package/src/wordpress/DefaultFiles.js +0 -66
  131. package/src/wordpress/Generator.js +0 -75
  132. package/src/wordpress/index.js +0 -54
  133. /package/{README.md → dist/README.md} +0 -0
  134. /package/{src → dist}/config.d.ts +0 -0
  135. /package/{src → dist}/config.js +0 -0
  136. /package/{src → dist}/dns/A.d.ts +0 -0
  137. /package/{src → dist}/dns/DMARC.d.ts +0 -0
  138. /package/{src → dist}/dns/NS.d.ts +0 -0
  139. /package/{src → dist}/dns/RegistrationDate.d.ts +0 -0
  140. /package/{src → dist}/dns/index.d.ts +0 -0
  141. /package/{src → dist}/functions/findEvery.js +0 -0
  142. /package/{src → dist}/functions/getAnchors.d.ts +0 -0
  143. /package/{src → dist}/functions/getAnchors.js +0 -0
  144. /package/{src → dist}/functions/getDomain.d.ts +0 -0
  145. /package/{src → dist}/functions/getDomain.js +0 -0
  146. /package/{src → dist}/functions/getDuplicates.d.ts +0 -0
  147. /package/{src → dist}/functions/getHeading.d.ts +0 -0
  148. /package/{src → dist}/functions/getImages.d.ts +0 -0
  149. /package/{src → dist}/functions/getObject.js +0 -0
  150. /package/{src → dist}/functions/getScripts.d.ts +0 -0
  151. /package/{src → dist}/functions/getStylesheets.d.ts +0 -0
  152. /package/{src → dist}/functions/getTitle.d.ts +0 -0
  153. /package/{src → dist}/functions/index.d.ts +0 -0
  154. /package/{src → dist}/functions/index.js +0 -0
  155. /package/{src → dist}/functions/parseHtml.d.ts +0 -0
  156. /package/{src → dist}/functions/parseSitemap.d.ts +0 -0
  157. /package/{src → dist}/functions/parseXml.d.ts +0 -0
  158. /package/{src → dist}/functions/parseXml.js +0 -0
  159. /package/{src → dist}/html/Anchor.d.ts +0 -0
  160. /package/{src → dist}/html/CSS.d.ts +0 -0
  161. /package/{src → dist}/html/DuplicateId.d.ts +0 -0
  162. /package/{src → dist}/html/Generator.d.ts +0 -0
  163. /package/{src → dist}/html/Image.d.ts +0 -0
  164. /package/{src → dist}/html/JavaScript.d.ts +0 -0
  165. /package/{src → dist}/html/__TESTS__/Generator.test.d.ts +0 -0
  166. /package/{src → dist}/html/index.d.ts +0 -0
  167. /package/{src → dist}/index.d.ts +0 -0
  168. /package/{src → dist}/logger/Logger.d.ts +0 -0
  169. /package/{src → dist}/logger/Logger.js +0 -0
  170. /package/{src → dist}/logger/index.d.ts +0 -0
  171. /package/{src → dist}/logger/index.js +0 -0
  172. /package/{src → dist}/report/CommandLine.d.ts +0 -0
  173. /package/{src → dist}/report/CommandLine.js +0 -0
  174. /package/{src → dist}/report/Json.d.ts +0 -0
  175. /package/{src → dist}/report/Json.js +0 -0
  176. /package/{src → dist}/report/Report.d.ts +0 -0
  177. /package/{src → dist}/report/Report.js +0 -0
  178. /package/{src → dist}/report/Symbols.d.ts +0 -0
  179. /package/{src → dist}/report/Symbols.js +0 -0
  180. /package/{src → dist}/report/index.d.ts +0 -0
  181. /package/{src → dist}/report/index.js +0 -0
  182. /package/{src → dist}/request/Request.js +0 -0
  183. /package/{src → dist}/request/index.d.ts +0 -0
  184. /package/{src → dist}/security/ContentEncoding.d.ts +0 -0
  185. /package/{src → dist}/security/ContentSecurityPolicy.d.ts +0 -0
  186. /package/{src → dist}/security/Cookies.d.ts +0 -0
  187. /package/{src → dist}/security/FingerPrint.d.ts +0 -0
  188. /package/{src → dist}/security/GoogleWebRisk.d.ts +0 -0
  189. /package/{src → dist}/security/HSTS.d.ts +0 -0
  190. /package/{src → dist}/security/HTTPS.d.ts +0 -0
  191. /package/{src → dist}/security/HTTPVersion.d.ts +0 -0
  192. /package/{src → dist}/security/PermissionsPolicy.d.ts +0 -0
  193. /package/{src → dist}/security/ReferrerPolicy.d.ts +0 -0
  194. /package/{src → dist}/security/RobotsTXT.d.ts +0 -0
  195. /package/{src → dist}/security/SSL.d.ts +0 -0
  196. /package/{src → dist}/security/XFrameOptions.d.ts +0 -0
  197. /package/{src → dist}/security/XXSSProtection.d.ts +0 -0
  198. /package/{src → dist}/security/__TESTS__/ContentSecurityPolicy.test.d.ts +0 -0
  199. /package/{src → dist}/security/__TESTS__/FingerPrint.test.d.ts +0 -0
  200. /package/{src → dist}/security/__TESTS__/HSTS.test.d.ts +0 -0
  201. /package/{src → dist}/security/__TESTS__/HTTPS.test.d.ts +0 -0
  202. /package/{src → dist}/security/__TESTS__/XFrameOptions.test.d.ts +0 -0
  203. /package/{src → dist}/security/__TESTS__/XXSSProtection.test.d.ts +0 -0
  204. /package/{src → dist}/security/index.d.ts +0 -0
  205. /package/{src → dist}/seo/Heading.d.ts +0 -0
  206. /package/{src → dist}/seo/Robots.d.ts +0 -0
  207. /package/{src → dist}/seo/Sitemap.d.ts +0 -0
  208. /package/{src → dist}/seo/Title.d.ts +0 -0
  209. /package/{src → dist}/seo/index.d.ts +0 -0
  210. /package/{src → dist}/wordpress/DefaultFiles.d.ts +0 -0
  211. /package/{src → dist}/wordpress/Generator.d.ts +0 -0
  212. /package/{src → dist}/wordpress/index.d.ts +0 -0
@@ -1,13 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -27,10 +18,11 @@ const RobotsTXT_1 = __importDefault(require("./RobotsTXT"));
27
18
  const PermissionsPolicy_1 = __importDefault(require("./PermissionsPolicy"));
28
19
  const SSL_1 = __importDefault(require("./SSL"));
29
20
  const GoogleWebRisk_1 = __importDefault(require("./GoogleWebRisk"));
21
+ const Redirect_1 = __importDefault(require("./Redirect"));
30
22
  class Security extends Test_1.default {
23
+ name = 'Security';
31
24
  constructor() {
32
25
  super();
33
- this.name = 'Security';
34
26
  this.tests = [
35
27
  new HTTPS_1.default(),
36
28
  new HSTS_1.default(),
@@ -46,33 +38,28 @@ class Security extends Test_1.default {
46
38
  new RobotsTXT_1.default(),
47
39
  new SSL_1.default(),
48
40
  new GoogleWebRisk_1.default(),
41
+ new Redirect_1.default(),
49
42
  ];
50
43
  }
51
- test(params) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const tests = this.getTests();
54
- const results = [];
55
- for (const test of tests) {
56
- let result = null;
57
- try {
58
- result = yield test.run(params);
59
- }
60
- catch (error) {
61
- result = {
62
- status: 'ERROR',
63
- title: test.name,
64
- description: 'Test failed or cannot be run!',
65
- };
66
- }
67
- results.push(result);
68
- }
69
- return {
70
- status: this.getStatus(results.map(result => result.status)),
71
- title: this.name,
72
- description: '',
73
- results,
74
- };
75
- });
44
+ async test(params) {
45
+ const tests = this.getTests();
46
+ const results = [];
47
+ for (const test of tests) {
48
+ const result = await test.run(params).catch(() => {
49
+ return {
50
+ status: 'ERROR',
51
+ title: test.name,
52
+ description: 'Test failed or cannot be run!',
53
+ };
54
+ });
55
+ results.push(result);
56
+ }
57
+ return {
58
+ status: this.getStatus(results.map(result => result.status)),
59
+ title: this.name,
60
+ description: '',
61
+ results,
62
+ };
76
63
  }
77
64
  }
78
65
  exports.default = Security;
@@ -0,0 +1,51 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ const functions_1 = require("../functions");
10
+ class Heading extends Test_1.default {
11
+ name = 'Heading';
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 = await (0, functions_1.parseHtml)(response);
16
+ const heading = (0, functions_1.getHeading)(html);
17
+ const subTests = this.checkHeading(heading);
18
+ return {
19
+ status: this.getStatus(subTests.map(test => test.status)),
20
+ title: this.constructor.name,
21
+ description: '',
22
+ results: subTests,
23
+ };
24
+ }
25
+ checkHeading(title) {
26
+ const results = [];
27
+ if (typeof title === 'undefined') {
28
+ return [{
29
+ status: 'ERROR',
30
+ title: 'H1 tag',
31
+ description: 'HTML should contain H1 tag.',
32
+ }];
33
+ }
34
+ results.push({
35
+ status: typeof title !== 'undefined' && title.length > 0 ? 'SUCCESS' : 'WARNING',
36
+ title: 'H1 tag',
37
+ });
38
+ results.push({
39
+ status: Array.isArray(title) ? 'ERROR' : 'SUCCESS',
40
+ title: 'Duplicate H1 tag',
41
+ description: `HTML should contain just one H1 tag.`,
42
+ });
43
+ results.push({
44
+ status: title.length <= 60 ? 'SUCCESS' : 'WARNING',
45
+ title: 'H1 length',
46
+ description: `H1 length should be under 60 characters and it is ${title.length}.`,
47
+ });
48
+ return results;
49
+ }
50
+ }
51
+ exports.default = Heading;
@@ -0,0 +1,21 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ class Robots extends Test_1.default {
10
+ name = 'Robots';
11
+ async test({ url }) {
12
+ logger_1.default.info(`Starting ${this.constructor.name} test...`);
13
+ const response = await request_1.default.get(`${url}/robots.txt`);
14
+ return {
15
+ status: Math.floor(response.statusCode / 100) === 2 ? 'SUCCESS' : 'WARNING',
16
+ title: 'Robots.txt',
17
+ description: '',
18
+ };
19
+ }
20
+ }
21
+ exports.default = Robots;
@@ -0,0 +1,32 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ const functions_1 = require("../functions");
10
+ class Sitemap extends Test_1.default {
11
+ name = 'Sitemap';
12
+ async test({ url }) {
13
+ logger_1.default.info(`Starting ${this.constructor.name} test...`);
14
+ const robotsResponse = await request_1.default.get(`${url}/robots.txt`);
15
+ let sitemapUrl = `${url}/sitemap.xml`;
16
+ if (Math.floor(robotsResponse.statusCode / 100) === 2) {
17
+ const lines = robotsResponse.body.split(/\r?\n/);
18
+ const sitemap = lines.find(line => line.startsWith('Sitemap'));
19
+ if (typeof sitemap !== 'undefined') {
20
+ sitemapUrl = sitemap.split(' ')[1];
21
+ }
22
+ }
23
+ const response = await request_1.default.get(sitemapUrl);
24
+ const xml = await (0, functions_1.parseXml)(response);
25
+ return {
26
+ status: 'sitemapindex' in xml || 'urlset' in xml ? 'SUCCESS' : 'WARNING',
27
+ title: this.constructor.name,
28
+ description: '',
29
+ };
30
+ }
31
+ }
32
+ exports.default = Sitemap;
@@ -0,0 +1,44 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ const functions_1 = require("../functions");
10
+ class Title extends Test_1.default {
11
+ name = 'Title';
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 = await (0, functions_1.parseHtml)(response);
16
+ const title = (0, functions_1.getTitle)(html);
17
+ const subTests = this.checkTitle(title);
18
+ return {
19
+ status: this.getStatus(subTests.map(test => test.status)),
20
+ title: this.constructor.name,
21
+ description: '',
22
+ results: subTests,
23
+ };
24
+ }
25
+ checkTitle(title) {
26
+ const results = [];
27
+ results.push({
28
+ status: typeof title !== 'undefined' && title.length > 0 ? 'SUCCESS' : 'WARNING',
29
+ title: 'Title tag',
30
+ });
31
+ results.push({
32
+ status: Array.isArray(title) ? 'ERROR' : 'SUCCESS',
33
+ title: 'Duplicate title tag',
34
+ description: `HTML should contain just one title tag.`,
35
+ });
36
+ results.push({
37
+ status: title.length <= 60 ? 'SUCCESS' : 'WARNING',
38
+ title: 'Title length',
39
+ description: `Title length should be under 60 characters and it is ${title.length}.`,
40
+ });
41
+ return results;
42
+ }
43
+ }
44
+ exports.default = Title;
@@ -0,0 +1,47 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const Title_1 = __importDefault(require("./Title"));
8
+ const Heading_1 = __importDefault(require("./Heading"));
9
+ const Sitemap_1 = __importDefault(require("./Sitemap"));
10
+ const Robots_1 = __importDefault(require("./Robots"));
11
+ class SEO extends Test_1.default {
12
+ name = 'SEO';
13
+ constructor() {
14
+ super();
15
+ this.tests = [
16
+ new Title_1.default(),
17
+ new Heading_1.default(),
18
+ new Sitemap_1.default(),
19
+ new Robots_1.default(),
20
+ ];
21
+ }
22
+ async test(params) {
23
+ const tests = this.getTests();
24
+ const results = [];
25
+ for (const test of tests) {
26
+ let result = null;
27
+ try {
28
+ result = await test.run(params);
29
+ }
30
+ catch {
31
+ result = {
32
+ status: 'ERROR',
33
+ title: test.name,
34
+ description: 'Test failed or cannot be run!',
35
+ };
36
+ }
37
+ results.push(result);
38
+ }
39
+ return {
40
+ status: this.getStatus(results.map(result => result.status)),
41
+ title: this.name,
42
+ description: '',
43
+ results,
44
+ };
45
+ }
46
+ }
47
+ exports.default = SEO;
@@ -0,0 +1,50 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ class DefaultFiles extends Test_1.default {
10
+ name = 'Default files';
11
+ files = [
12
+ 'readme.html',
13
+ 'licence.txt',
14
+ 'wp-config-sample.php',
15
+ 'wp-admin/install.php',
16
+ 'wp-admin/upgrade.php',
17
+ ];
18
+ async test({ url }) {
19
+ logger_1.default.info('Starting default files test...');
20
+ let results = [];
21
+ results = await this.checkFiles(url);
22
+ return {
23
+ status: this.getStatus(results.map(result => result.status)),
24
+ title: 'Default files',
25
+ description: '',
26
+ results: results,
27
+ };
28
+ }
29
+ async checkFiles(url) {
30
+ const results = [];
31
+ for (const file of this.files) {
32
+ const response = await request_1.default.get(`${url.endsWith('/') ? url.substring(0, url.length - 1) : url}/${file}`);
33
+ if (Math.floor(response.statusCode / 100) === 2 || Math.floor(response.statusCode / 100) === 5) {
34
+ results.push({
35
+ status: 'WARNING',
36
+ title: file,
37
+ description: `The ${file} file is reachable on the server!`
38
+ });
39
+ continue;
40
+ }
41
+ results.push({
42
+ status: 'SUCCESS',
43
+ title: file,
44
+ description: `The ${file} file is not reachable on the server.`,
45
+ });
46
+ }
47
+ return results;
48
+ }
49
+ }
50
+ exports.default = DefaultFiles;
@@ -0,0 +1,58 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const request_1 = __importDefault(require("../request"));
8
+ const logger_1 = __importDefault(require("../logger"));
9
+ const functions_1 = require("../functions");
10
+ class Generator extends Test_1.default {
11
+ name = 'Generator';
12
+ async test({ url }) {
13
+ logger_1.default.info('Starting default files test...');
14
+ const results = [];
15
+ results.push(await this.checkHTML(url));
16
+ results.push(await this.checkRSSFeed(url));
17
+ return {
18
+ status: this.getStatus(results.map(result => result.status)),
19
+ title: this.name,
20
+ description: '',
21
+ results: results,
22
+ };
23
+ }
24
+ async checkHTML(url) {
25
+ const response = await request_1.default.get(url);
26
+ const html = await (0, functions_1.parseHtml)(response);
27
+ const generators = (0, functions_1.getGenerator)(html);
28
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
29
+ if (generators.some((generator) => generator.attribs.content.toLowerCase().includes('wordpress'))) {
30
+ return {
31
+ status: 'WARNING',
32
+ title: 'HTML Tag',
33
+ description: 'Page contains inmformation about its generator!',
34
+ };
35
+ }
36
+ return {
37
+ status: 'SUCCESS',
38
+ title: 'HTML Tag',
39
+ description: 'Page doesn\t contain any information about its generator.',
40
+ };
41
+ }
42
+ async checkRSSFeed(url) {
43
+ const response = await request_1.default.get(`${url.endsWith('/') ? url.substring(0, url.length - 1) : url}/feed/`);
44
+ if (response.response.headers.get('content-type').startsWith('application/rss+xml') && response.body.includes('<generator>https://wordpress.org')) {
45
+ return {
46
+ status: 'WARNING',
47
+ title: 'RSS Feed',
48
+ description: 'RSS feed contains information about its generator!',
49
+ };
50
+ }
51
+ return {
52
+ status: 'SUCCESS',
53
+ title: 'RSS Feed',
54
+ description: 'RSS feed doesn\t contain any information about its generator.',
55
+ };
56
+ }
57
+ }
58
+ exports.default = Generator;
@@ -0,0 +1,43 @@
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 Test_1 = __importDefault(require("../Test"));
7
+ const DefaultFiles_1 = __importDefault(require("./DefaultFiles"));
8
+ const Generator_1 = __importDefault(require("./Generator"));
9
+ class WordPress extends Test_1.default {
10
+ name = 'WordPress';
11
+ constructor() {
12
+ super();
13
+ this.tests = [
14
+ new DefaultFiles_1.default(),
15
+ new Generator_1.default(),
16
+ ];
17
+ }
18
+ async test(params) {
19
+ const tests = this.getTests();
20
+ const results = [];
21
+ for (const test of tests) {
22
+ let result = null;
23
+ try {
24
+ result = await test.run(params);
25
+ }
26
+ catch {
27
+ result = {
28
+ status: 'ERROR',
29
+ title: test.name,
30
+ description: 'Test failed or cannot be run!',
31
+ };
32
+ }
33
+ results.push(result);
34
+ }
35
+ return {
36
+ status: this.getStatus(results.map(result => result.status)),
37
+ title: this.name,
38
+ description: '',
39
+ results,
40
+ };
41
+ }
42
+ }
43
+ exports.default = WordPress;
package/package.json CHANGED
@@ -1,60 +1,69 @@
1
1
  {
2
- "name": "pentest-tool-lite",
3
- "description": "Check your website ( or any other website ) for common vulnerabilities.",
4
- "version": "3.9.3",
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": {
13
- "pentest-tool-lite": "./src/index"
14
- },
15
- "dependencies": {
16
- "@google-cloud/web-risk": "^4.0.1",
17
- "commander": "^6.0.0",
18
- "csso": "^5.0.5",
19
- "domhandler": "^4.2.2",
20
- "htmlparser2": "^7.1.2",
21
- "node-fetch": "^2.6.0",
22
- "ssl-checker": "^2.0.7",
23
- "uglify-js": "^3.6.1",
24
- "whois": "^2.14.2",
25
- "xml2js": "^0.6.2"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "https://github.com/juffalow/pentest-tool-lite.git"
30
- },
31
- "bugs": {
32
- "url": "https://github.com/juffalow/pentest-tool-lite/issues"
33
- },
34
- "scripts": {
35
- "start": "tsc && node dist/src/index.js",
36
- "build": "tsc",
37
- "lint": "eslint . --ext .ts",
38
- "test": "jest"
39
- },
40
- "devDependencies": {
41
- "@types/jest": "^29.4.0",
42
- "@types/node": "^20.12.2",
43
- "@types/node-fetch": "^2.5.7",
44
- "@types/uglify-js": "^3.0.4",
45
- "@types/xml2js": "^0.4.5",
46
- "@typescript-eslint/eslint-plugin": "^5.1.0",
47
- "@typescript-eslint/parser": "^5.1.0",
48
- "eslint": "^8.0.1",
49
- "jest": "^29.4.3",
50
- "ts-jest": "^29.0.5",
51
- "typescript": "^5.2.2"
52
- },
53
- "keywords": [
54
- "pentest-tool",
55
- "pentesting",
56
- "penetration-test",
57
- "analyzer",
58
- "analyser"
59
- ]
60
- }
2
+ "name": "pentest-tool-lite",
3
+ "description": "Check your website ( or any other website ) for common vulnerabilities.",
4
+ "version": "3.10.8",
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": "./dist/index",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "exports": {
17
+ ".": "./dist/index.js",
18
+ "./dist": "./dist/index.js",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "dependencies": {
22
+ "@google-cloud/web-risk": "^4.0.1",
23
+ "commander": "^6.0.0",
24
+ "csso": "^5.0.5",
25
+ "domhandler": "^4.2.2",
26
+ "htmlparser2": "^7.1.2",
27
+ "node-html-markdown": "^2.0.0",
28
+ "ssl-checker": "^2.0.7",
29
+ "uglify-js": "^3.6.1",
30
+ "whois": "^2.14.2",
31
+ "xml2js": "^0.6.2"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/juffalow/pentest-tool-lite.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/juffalow/pentest-tool-lite/issues"
39
+ },
40
+ "scripts": {
41
+ "start": "tsc && node dist/src/index.js",
42
+ "start-build": "tsc -w --preserveWatchOutput",
43
+ "start-test": "node dist/src/index.js",
44
+ "build": "tsc",
45
+ "lint": "eslint",
46
+ "test": "jest"
47
+ },
48
+ "devDependencies": {
49
+ "@eslint/js": "^9.17.0",
50
+ "@types/jest": "^29.4.0",
51
+ "@types/node": "^22.5.0",
52
+ "@types/uglify-js": "^3.0.4",
53
+ "@types/xml2js": "^0.4.5",
54
+ "eslint": "^9.17.0",
55
+ "globals": "^15.14.0",
56
+ "jest": "^29.4.3",
57
+ "ts-jest": "^29.0.5",
58
+ "typescript": "^5.2.2",
59
+ "typescript-eslint": "^8.18.1"
60
+ },
61
+ "keywords": [
62
+ "pentest-tool",
63
+ "pentesting",
64
+ "penetration-test",
65
+ "analyzer",
66
+ "analyser"
67
+ ],
68
+ "packageManager": "yarn@4.12.0"
69
+ }
package/src/Pentest.js DELETED
@@ -1,43 +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 security_1 = __importDefault(require("./security"));
16
- const dns_1 = __importDefault(require("./dns"));
17
- const html_1 = __importDefault(require("./html"));
18
- const seo_1 = __importDefault(require("./seo"));
19
- const wordpress_1 = __importDefault(require("./wordpress"));
20
- class Pentest {
21
- run(url) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const general = new dns_1.default();
24
- const security = new security_1.default();
25
- const html = new html_1.default();
26
- const seo = new seo_1.default();
27
- const wordPress = new wordpress_1.default();
28
- const generalResult = yield general.run({ url });
29
- const securityResult = yield security.run({ url });
30
- const htmlResult = yield html.run({ url });
31
- const seoResult = yield seo.run({ url });
32
- const wordPressResult = yield wordPress.run({ url });
33
- return {
34
- security: securityResult,
35
- dns: generalResult,
36
- html: htmlResult,
37
- seo: seoResult,
38
- wordpress: wordPressResult,
39
- };
40
- });
41
- }
42
- }
43
- exports.default = Pentest;