@maiyunnet/kebab 2.0.0

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 (114) hide show
  1. package/.VSCodeCounter/2025-02-14_14-46-44/details.md +82 -0
  2. package/.VSCodeCounter/2025-02-14_14-46-44/diff-details.md +15 -0
  3. package/.VSCodeCounter/2025-02-14_14-46-44/diff.csv +2 -0
  4. package/.VSCodeCounter/2025-02-14_14-46-44/diff.md +19 -0
  5. package/.VSCodeCounter/2025-02-14_14-46-44/diff.txt +22 -0
  6. package/.VSCodeCounter/2025-02-14_14-46-44/results.csv +69 -0
  7. package/.VSCodeCounter/2025-02-14_14-46-44/results.json +1 -0
  8. package/.VSCodeCounter/2025-02-14_14-46-44/results.md +48 -0
  9. package/.VSCodeCounter/2025-02-14_14-46-44/results.txt +118 -0
  10. package/.vscode/tasks.json +15 -0
  11. package/LICENSE +201 -0
  12. package/README.md +201 -0
  13. package/bin/kebab.js +2 -0
  14. package/eslint.config.js +22 -0
  15. package/index.js +19 -0
  16. package/index.ts +33 -0
  17. package/lib/buffer.js +108 -0
  18. package/lib/buffer.ts +152 -0
  19. package/lib/captcha/zcool-addict-italic.ttf +0 -0
  20. package/lib/captcha.js +71 -0
  21. package/lib/captcha.ts +63 -0
  22. package/lib/consistent.js +171 -0
  23. package/lib/consistent.ts +219 -0
  24. package/lib/core.js +663 -0
  25. package/lib/core.ts +880 -0
  26. package/lib/crypto.js +256 -0
  27. package/lib/crypto.ts +384 -0
  28. package/lib/db.js +521 -0
  29. package/lib/db.ts +719 -0
  30. package/lib/dns.js +321 -0
  31. package/lib/dns.ts +405 -0
  32. package/lib/fs.js +405 -0
  33. package/lib/fs.ts +527 -0
  34. package/lib/jwt.js +223 -0
  35. package/lib/jwt.ts +276 -0
  36. package/lib/kv.js +1004 -0
  37. package/lib/kv.ts +1489 -0
  38. package/lib/lan.js +99 -0
  39. package/lib/lan.ts +87 -0
  40. package/lib/net/cacert.pem +3480 -0
  41. package/lib/net/formdata.js +137 -0
  42. package/lib/net/formdata.ts +166 -0
  43. package/lib/net/request.js +102 -0
  44. package/lib/net/request.ts +150 -0
  45. package/lib/net/response.js +28 -0
  46. package/lib/net/response.ts +59 -0
  47. package/lib/net.js +462 -0
  48. package/lib/net.ts +662 -0
  49. package/lib/s3.js +180 -0
  50. package/lib/s3.ts +235 -0
  51. package/lib/scan.js +276 -0
  52. package/lib/scan.ts +364 -0
  53. package/lib/session.js +177 -0
  54. package/lib/session.ts +230 -0
  55. package/lib/sql.js +818 -0
  56. package/lib/sql.ts +1151 -0
  57. package/lib/ssh/sftp.js +373 -0
  58. package/lib/ssh/sftp.ts +508 -0
  59. package/lib/ssh/shell.js +109 -0
  60. package/lib/ssh/shell.ts +123 -0
  61. package/lib/ssh.js +171 -0
  62. package/lib/ssh.ts +191 -0
  63. package/lib/text/tld.json +1 -0
  64. package/lib/text.js +452 -0
  65. package/lib/text.ts +607 -0
  66. package/lib/time.js +216 -0
  67. package/lib/time.ts +254 -0
  68. package/lib/ws.js +373 -0
  69. package/lib/ws.ts +523 -0
  70. package/lib/zip.js +381 -0
  71. package/lib/zip.ts +447 -0
  72. package/lib/zlib.js +289 -0
  73. package/lib/zlib.ts +350 -0
  74. package/main.js +51 -0
  75. package/main.ts +27 -0
  76. package/package.json +37 -0
  77. package/sys/child.js +585 -0
  78. package/sys/child.ts +678 -0
  79. package/sys/cmd.js +226 -0
  80. package/sys/cmd.ts +225 -0
  81. package/sys/ctr.js +608 -0
  82. package/sys/ctr.ts +904 -0
  83. package/sys/master.js +314 -0
  84. package/sys/master.ts +355 -0
  85. package/sys/mod.js +1273 -0
  86. package/sys/mod.ts +1871 -0
  87. package/sys/route.js +922 -0
  88. package/sys/route.ts +1113 -0
  89. package/types/index.d.ts +283 -0
  90. package/www/example/ctr/main.js +42 -0
  91. package/www/example/ctr/main.ts +9 -0
  92. package/www/example/ctr/middle.js +57 -0
  93. package/www/example/ctr/middle.ts +26 -0
  94. package/www/example/ctr/test.js +2818 -0
  95. package/www/example/ctr/test.ts +3218 -0
  96. package/www/example/data/locale/en.test.json +8 -0
  97. package/www/example/data/locale/index.html +1 -0
  98. package/www/example/data/locale/ja.test.json +8 -0
  99. package/www/example/data/locale/sc.test.json +8 -0
  100. package/www/example/data/locale/tc.test.json +8 -0
  101. package/www/example/data/test.zip +0 -0
  102. package/www/example/kebab.json +24 -0
  103. package/www/example/mod/test.js +49 -0
  104. package/www/example/mod/test.ts +47 -0
  105. package/www/example/mod/testdata.js +11 -0
  106. package/www/example/mod/testdata.ts +30 -0
  107. package/www/example/route.json +6 -0
  108. package/www/example/view/test.ejs +11 -0
  109. package/www/example/ws/mproxy.js +49 -0
  110. package/www/example/ws/mproxy.ts +16 -0
  111. package/www/example/ws/rproxy.js +47 -0
  112. package/www/example/ws/rproxy.ts +14 -0
  113. package/www/example/ws/test.js +68 -0
  114. package/www/example/ws/test.ts +36 -0
