@yognky/premium-security 1.0.2 → 1.0.3

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 (3) hide show
  1. package/dist/index.js +24 -21
  2. package/package.json +1 -1
  3. package/src/index.ts +27 -24
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ const advanced_1 = require("./defenses/advanced");
21
21
  const spoofing_1 = require("./defenses/spoofing");
22
22
  const timingAttack_1 = require("./defenses/timingAttack");
23
23
  const PREMIUM_PASSWORD = 'Yongkykiyotaka';
24
- const VERSION = '1.0.1';
24
+ const VERSION = '1.0.2';
25
25
  function showBanner() {
26
26
  console.log('\n');
27
27
  console.log(chalk_1.default.yellow('╔══════════════════════════════════════════════════════════╗'));
@@ -29,22 +29,8 @@ function showBanner() {
29
29
  console.log(chalk_1.default.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
30
30
  console.log(chalk_1.default.yellow('╚══════════════════════════════════════════════════════════╝\n'));
31
31
  }
32
- function askPassword() {
33
- const rl = readline_1.default.createInterface({
34
- input: process.stdin,
35
- output: process.stdout
36
- });
37
- 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) => {
41
- rl.close();
42
- resolve(answer);
43
- });
44
- });
45
- }
46
32
  function Premium(app) {
47
- console.log(chalk_1.default.cyan('\n⚙️ Memasang 12 Defense Premium...\n'));
33
+ console.log(chalk_1.default.cyan('⚙️ Memasang 12 Defense Premium...\n'));
48
34
  app.use(express_1.default.json());
49
35
  app.use(express_1.default.urlencoded({ extended: true }));
50
36
  app.use((0, ddos_1.ddosProtection)({ maxPerMinute: 100, blockDuration: 60 }));
@@ -79,15 +65,32 @@ function Premium(app) {
79
65
  });
80
66
  console.log(chalk_1.default.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
81
67
  }
68
+ async function verifyPassword() {
69
+ const rl = readline_1.default.createInterface({
70
+ input: process.stdin,
71
+ output: process.stdout
72
+ });
73
+ console.log(chalk_1.default.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
74
+ return new Promise((resolve) => {
75
+ rl.question(chalk_1.default.yellow('📝 Enter Premium Password: '), (answer) => {
76
+ rl.close();
77
+ if (answer === PREMIUM_PASSWORD) {
78
+ console.log(chalk_1.default.green('\n✅ Password Valid! Starting Premium Server...\n'));
79
+ resolve(true);
80
+ }
81
+ else {
82
+ console.log(chalk_1.default.red('\n❌ Invalid Password! Access Denied.\n'));
83
+ resolve(false);
84
+ }
85
+ });
86
+ });
87
+ }
82
88
  async function start(port = 3000) {
83
89
  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'));
90
+ const isValid = await verifyPassword();
91
+ if (!isValid) {
88
92
  process.exit(1);
89
93
  }
90
- console.log(chalk_1.default.green('\n✅ PREMIUM VERIFIED! License valid!\n'));
91
94
  const app = (0, express_1.default)();
92
95
  Premium(app);
93
96
  app.listen(port, () => {
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.3",
4
4
  "description": "💎 PREMIUM SECURITY - Official Premium Package by YOGNKY",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -18,7 +18,7 @@ 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.2';
22
22
 
23
23
  function showBanner() {
24
24
  console.log('\n');
@@ -28,24 +28,8 @@ function showBanner() {
28
28
  console.log(chalk.yellow('╚══════════════════════════════════════════════════════════╝\n'));
29
29
  }
30
30
 
31
- function askPassword(): Promise<string> {
32
- const rl = readline.createInterface({
33
- input: process.stdin,
34
- output: process.stdout
35
- });
36
-
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) => {
41
- rl.close();
42
- resolve(answer);
43
- });
44
- });
45
- }
46
-
47
31
  function Premium(app: Express) {
48
- console.log(chalk.cyan('\n⚙️ Memasang 12 Defense Premium...\n'));
32
+ console.log(chalk.cyan('⚙️ Memasang 12 Defense Premium...\n'));
49
33
 
50
34
  app.use(express.json());
51
35
  app.use(express.urlencoded({ extended: true }));
@@ -96,20 +80,39 @@ function Premium(app: Express) {
96
80
  console.log(chalk.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
97
81
  }
98
82
 
83
+ // ========== VERIFY PASSWORD (RETURN PROMISE) ==========
84
+ async function verifyPassword(): Promise<boolean> {
85
+ const rl = readline.createInterface({
86
+ input: process.stdin,
87
+ output: process.stdout
88
+ });
89
+
90
+ console.log(chalk.cyan('\n🔐 PREMIUM LICENSE VERIFICATION REQUIRED\n'));
91
+
92
+ return new Promise<boolean>((resolve) => {
93
+ rl.question(chalk.yellow('📝 Enter Premium Password: '), (answer) => {
94
+ rl.close();
95
+ if (answer === PREMIUM_PASSWORD) {
96
+ console.log(chalk.green('\n✅ Password Valid! Starting Premium Server...\n'));
97
+ resolve(true);
98
+ } else {
99
+ console.log(chalk.red('\n❌ Invalid Password! Access Denied.\n'));
100
+ resolve(false);
101
+ }
102
+ });
103
+ });
104
+ }
105
+
99
106
  // ========== START FUNCTION ==========
100
107
  async function start(port: number = 3000) {
101
108
  showBanner();
102
109
 
103
- const pass = await askPassword();
110
+ const isValid = await verifyPassword();
104
111
 
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'));
112
+ if (!isValid) {
108
113
  process.exit(1);
109
114
  }
110
115
 
111
- console.log(chalk.green('\n✅ PREMIUM VERIFIED! License valid!\n'));
112
-
113
116
  const app = express();
114
117
  Premium(app);
115
118