greybel-mock-environment 1.1.7 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  import { PermissionMap, PermissionSegment } from '../utils';
2
2
  import { User } from './user';
3
- import { Library } from './vulnerabilities';
3
+ import { Library } from './library';
4
4
  export declare enum FileType {
5
5
  Plain = 0,
6
6
  Bin = 1,
@@ -43,7 +43,7 @@ var __read = (this && this.__read) || function (o, n) {
43
43
  };
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.Folder = exports.File = exports.Entity = exports.FileType = void 0;
46
- var vulnerabilities_1 = require("./vulnerabilities");
46
+ var library_1 = require("./library");
47
47
  var FileType;
48
48
  (function (FileType) {
49
49
  FileType[FileType["Plain"] = 0] = "Plain";
@@ -153,17 +153,17 @@ var File = /** @class */ (function (_super) {
153
153
  File.prototype.getLibraryType = function () {
154
154
  switch (this.type) {
155
155
  case FileType.AptClient:
156
- return vulnerabilities_1.Library.APT;
156
+ return library_1.Library.APT;
157
157
  case FileType.Crypto:
158
- return vulnerabilities_1.Library.CRYPTO;
158
+ return library_1.Library.CRYPTO;
159
159
  case FileType.Init:
160
- return vulnerabilities_1.Library.INIT;
160
+ return library_1.Library.INIT;
161
161
  case FileType.KernelModule:
162
- return vulnerabilities_1.Library.KERNEL_MODULE;
162
+ return library_1.Library.KERNEL_MODULE;
163
163
  case FileType.Metaxploit:
164
- return vulnerabilities_1.Library.METAXPLOIT;
164
+ return library_1.Library.METAXPLOIT;
165
165
  case FileType.Net:
166
- return vulnerabilities_1.Library.NET;
166
+ return library_1.Library.NET;
167
167
  default:
168
168
  }
169
169
  return null;
@@ -9,5 +9,6 @@ export { Service, ServiceList } from './service';
9
9
  export { Session } from './session';
10
10
  export { Switch } from './switch';
11
11
  export { User } from './user';
12
- export { Library, Vulnerability, VulnerabilityAction, VulnerabilityActionList, VulnerabilityActionUser, VulnerabilityRequirementList, VulnerabilityRequirements } from './vulnerabilities';
12
+ export { Library } from './library';
13
+ export { Vulnerability, VulnerabilityAction, VulnerabilityActionList, VulnerabilityActionUser, VulnerabilityRequirementList, VulnerabilityRequirements } from './vulnerabilities';
13
14
  export { WifiNetwork } from './wifi-network';
@@ -28,8 +28,9 @@ var switch_1 = require("./switch");
28
28
  Object.defineProperty(exports, "Switch", { enumerable: true, get: function () { return switch_1.Switch; } });
29
29
  var user_1 = require("./user");
30
30
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return user_1.User; } });
31
+ var library_1 = require("./library");
32
+ Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return library_1.Library; } });
31
33
  var vulnerabilities_1 = require("./vulnerabilities");
32
- Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return vulnerabilities_1.Library; } });
33
34
  Object.defineProperty(exports, "Vulnerability", { enumerable: true, get: function () { return vulnerabilities_1.Vulnerability; } });
34
35
  Object.defineProperty(exports, "VulnerabilityAction", { enumerable: true, get: function () { return vulnerabilities_1.VulnerabilityAction; } });
35
36
  Object.defineProperty(exports, "VulnerabilityActionList", { enumerable: true, get: function () { return vulnerabilities_1.VulnerabilityActionList; } });
