pentest-tool-lite 3.10.6 → 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 (205) hide show
  1. package/dist/Pentest.js +46 -0
  2. package/dist/{src/Test.js → Test.js} +11 -24
  3. package/dist/commands/Sitemap.js +79 -0
  4. package/dist/dns/A.js +49 -0
  5. package/dist/dns/DMARC.js +59 -0
  6. package/dist/dns/NS.js +36 -0
  7. package/dist/dns/RegistrationDate.js +39 -0
  8. package/dist/dns/index.js +47 -0
  9. package/dist/functions/parseSitemap.js +12 -0
  10. package/dist/html/Anchor.js +56 -0
  11. package/dist/html/CSS.js +92 -0
  12. package/dist/html/DuplicateId.js +35 -0
  13. package/dist/html/Generator.js +31 -0
  14. package/dist/html/Image.js +79 -0
  15. package/dist/html/JavaScript.js +107 -0
  16. package/dist/{src/html → html}/__TESTS__/Generator.test.js +10 -19
  17. package/dist/html/index.js +51 -0
  18. package/dist/{src/index → index} +21 -20
  19. package/dist/{src/logger → logger}/Console.js +1 -3
  20. package/dist/metadata/HTML.js +26 -0
  21. package/dist/metadata/Markdown.js +28 -0
  22. package/dist/metadata/ResponseTime.js +25 -0
  23. package/dist/metadata/index.js +45 -0
  24. package/dist/request/NodeFetch.js +58 -0
  25. package/dist/{src/request → request}/cache/UnlimitedCache.js +2 -0
  26. package/dist/security/ContentEncoding.js +44 -0
  27. package/dist/security/ContentSecurityPolicy.js +32 -0
  28. package/dist/security/Cookies.js +44 -0
  29. package/dist/security/FingerPrint.js +37 -0
  30. package/dist/security/GoogleWebRisk.js +44 -0
  31. package/dist/security/HSTS.js +48 -0
  32. package/dist/security/HTTPS.js +78 -0
  33. package/dist/security/HTTPVersion.js +50 -0
  34. package/dist/security/PermissionsPolicy.js +53 -0
  35. package/dist/security/Redirect.js +37 -0
  36. package/dist/security/ReferrerPolicy.js +32 -0
  37. package/dist/security/RobotsTXT.js +28 -0
  38. package/dist/security/SSL.js +36 -0
  39. package/dist/security/XFrameOptions.js +32 -0
  40. package/dist/security/XXSSProtection.js +32 -0
  41. package/dist/{src/security → security}/__TESTS__/ContentSecurityPolicy.test.js +10 -19
  42. package/dist/{src/security → security}/__TESTS__/FingerPrint.test.js +10 -19
  43. package/dist/{src/security → security}/__TESTS__/HSTS.test.js +15 -24
  44. package/dist/{src/security → security}/__TESTS__/HTTPS.test.js +15 -24
  45. package/dist/{src/security → security}/__TESTS__/XFrameOptions.test.js +10 -19
  46. package/dist/{src/security → security}/__TESTS__/XXSSProtection.test.js +10 -19
  47. package/dist/{src/security → security}/index.js +20 -31
  48. package/dist/seo/Heading.js +51 -0
  49. package/dist/seo/Robots.js +21 -0
  50. package/dist/seo/Sitemap.js +32 -0
  51. package/dist/seo/Title.js +44 -0
  52. package/dist/seo/index.js +47 -0
  53. package/dist/wordpress/DefaultFiles.js +50 -0
  54. package/dist/wordpress/Generator.js +58 -0
  55. package/dist/wordpress/index.js +43 -0
  56. package/package.json +10 -2
  57. package/dist/package.json +0 -61
  58. package/dist/src/Pentest.js +0 -57
  59. package/dist/src/commands/Sitemap.js +0 -96
  60. package/dist/src/dns/A.js +0 -65
  61. package/dist/src/dns/DMARC.js +0 -73
  62. package/dist/src/dns/NS.js +0 -52
  63. package/dist/src/dns/RegistrationDate.js +0 -55
  64. package/dist/src/dns/index.js +0 -58
  65. package/dist/src/functions/parseSitemap.js +0 -23
  66. package/dist/src/html/Anchor.js +0 -72
  67. package/dist/src/html/CSS.js +0 -108
  68. package/dist/src/html/DuplicateId.js +0 -49
  69. package/dist/src/html/Generator.js +0 -45
  70. package/dist/src/html/Image.js +0 -95
  71. package/dist/src/html/JavaScript.js +0 -123
  72. package/dist/src/html/index.js +0 -62
  73. package/dist/src/metadata/HTML.js +0 -40
  74. package/dist/src/metadata/Markdown.js +0 -42
  75. package/dist/src/metadata/ResponseTime.js +0 -39
  76. package/dist/src/metadata/index.js +0 -56
  77. package/dist/src/request/NodeFetch.js +0 -68
  78. package/dist/src/security/ContentEncoding.js +0 -58
  79. package/dist/src/security/ContentSecurityPolicy.js +0 -46
  80. package/dist/src/security/Cookies.js +0 -58
  81. package/dist/src/security/FingerPrint.js +0 -51
  82. package/dist/src/security/GoogleWebRisk.js +0 -58
  83. package/dist/src/security/HSTS.js +0 -62
  84. package/dist/src/security/HTTPS.js +0 -92
  85. package/dist/src/security/HTTPVersion.js +0 -64
  86. package/dist/src/security/PermissionsPolicy.js +0 -67
  87. package/dist/src/security/Redirect.js +0 -51
  88. package/dist/src/security/ReferrerPolicy.js +0 -46
  89. package/dist/src/security/RobotsTXT.js +0 -42
  90. package/dist/src/security/SSL.js +0 -50
  91. package/dist/src/security/XFrameOptions.js +0 -46
  92. package/dist/src/security/XXSSProtection.js +0 -46
  93. package/dist/src/seo/Heading.js +0 -65
  94. package/dist/src/seo/Robots.js +0 -35
  95. package/dist/src/seo/Sitemap.js +0 -46
  96. package/dist/src/seo/Title.js +0 -58
  97. package/dist/src/seo/index.js +0 -58
  98. package/dist/src/wordpress/DefaultFiles.js +0 -66
  99. package/dist/src/wordpress/Generator.js +0 -76
  100. package/dist/src/wordpress/index.js +0 -54
  101. /package/dist/{src/Pentest.d.ts → Pentest.d.ts} +0 -0
  102. /package/dist/{src/Test.d.ts → Test.d.ts} +0 -0
  103. /package/dist/{src/commands → commands}/Sitemap.d.ts +0 -0
  104. /package/dist/{src/config.d.ts → config.d.ts} +0 -0
  105. /package/dist/{src/config.js → config.js} +0 -0
  106. /package/dist/{src/dns → dns}/A.d.ts +0 -0
  107. /package/dist/{src/dns → dns}/DMARC.d.ts +0 -0
  108. /package/dist/{src/dns → dns}/NS.d.ts +0 -0
  109. /package/dist/{src/dns → dns}/RegistrationDate.d.ts +0 -0
  110. /package/dist/{src/dns → dns}/index.d.ts +0 -0
  111. /package/dist/{src/functions → functions}/findEvery.d.ts +0 -0
  112. /package/dist/{src/functions → functions}/findEvery.js +0 -0
  113. /package/dist/{src/functions → functions}/getAnchors.d.ts +0 -0
  114. /package/dist/{src/functions → functions}/getAnchors.js +0 -0
  115. /package/dist/{src/functions → functions}/getDomain.d.ts +0 -0
  116. /package/dist/{src/functions → functions}/getDomain.js +0 -0
  117. /package/dist/{src/functions → functions}/getDuplicates.d.ts +0 -0
  118. /package/dist/{src/functions → functions}/getDuplicates.js +0 -0
  119. /package/dist/{src/functions → functions}/getGenerator.d.ts +0 -0
  120. /package/dist/{src/functions → functions}/getGenerator.js +0 -0
  121. /package/dist/{src/functions → functions}/getHeading.d.ts +0 -0
  122. /package/dist/{src/functions → functions}/getHeading.js +0 -0
  123. /package/dist/{src/functions → functions}/getImages.d.ts +0 -0
  124. /package/dist/{src/functions → functions}/getImages.js +0 -0
  125. /package/dist/{src/functions → functions}/getObject.d.ts +0 -0
  126. /package/dist/{src/functions → functions}/getObject.js +0 -0
  127. /package/dist/{src/functions → functions}/getScripts.d.ts +0 -0
  128. /package/dist/{src/functions → functions}/getScripts.js +0 -0
  129. /package/dist/{src/functions → functions}/getStylesheets.d.ts +0 -0
  130. /package/dist/{src/functions → functions}/getStylesheets.js +0 -0
  131. /package/dist/{src/functions → functions}/getTitle.d.ts +0 -0
  132. /package/dist/{src/functions → functions}/getTitle.js +0 -0
  133. /package/dist/{src/functions → functions}/index.d.ts +0 -0
  134. /package/dist/{src/functions → functions}/index.js +0 -0
  135. /package/dist/{src/functions → functions}/parseHtml.d.ts +0 -0
  136. /package/dist/{src/functions → functions}/parseHtml.js +0 -0
  137. /package/dist/{src/functions → functions}/parseSitemap.d.ts +0 -0
  138. /package/dist/{src/functions → functions}/parseXml.d.ts +0 -0
  139. /package/dist/{src/functions → functions}/parseXml.js +0 -0
  140. /package/dist/{src/html → html}/Anchor.d.ts +0 -0
  141. /package/dist/{src/html → html}/CSS.d.ts +0 -0
  142. /package/dist/{src/html → html}/DuplicateId.d.ts +0 -0
  143. /package/dist/{src/html → html}/Generator.d.ts +0 -0
  144. /package/dist/{src/html → html}/Image.d.ts +0 -0
  145. /package/dist/{src/html → html}/JavaScript.d.ts +0 -0
  146. /package/dist/{src/html → html}/__TESTS__/Generator.test.d.ts +0 -0
  147. /package/dist/{src/html → html}/index.d.ts +0 -0
  148. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  149. /package/dist/{src/logger → logger}/Console.d.ts +0 -0
  150. /package/dist/{src/logger → logger}/Logger.d.ts +0 -0
  151. /package/dist/{src/logger → logger}/Logger.js +0 -0
  152. /package/dist/{src/logger → logger}/index.d.ts +0 -0
  153. /package/dist/{src/logger → logger}/index.js +0 -0
  154. /package/dist/{src/metadata → metadata}/HTML.d.ts +0 -0
  155. /package/dist/{src/metadata → metadata}/Markdown.d.ts +0 -0
  156. /package/dist/{src/metadata → metadata}/ResponseTime.d.ts +0 -0
  157. /package/dist/{src/metadata → metadata}/index.d.ts +0 -0
  158. /package/dist/{src/report → report}/CommandLine.d.ts +0 -0
  159. /package/dist/{src/report → report}/CommandLine.js +0 -0
  160. /package/dist/{src/report → report}/Json.d.ts +0 -0
  161. /package/dist/{src/report → report}/Json.js +0 -0
  162. /package/dist/{src/report → report}/Report.d.ts +0 -0
  163. /package/dist/{src/report → report}/Report.js +0 -0
  164. /package/dist/{src/report → report}/Symbols.d.ts +0 -0
  165. /package/dist/{src/report → report}/Symbols.js +0 -0
  166. /package/dist/{src/report → report}/index.d.ts +0 -0
  167. /package/dist/{src/report → report}/index.js +0 -0
  168. /package/dist/{src/request → request}/NodeFetch.d.ts +0 -0
  169. /package/dist/{src/request → request}/Request.d.ts +0 -0
  170. /package/dist/{src/request → request}/Request.js +0 -0
  171. /package/dist/{src/request → request}/cache/BlackHoleCache.d.ts +0 -0
  172. /package/dist/{src/request → request}/cache/BlackHoleCache.js +0 -0
  173. /package/dist/{src/request → request}/cache/UnlimitedCache.d.ts +0 -0
  174. /package/dist/{src/request → request}/index.d.ts +0 -0
  175. /package/dist/{src/request → request}/index.js +0 -0
  176. /package/dist/{src/security → security}/ContentEncoding.d.ts +0 -0
  177. /package/dist/{src/security → security}/ContentSecurityPolicy.d.ts +0 -0
  178. /package/dist/{src/security → security}/Cookies.d.ts +0 -0
  179. /package/dist/{src/security → security}/FingerPrint.d.ts +0 -0
  180. /package/dist/{src/security → security}/GoogleWebRisk.d.ts +0 -0
  181. /package/dist/{src/security → security}/HSTS.d.ts +0 -0
  182. /package/dist/{src/security → security}/HTTPS.d.ts +0 -0
  183. /package/dist/{src/security → security}/HTTPVersion.d.ts +0 -0
  184. /package/dist/{src/security → security}/PermissionsPolicy.d.ts +0 -0
  185. /package/dist/{src/security → security}/Redirect.d.ts +0 -0
  186. /package/dist/{src/security → security}/ReferrerPolicy.d.ts +0 -0
  187. /package/dist/{src/security → security}/RobotsTXT.d.ts +0 -0
  188. /package/dist/{src/security → security}/SSL.d.ts +0 -0
  189. /package/dist/{src/security → security}/XFrameOptions.d.ts +0 -0
  190. /package/dist/{src/security → security}/XXSSProtection.d.ts +0 -0
  191. /package/dist/{src/security → security}/__TESTS__/ContentSecurityPolicy.test.d.ts +0 -0
  192. /package/dist/{src/security → security}/__TESTS__/FingerPrint.test.d.ts +0 -0
  193. /package/dist/{src/security → security}/__TESTS__/HSTS.test.d.ts +0 -0
  194. /package/dist/{src/security → security}/__TESTS__/HTTPS.test.d.ts +0 -0
  195. /package/dist/{src/security → security}/__TESTS__/XFrameOptions.test.d.ts +0 -0
  196. /package/dist/{src/security → security}/__TESTS__/XXSSProtection.test.d.ts +0 -0
  197. /package/dist/{src/security → security}/index.d.ts +0 -0
  198. /package/dist/{src/seo → seo}/Heading.d.ts +0 -0
  199. /package/dist/{src/seo → seo}/Robots.d.ts +0 -0
  200. /package/dist/{src/seo → seo}/Sitemap.d.ts +0 -0
  201. /package/dist/{src/seo → seo}/Title.d.ts +0 -0
  202. /package/dist/{src/seo → seo}/index.d.ts +0 -0
  203. /package/dist/{src/wordpress → wordpress}/DefaultFiles.d.ts +0 -0
  204. /package/dist/{src/wordpress → wordpress}/Generator.d.ts +0 -0
  205. /package/dist/{src/wordpress → wordpress}/index.d.ts +0 -0
