@yognky/premium-security 1.0.2 → 1.0.4

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/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { Express } from 'express';
2
2
  declare function Premium(app: Express): void;
3
3
  declare function start(port?: number): Promise<import("express-serve-static-core").Express>;
4
- declare function use(app: Express): void;
5
- export { start, use, Premium };
4
+ declare function use(app: Express): Promise<Express>;
5
+ declare function premium(app: Express): Promise<Express>;
6
+ export { start, use, premium, Premium };
6
7
  declare const _default: {
7
8
  start: typeof start;
8
9
  use: typeof use;
10
+ premium: typeof premium;
9
11
  Premium: typeof Premium;
10
12
  };
11
13
  export default _default;
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.start = start;
7
7
  exports.use = use;
8
+ exports.premium = premium;
8
9
  exports.Premium = Premium;
9
10
  const chalk_1 = __importDefault(require("chalk"));
10
11
  const readline_1 = __importDefault(require("readline"));
@@ -21,7 +22,8 @@ const advanced_1 = require("./defenses/advanced");
21
22
  const spoofing_1 = require("./defenses/spoofing");
22
23
  const timingAttack_1 = require("./defenses/timingAttack");
23
24
  const PREMIUM_PASSWORD = 'Yongkykiyotaka';
24
- const VERSION = '1.0.1';
25
+ const VERSION = '1.0.3';
26
+ let isVerified = false;
25
27
  function showBanner() {
26
28
  console.log('\n');
27
29
  console.log(chalk_1.default.yellow('╔══════════════════════════════════════════════════════════╗'));
@@ -29,22 +31,32 @@ function showBanner() {
29
31
  console.log(chalk_1.default.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
30
32
  console.log(chalk_1.default.yellow('╚══════════════════════════════════════════════════════════╝\n'));
31
33
  }
32
- function askPassword() {
34
+ async function verifyPassword() {
35
+ if (isVerified) {
36
+ return true;
37
+ }
33
38
  const rl = readline_1.default.createInterface({
34
39
  input: process.stdin,
35
40
  output: process.stdout
36
41
  });
42
+ console.log(chalk_1.default.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
37
43
  return new Promise((resolve) => {
38
- console.log(chalk_1.default.cyan('\n🔐 MASUKKAN PASSWORD PREMIUM:'));
39
- console.log(chalk_1.default.gray(' (Password tidak akan muncul saat diketik - ini normal!)\n'));
40
- rl.question(chalk_1.default.yellow('👉 Password: '), (answer) => {
44
+ rl.question(chalk_1.default.yellow('📝 Enter Premium Password: '), (answer) => {
41
45
  rl.close();
42
- resolve(answer);
46
+ if (answer === PREMIUM_PASSWORD) {
47
+ console.log(chalk_1.default.green('\n✅ Password Valid! Premium Security Activated!\n'));
48
+ isVerified = true;
49
+ resolve(true);
50
+ }
51
+ else {
52
+ console.log(chalk_1.default.red('\n❌ Invalid Password! Access Denied.\n'));
53
+ resolve(false);
54
+ }
43
55
  });
44
56
  });
45
57
  }
46
58
  function Premium(app) {
47
- console.log(chalk_1.default.cyan('\n⚙️ Memasang 12 Defense Premium...\n'));
59
+ console.log(chalk_1.default.cyan('⚙️ Memasang 12 Defense Premium...\n'));
48
60
  app.use(express_1.default.json());
49
61
  app.use(express_1.default.urlencoded({ extended: true }));
50
62
  app.use((0, ddos_1.ddosProtection)({ maxPerMinute: 100, blockDuration: 60 }));
@@ -81,13 +93,9 @@ function Premium(app) {
81
93
  }
82
94
  async function start(port = 3000) {
83
95
  showBanner();
84
- const pass = await askPassword();
85
- if (pass !== PREMIUM_PASSWORD) {
86
- console.log(chalk_1.default.red('\n❌ PASSWORD SALAH! Akses ditolak!\n'));
87
- console.log(chalk_1.default.gray(' Password premium: Yongkykiyotaka (case sensitive)\n'));
96
+ const isValid = await verifyPassword();
97
+ if (!isValid)
88
98
  process.exit(1);
89
- }
90
- console.log(chalk_1.default.green('\n✅ PREMIUM VERIFIED! License valid!\n'));
91
99
  const app = (0, express_1.default)();
92
100
  Premium(app);
93
101
  app.listen(port, () => {
@@ -97,7 +105,20 @@ async function start(port = 3000) {
97
105
  });
98
106
  return app;
99
107
  }
100
- function use(app) {
101
- return Premium(app);
108
+ async function use(app) {
109
+ showBanner();
110
+ const isValid = await verifyPassword();
111
+ if (!isValid)
112
+ process.exit(1);
113
+ Premium(app);
114
+ return app;
115
+ }
116
+ async function premium(app) {
117
+ showBanner();
118
+ const isValid = await verifyPassword();
119
+ if (!isValid)
120
+ process.exit(1);
121
+ Premium(app);
122
+ return app;
102
123
  }
103
- exports.default = { start, use, Premium };
124
+ exports.default = { start, use, premium, Premium };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yognky/premium-security",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "💎 PREMIUM SECURITY - Official Premium Package by YOGNKY",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,9 +10,6 @@
10
10
  "clean": "rm -rf dist",
11
11
  "prepublishOnly": "npm run clean && npm run build"
12
12
  },
13
- "keywords": ["premium", "security", "yognky"],
14
- "author": "YOGNKY",
15
- "license": "UNLICENSED",
16
13
  "dependencies": {
17
14
  "express": "^4.18.2",
18
15
  "chalk": "^4.1.2",
package/src/index.ts CHANGED
@@ -18,7 +18,9 @@ import { antiSpoofing } from './defenses/spoofing';
18
18
  import { antiTimingAttack } from './defenses/timingAttack';
19
19
 
20
20
  const PREMIUM_PASSWORD = 'Yongkykiyotaka';
21
- const VERSION = '1.0.1';
21
+ const VERSION = '1.0.3';
22
+
23
+ let isVerified = false; // GLOBAL VERIFICATION FLAG
22
24
 
23
25
  function showBanner() {
24
26
  console.log('\n');
@@ -28,24 +30,36 @@ function showBanner() {
28
30
  console.log(chalk.yellow('╚══════════════════════════════════════════════════════════╝\n'));
29
31
  }
30
32
 
31
- function askPassword(): Promise<string> {
33
+ async function verifyPassword(): Promise<boolean> {
34
+ // Kalo udah pernah verified, skip
35
+ if (isVerified) {
36
+ return true;
37
+ }
38
+
32
39
  const rl = readline.createInterface({
33
40
  input: process.stdin,
34
41
  output: process.stdout
35
42
  });
36
43
 
37
- return new Promise((resolve) => {
38
- console.log(chalk.cyan('\n🔐 MASUKKAN PASSWORD PREMIUM:'));
39
- console.log(chalk.gray(' (Password tidak akan muncul saat diketik - ini normal!)\n'));
40
- rl.question(chalk.yellow('👉 Password: '), (answer) => {
44
+ console.log(chalk.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
45
+
46
+ return new Promise<boolean>((resolve) => {
47
+ rl.question(chalk.yellow('📝 Enter Premium Password: '), (answer) => {
41
48
  rl.close();
42
- resolve(answer);
49
+ if (answer === PREMIUM_PASSWORD) {
50
+ console.log(chalk.green('\n✅ Password Valid! Premium Security Activated!\n'));
51
+ isVerified = true;
52
+ resolve(true);
53
+ } else {
54
+ console.log(chalk.red('\n❌ Invalid Password! Access Denied.\n'));
55
+ resolve(false);
56
+ }
43
57
  });
44
58
  });
45
59
  }
46
60
 
47
61
  function Premium(app: Express) {
48
- console.log(chalk.cyan('\n⚙️ Memasang 12 Defense Premium...\n'));
62
+ console.log(chalk.cyan('⚙️ Memasang 12 Defense Premium...\n'));
49
63
 
50
64
  app.use(express.json());
51
65
  app.use(express.urlencoded({ extended: true }));
@@ -96,19 +110,12 @@ function Premium(app: Express) {
96
110
  console.log(chalk.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
97
111
  }
98
112
 
99
- // ========== START FUNCTION ==========
113
+ // ========== START FUNCTION (AUTO SERVER) ==========
100
114
  async function start(port: number = 3000) {
101
115
  showBanner();
102
116
 
103
- const pass = await askPassword();
104
-
105
- if (pass !== PREMIUM_PASSWORD) {
106
- console.log(chalk.red('\n❌ PASSWORD SALAH! Akses ditolak!\n'));
107
- console.log(chalk.gray(' Password premium: Yongkykiyotaka (case sensitive)\n'));
108
- process.exit(1);
109
- }
110
-
111
- console.log(chalk.green('\n✅ PREMIUM VERIFIED! License valid!\n'));
117
+ const isValid = await verifyPassword();
118
+ if (!isValid) process.exit(1);
112
119
 
113
120
  const app = express();
114
121
  Premium(app);
@@ -122,11 +129,28 @@ async function start(port: number = 3000) {
122
129
  return app;
123
130
  }
124
131
 
125
- // ========== USE FUNCTION ==========
126
- function use(app: Express) {
127
- return Premium(app);
132
+ // ========== USE FUNCTION (MANUAL EXPRESS) - JUGA WAJIB PW! ==========
133
+ async function use(app: Express) {
134
+ showBanner();
135
+
136
+ const isValid = await verifyPassword();
137
+ if (!isValid) process.exit(1);
138
+
139
+ Premium(app);
140
+ return app;
141
+ }
142
+
143
+ // ========== PREMIUM FUNCTION (LANGSUNG) - JUGA WAJIB PW! ==========
144
+ async function premium(app: Express) {
145
+ showBanner();
146
+
147
+ const isValid = await verifyPassword();
148
+ if (!isValid) process.exit(1);
149
+
150
+ Premium(app);
151
+ return app;
128
152
  }
129
153
 
130
154
  // ========== EXPORT ==========
131
- export { start, use, Premium };
132
- export default { start, use, Premium };
155
+ export { start, use, premium, Premium };
156
+ export default { start, use, premium, Premium };