@@ -0,0 +1,17 @@
1
+ export declare enum Library {
2
+ SSH = "ssh",
3
+ FTP = "ftp",
4
+ HTTP = "http",
5
+ SQL = "sql",
6
+ SMTP = "smtp",
7
+ CHAT = "chat",
8
+ CAM = "cam",
9
+ RSHELL = "rshell",
10
+ KERNEL_ROUTER = "kernel_router",
11
+ APT = "apt",
12
+ METAXPLOIT = "metaxploit",
13
+ CRYPTO = "crypto",
14
+ KERNEL_MODULE = "kernel_module",
15
+ INIT = "init",
16
+ NET = "net"
17
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Library = void 0;
4
+ var Library;
5
+ (function (Library) {
6
+ Library["SSH"] = "ssh";
7
+ Library["FTP"] = "ftp";
8
+ Library["HTTP"] = "http";
9
+ Library["SQL"] = "sql";
10
+ Library["SMTP"] = "smtp";
11
+ Library["CHAT"] = "chat";
12
+ Library["CAM"] = "cam";
13
+ Library["RSHELL"] = "rshell";
14
+ Library["KERNEL_ROUTER"] = "kernel_router";
15
+ Library["APT"] = "apt";
16
+ Library["METAXPLOIT"] = "metaxploit";
17
+ Library["CRYPTO"] = "crypto";
18
+ Library["KERNEL_MODULE"] = "kernel_module";
19
+ Library["INIT"] = "init";
20
+ Library["NET"] = "net";
21
+ })(Library = exports.Library || (exports.Library = {}));
@@ -1,22 +1,4 @@
1
- import { Service } from './service';
2
- export declare enum Library {
3
- SSH = "ssh",
4
- FTP = "ftp",
5
- HTTP = "http",
6
- SQL = "sql",
7
- SMTP = "smtp",
8
- CHAT = "chat",
9
- CAM = "cam",
10
- RSHELL = "rshell",
11
- KERNEL_ROUTER = "kernel_router",
12
- APT = "apt",
13
- METAXPLOIT = "metaxploit",
14
- CRYPTO = "crypto",
15
- KERNEL_MODULE = "kernel_module",
16
- INIT = "init",
17
- NET = "net"
18
- }
19
- export declare function getServiceLibrary(service: Service): Library | null;
1
+ import { Library } from './library';
20
2
  export declare enum VulnerabilityRequirements {
21
3
  LIBRARY = 0,
22
4
  REGISTER_AMOUNT = 1,
@@ -1,44 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Vulnerability = exports.VulnerabilityActionUser = exports.VulnerabilityActionList = exports.VulnerabilityAction = exports.VulnerabilityRequirementList = exports.VulnerabilityRequirements = exports.getServiceLibrary = exports.Library = void 0;
4
- var service_1 = require("./service");
5
- var Library;
6
- (function (Library) {
7
- Library["SSH"] = "ssh";
8
- Library["FTP"] = "ftp";
9
- Library["HTTP"] = "http";
10
- Library["SQL"] = "sql";
11
- Library["SMTP"] = "smtp";
12
- Library["CHAT"] = "chat";
13
- Library["CAM"] = "cam";
14
- Library["RSHELL"] = "rshell";
15
- Library["KERNEL_ROUTER"] = "kernel_router";
16
- Library["APT"] = "apt";
17
- Library["METAXPLOIT"] = "metaxploit";
18
- Library["CRYPTO"] = "crypto";
19
- Library["KERNEL_MODULE"] = "kernel_module";
20
- Library["INIT"] = "init";
21
- Library["NET"] = "net";
22
- })(Library = exports.Library || (exports.Library = {}));
23
- function getServiceLibrary(service) {
24
- switch (service) {
25
- case service_1.Service.FTP:
26
- return Library.FTP;
27
- case service_1.Service.HTTP:
28
- return Library.HTTP;
29
- case service_1.Service.RSHELL:
30
- return Library.RSHELL;
31
- case service_1.Service.SMTP:
32
- return Library.SMTP;
33
- case service_1.Service.SQL:
34
- return Library.SQL;
35
- case service_1.Service.SSH:
36
- return Library.SSH;
37
- default:
38
- }
39
- return null;
40
- }
41
- exports.getServiceLibrary = getServiceLibrary;
3
+ exports.Vulnerability = exports.VulnerabilityActionUser = exports.VulnerabilityActionList = exports.VulnerabilityAction = exports.VulnerabilityRequirementList = exports.VulnerabilityRequirements = void 0;
42
4
  var VulnerabilityRequirements;
43
5
  (function (VulnerabilityRequirements) {
44
6
  VulnerabilityRequirements[VulnerabilityRequirements["LIBRARY"] = 0] = "LIBRARY";
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { User } from './types/user';
2
+ import { Service } from './types/service';
3
+ import { Library } from './types/library';
2
4
  export declare function isValidIp(target: string): boolean;
3
5
  export declare function isLanIp(target: string): boolean;
4
6
  export interface PermissionSegment {
@@ -11,6 +13,7 @@ export interface PermissionMap {
11
13
  g: PermissionSegment;
12
14
  o: PermissionSegment;
13
15
  }
16
+ export declare function getServiceLibrary(service: Service): Library | null;
14
17
  export declare function getPermissionSegmentValueByString(flag: PermissionSegment, flagType: string): boolean;
15
18
  export declare function setPermissionSegmentValueByString(flag: PermissionSegment, flagType: string, value: boolean): void;
16
19
  export declare function getPermissionSegmentByString(flag: PermissionMap, userType: string): PermissionSegment;
package/dist/utils.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTraversalPath = exports.getUserPath = exports.transformFlagsToPermissions = exports.getPermissionSegmentByString = exports.setPermissionSegmentValueByString = exports.getPermissionSegmentValueByString = exports.isLanIp = exports.isValidIp = void 0;
3
+ exports.getTraversalPath = exports.getUserPath = exports.transformFlagsToPermissions = exports.getPermissionSegmentByString = exports.setPermissionSegmentValueByString = exports.getPermissionSegmentValueByString = exports.getServiceLibrary = exports.isLanIp = exports.isValidIp = void 0;
4
+ var service_1 = require("./types/service");
5
+ var library_1 = require("./types/library");
4
6
  function isValidIp(target) {
5
7
  return /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(target);
6
8
  }
@@ -9,6 +11,25 @@ function isLanIp(target) {
9
11
  return /^1(0|27|69\.254|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./.test(target);
10
12
  }
11
13
  exports.isLanIp = isLanIp;
14
+ function getServiceLibrary(service) {
15
+ switch (service) {
16
+ case service_1.Service.FTP:
17
+ return library_1.Library.FTP;
18
+ case service_1.Service.HTTP:
19
+ return library_1.Library.HTTP;
20
+ case service_1.Service.RSHELL:
21
+ return library_1.Library.RSHELL;
22
+ case service_1.Service.SMTP:
23
+ return library_1.Library.SMTP;
24
+ case service_1.Service.SQL:
25
+ return library_1.Library.SQL;
26
+ case service_1.Service.SSH:
27
+ return library_1.Library.SSH;
28
+ default:
29
+ }
30
+ return null;
31
+ }
32
+ exports.getServiceLibrary = getServiceLibrary;
12
33
  function getPermissionSegmentValueByString(flag, flagType) {
13
34
  switch (flagType) {
14
35
  case 'x':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-mock-environment",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Mock environment",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",