@@ -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,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.10.6",
4
+ "version": "3.10.8",
5
5
  "homepage": "https://pentest-tool-lite.com",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -9,7 +9,15 @@
9
9
  "email": "juffalow@juffalow.com",
10
10
  "url": "https://juffalow.com"
11
11
  },
12
- "bin": "./src/index",
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
+ },
13
21
  "dependencies": {
14
22
  "@google-cloud/web-risk": "^4.0.1",
15
23
  "commander": "^6.0.0",
package/dist/package.json DELETED
@@ -1,61 +0,0 @@
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
- }
@@ -1,57 +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
- const metadata_1 = __importDefault(require("./metadata"));
21
- class Pentest {
22
- run(url) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- const general = new dns_1.default();
25
- const security = new security_1.default();
26
- const html = new html_1.default();
27
- const seo = new seo_1.default();
28
- const wordPress = new wordpress_1.default();
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);
46
- return {
47
- security: securityResult,
48
- dns: generalResult,
49
- html: htmlResult,
50
- seo: seoResult,
51
- wordpress: wordPressResult,
52
- metadata: metadataResult,
53
- };
54
- });
55
- }
56
- }
57
- exports.default = Pentest;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const request_1 = __importDefault(require("../request"));
16
- const functions_1 = require("../functions");
17
- /**
18
- * Check URL if contains sitemap data. If URL is not direct link
19
- * to *.xml file, it will try to search it. For example by default
20
- * it is located in the root of the page (/sitemap.xml) or it can
21
- * be mentioned in /robots.txt.
22
- *
23
- * There are 2 types of sitemap. One is common, which starts with
24
- * <urlset> tag and then there is sitemap index, wich is used
25
- * to group multiple sitemap files. This starts with <sitemapindex>
26
- * tag.
27
- *
28
- * Example:
29
- *
30
- * <?xml version="1.0" encoding="utf-8"?>
31
- * <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
32
- * <url>
33
- * <loc>http://example.com/</loc>
34
- * </url>
35
- * </urlset>
36
- *
37
- * <?xml version="1.0" encoding="UTF-8"?>
38
- * <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
39
- * <sitemap>
40
- * <loc>http://www.example.com/sitemap.xml</loc>
41
- * </sitemap>
42
- * </sitemapindex>
43
- *
44
- * @see https://en.wikipedia.org/wiki/Sitemaps
45
- * @see https://www.sitemaps.org/protocol.html
46
- * @see https://technicalseo.com/tools/docs/robots-txt/
47
- */
48
- class Sitemap {
49
- run(url) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- /*
52
- if (!url.endsWith('.xml')) {}
53
- */
54
- const sitemap = yield this.loadSitemap(url);
55
- // console.log(sitemap);
56
- return sitemap.urlset.url.map((line) => line.loc[0]);
57
- });
58
- }
59
- searchSitemaps() {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- // check /sitemap.xml
62
- // check /robots.txt
63
- });
64
- }
65
- loadSitemap(url) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const xml = yield request_1.default.get(url);
68
- const sitemap = yield (0, functions_1.parseXml)(xml);
69
- if (!this.isIndex(sitemap)) {
70
- return sitemap;
71
- }
72
- const sitemapUrls = this.getSitemapUrls(sitemap);
73
- return this.loadMultiple(sitemapUrls);
74
- });
75
- }
76
- isIndex(sitemap) {
77
- return 'sitemapindex' in sitemap;
78
- }
79
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
80
- getSitemapUrls(sitemapIndex) {
81
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
82
- return sitemapIndex.sitemapindex.sitemap.map((sitemap) => sitemap.loc[0]);
83
- }
84
- loadMultiple(sitemapUrls) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const sitemaps = yield Promise.all(sitemapUrls.map((sitemapUrl) => __awaiter(this, void 0, void 0, function* () { return yield this.loadSitemap(sitemapUrl); })));
87
- const urls = sitemaps.map((s) => s.urlset.url).reduce((arr, s) => arr.concat(s), []);
88
- return {
89
- urlset: {
90
- url: urls,
91
- },
92
- };
93
- });
94
- }
95
- }
96
- exports.default = Sitemap;
package/dist/src/dns/A.js DELETED
@@ -1,65 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const dns_1 = __importDefault(require("dns"));
16
- const whois_1 = __importDefault(require("whois"));
17
- const Test_1 = __importDefault(require("../Test"));
18
- const logger_1 = __importDefault(require("../logger"));
19
- class A extends Test_1.default {
20
- constructor() {
21
- super(...arguments);
22
- this.name = 'A';
23
- }
24
- test(_a) {
25
- return __awaiter(this, arguments, void 0, function* ({ url }) {
26
- logger_1.default.info(`Starting ${this.constructor.name} test...`);
27
- const response = yield new Promise((resolve, reject) => {
28
- dns_1.default.lookup((new URL(url).hostname), { all: true }, (err, addresses) => {
29
- if (err) {
30
- return reject(err);
31
- }
32
- resolve(addresses);
33
- });
34
- });
35
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
36
- const addresses = yield Promise.all(response.map((address) => __awaiter(this, void 0, void 0, function* () {
37
- const organization = yield this.getOrganization(address.address);
38
- return `${address.address} - ${organization}`;
39
- })));
40
- return {
41
- status: 'SUCCESS',
42
- title: this.constructor.name,
43
- description: addresses.join('\n'),
44
- };
45
- });
46
- }
47
- getOrganization(ip) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- const organization = yield new Promise((resolve, reject) => {
50
- whois_1.default.lookup(ip, function (err, data) {
51
- if (err) {
52
- return reject(err);
53
- }
54
- const organization = (typeof data === 'string' ? data.split('\n') : data)
55
- .filter((line) => line.includes('OrgName'))
56
- .map((line) => line.split(':')[1].trim())
57
- .pop();
58
- resolve(organization);
59
- });
60
- });
61
- return organization;
62
- });
63
- }
64
- }
65
- exports.default = A;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const dns_1 = __importDefault(require("dns"));
16
- const Test_1 = __importDefault(require("../Test"));
17
- const logger_1 = __importDefault(require("../logger"));
18
- const getDomain_1 = __importDefault(require("../functions/getDomain"));
19
- class DMARC extends Test_1.default {
20
- constructor() {
21
- super(...arguments);
22
- this.name = 'DMARC';
23
- }
24
- test(_a) {
25
- return __awaiter(this, arguments, void 0, function* ({ url }) {
26
- logger_1.default.info(`Starting ${this.constructor.name} test...`);
27
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
28
- const response = yield new Promise((resolve, reject) => {
29
- dns_1.default.resolveTxt(`_dmarc.${(0, getDomain_1.default)(url)}`, (err, records) => {
30
- if (err) {
31
- return reject(err);
32
- }
33
- resolve(records);
34
- });
35
- });
36
- if (response.length === 0) {
37
- return {
38
- status: 'WARNING',
39
- title: this.constructor.name,
40
- description: 'No DMARC record found for this domain.',
41
- };
42
- }
43
- const record = response.shift().shift();
44
- if (record.includes('p=none')) {
45
- return {
46
- status: 'ERROR',
47
- title: this.constructor.name,
48
- description: 'Email that fails DMARC Compliance tests will be delivered to the recipient\'s inbox.',
49
- };
50
- }
51
- if (record.includes('p=quarantine')) {
52
- return {
53
- status: 'WARNING',
54
- title: this.constructor.name,
55
- description: 'Email that fails DMARC Compliance tests will be marked as spam.',
56
- };
57
- }
58
- if (record.includes('p=reject')) {
59
- return {
60
- status: 'SUCCESS',
61
- title: this.constructor.name,
62
- description: 'Email that fails DMARC Compliance tests will be rejected.',
63
- };
64
- }
65
- return {
66
- status: 'ERROR',
67
- title: this.constructor.name,
68
- description: 'Invalid DMARC policy found!',
69
- };
70
- });
71
- }
72
- }
73
- exports.default = DMARC;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const whois_1 = __importDefault(require("whois"));
16
- const Test_1 = __importDefault(require("../Test"));
17
- const logger_1 = __importDefault(require("../logger"));
18
- const getDomain_1 = __importDefault(require("../functions/getDomain"));
19
- class NS extends Test_1.default {
20
- constructor() {
21
- super(...arguments);
22
- this.name = 'NS';
23
- }
24
- test(_a) {
25
- return __awaiter(this, arguments, void 0, function* ({ url }) {
26
- logger_1.default.info(`Starting ${this.constructor.name} test...`);
27
- const nameServers = yield this.getNameServers((0, getDomain_1.default)(url));
28
- return {
29
- status: 'SUCCESS',
30
- title: this.constructor.name,
31
- description: nameServers.join('\n'),
32
- };
33
- });
34
- }
35
- getNameServers(domain) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const nameServers = yield new Promise((resolve, reject) => {
38
- whois_1.default.lookup(domain, function (err, data) {
39
- if (err) {
40
- return reject(err);
41
- }
42
- const nameServers = (typeof data === 'string' ? data.split('\n') : data)
43
- .filter((line) => line.includes('Name Server'))
44
- .map((line) => line.split(':')[1].trim());
45
- resolve(nameServers);
46
- });
47
- });
48
- return nameServers;
49
- });
50
- }
51
- }
52
- exports.default = NS;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const whois_1 = __importDefault(require("whois"));
16
- const Test_1 = __importDefault(require("../Test"));
17
- const logger_1 = __importDefault(require("../logger"));
18
- const getDomain_1 = __importDefault(require("../functions/getDomain"));
19
- class RegistrationDate extends Test_1.default {
20
- constructor() {
21
- super(...arguments);
22
- this.name = 'RegistrationDate';
23
- }
24
- test(_a) {
25
- return __awaiter(this, arguments, void 0, function* ({ url }) {
26
- logger_1.default.info(`Starting ${this.constructor.name} test...`);
27
- const registrationDate = yield this.getRegistrationDate((0, getDomain_1.default)(url));
28
- const diffInMs = (new Date(registrationDate)).getTime() - (new Date()).getTime();
29
- const diffInDays = diffInMs / (1000 * 60 * 60 * 24);
30
- return {
31
- status: diffInDays < 7 ? 'ERROR' : diffInDays < 30 ? 'WARNING' : 'SUCCESS',
32
- title: this.constructor.name,
33
- description: `Approximately ${Math.floor(diffInDays)} days until domain expires.`,
34
- };
35
- });
36
- }
37
- getRegistrationDate(domain) {
38
- return __awaiter(this, void 0, void 0, function* () {
39
- const date = yield new Promise((resolve, reject) => {
40
- whois_1.default.lookup(domain, function (err, data) {
41
- if (err) {
42
- return reject(err);
43
- }
44
- const d = (typeof data === 'string' ? data.split('\n') : data)
45
- .filter((line) => line.includes('Expiration Date') || line.includes('Valid Until'))
46
- .map((line) => line.split(': ')[1].trim())
47
- .shift();
48
- resolve(d);
49
- });
50
- });
51
- return date;
52
- });
53
- }
54
- }
55
- exports.default = RegistrationDate;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const Test_1 = __importDefault(require("../Test"));
16
- const A_1 = __importDefault(require("./A"));
17
- const NS_1 = __importDefault(require("./NS"));
18
- const DMARC_1 = __importDefault(require("./DMARC"));
19
- const RegistrationDate_1 = __importDefault(require("./RegistrationDate"));
20
- class DNS extends Test_1.default {
21
- constructor() {
22
- super();
23
- this.name = 'DNS';
24
- this.tests = [
25
- new RegistrationDate_1.default(),
26
- new NS_1.default(),
27
- new A_1.default(),
28
- new DMARC_1.default(),
29
- ];
30
- }
31
- test(params) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const tests = this.getTests();
34
- const results = [];
35
- for (const test of tests) {
36
- let result = null;
37
- try {
38
- result = yield test.run(params);
39
- }
40
- catch (_a) {
41
- result = {
42
- status: 'ERROR',
43
- title: test.name,
44
- description: 'Test failed or cannot be run!',
45
- };
46
- }
47
- results.push(result);
48
- }
49
- return {
50
- status: this.getStatus(results.map(result => result.status)),
51
- title: this.name,
52
- description: '',
53
- results,
54
- };
55
- });
56
- }
57
- }
58
- exports.default = DNS;