package/lib/lan.js ADDED
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.card = card;
37
+ exports.scan = scan;
38
+ const os = __importStar(require("os"));
39
+ const lCore = __importStar(require("~/lib/core"));
40
+ async function card() {
41
+ const result = [];
42
+ let i = 0;
43
+ while (i < 5) {
44
+ const nifs = os.networkInterfaces();
45
+ if (!Object.keys(nifs).length) {
46
+ ++i;
47
+ await lCore.sleep(50);
48
+ continue;
49
+ }
50
+ for (const name in nifs) {
51
+ const card = nifs[name];
52
+ if (!card) {
53
+ continue;
54
+ }
55
+ if (card[0].internal) {
56
+ continue;
57
+ }
58
+ const item = {
59
+ 'name': name,
60
+ 'mac': '',
61
+ 'iPv4': '',
62
+ 'iPv6': ''
63
+ };
64
+ for (const it of card) {
65
+ if (!item.mac) {
66
+ item.mac = it.mac;
67
+ }
68
+ if (it.family === 'IPv4') {
69
+ item.iPv4 = it.address;
70
+ }
71
+ else {
72
+ item.iPv6 = it.address;
73
+ }
74
+ }
75
+ result.push(item);
76
+ }
77
+ break;
78
+ }
79
+ return result;
80
+ }
81
+ async function scan() {
82
+ const result = [];
83
+ const res = await lCore.exec('arp -a');
84
+ if (!res) {
85
+ return result;
86
+ }
87
+ const lines = res.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n');
88
+ for (const line of lines) {
89
+ const match = /([0-9.]{5,}).+?([a-zA-Z0-9:-]{5,})/.exec(line);
90
+ if (!match) {
91
+ continue;
92
+ }
93
+ result.push({
94
+ 'iPv4': match[1],
95
+ 'mac': match[2].replace(/-/g, ':')
96
+ });
97
+ }
98
+ return result;
99
+ }
package/lib/lan.ts ADDED
@@ -0,0 +1,87 @@
1
+ import * as os from 'os';
2
+ import * as lCore from '~/lib/core';
3
+
4
+ /**
5
+ * --- 获取当前网卡的 IP、MAC 信息 ---
6
+ */
7
+ export async function card(): Promise<Array<{
8
+ 'name': string;
9
+ 'mac': string;
10
+ 'iPv4': string;
11
+ 'iPv6': string;
12
+ }>> {
13
+ const result: Array<{
14
+ 'name': string;
15
+ 'mac': string;
16
+ 'iPv4': string;
17
+ 'iPv6': string;
18
+ }> = [];
19
+ let i = 0;
20
+ while (i < 5) {
21
+ const nifs = os.networkInterfaces();
22
+ if (!Object.keys(nifs).length) {
23
+ ++i;
24
+ await lCore.sleep(50);
25
+ continue;
26
+ }
27
+ for (const name in nifs) {
28
+ /** --- 当前网卡 --- */
29
+ const card = nifs[name];
30
+ if (!card) {
31
+ continue;
32
+ }
33
+ if (card[0].internal) {
34
+ continue;
35
+ }
36
+ const item = {
37
+ 'name': name,
38
+ 'mac': '',
39
+ 'iPv4': '',
40
+ 'iPv6': ''
41
+ };
42
+ for (const it of card) {
43
+ if (!item.mac) {
44
+ item.mac = it.mac;
45
+ }
46
+ if (it.family === 'IPv4') {
47
+ item.iPv4 = it.address;
48
+ }
49
+ else {
50
+ item.iPv6 = it.address;
51
+ }
52
+ }
53
+ result.push(item);
54
+ }
55
+ break;
56
+ }
57
+ return result;
58
+ }
59
+
60
+ /**
61
+ * --- 扫描发生关联的局域网 IP ---
62
+ */
63
+ export async function scan(): Promise<Array<{
64
+ 'mac': string;
65
+ 'iPv4': string;
66
+ }>> {
67
+ const result: Array<{
68
+ 'mac': string;
69
+ 'iPv4': string;
70
+ }> = [];
71
+ const res = await lCore.exec('arp -a');
72
+ if (!res) {
73
+ return result;
74
+ }
75
+ const lines = res.replace(/\r\n/g, '\n').replace(/\r/g, '\n').split('\n');
76
+ for (const line of lines) {
77
+ const match = /([0-9.]{5,}).+?([a-zA-Z0-9:-]{5,})/.exec(line);
78
+ if (!match) {
79
+ continue;
80
+ }
81
+ result.push({
82
+ 'iPv4': match[1],
83
+ 'mac': match[2].replace(/-/g, ':')
84
+ });
85
+ }
86
+ return result;
87
+ }