@yognky/premium-security 1.0.1 → 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.
- package/dist/index.js +28 -20
- package/package.json +1 -1
- package/src/index.ts +34 -38
package/dist/index.js
CHANGED
|
@@ -21,25 +21,14 @@ 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.
|
|
24
|
+
const VERSION = '1.0.2';
|
|
25
25
|
function showBanner() {
|
|
26
|
-
console.log(
|
|
26
|
+
console.log('\n');
|
|
27
|
+
console.log(chalk_1.default.yellow('╔══════════════════════════════════════════════════════════╗'));
|
|
27
28
|
console.log(chalk_1.default.yellow('║ 💎 PREMIUM SECURITY 💎 ║'));
|
|
28
29
|
console.log(chalk_1.default.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
|
|
29
30
|
console.log(chalk_1.default.yellow('╚══════════════════════════════════════════════════════════╝\n'));
|
|
30
31
|
}
|
|
31
|
-
function askPassword() {
|
|
32
|
-
const rl = readline_1.default.createInterface({
|
|
33
|
-
input: process.stdin,
|
|
34
|
-
output: process.stdout
|
|
35
|
-
});
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
rl.question(chalk_1.default.cyan('🔐 Password Premium: '), (answer) => {
|
|
38
|
-
rl.close();
|
|
39
|
-
resolve(answer);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
32
|
function Premium(app) {
|
|
44
33
|
console.log(chalk_1.default.cyan('⚙️ Memasang 12 Defense Premium...\n'));
|
|
45
34
|
app.use(express_1.default.json());
|
|
@@ -76,19 +65,38 @@ function Premium(app) {
|
|
|
76
65
|
});
|
|
77
66
|
console.log(chalk_1.default.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
|
|
78
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
|
+
}
|
|
79
88
|
async function start(port = 3000) {
|
|
80
89
|
showBanner();
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
console.log(chalk_1.default.red('\n❌ PASSWORD SALAH!\n'));
|
|
90
|
+
const isValid = await verifyPassword();
|
|
91
|
+
if (!isValid) {
|
|
84
92
|
process.exit(1);
|
|
85
93
|
}
|
|
86
|
-
console.log(chalk_1.default.green('\n✅ PREMIUM VERIFIED!\n'));
|
|
87
94
|
const app = (0, express_1.default)();
|
|
88
95
|
Premium(app);
|
|
89
96
|
app.listen(port, () => {
|
|
90
|
-
console.log(chalk_1.default.green(`✅
|
|
91
|
-
console.log(chalk_1.default.yellow(`🛡️ 12 Defenses Active
|
|
97
|
+
console.log(chalk_1.default.green(`✅ Premium server running on http://localhost:${port}`));
|
|
98
|
+
console.log(chalk_1.default.yellow(`🛡️ 12 Defenses Active!`));
|
|
99
|
+
console.log(chalk_1.default.gray(`💎 Premium Security by YOGNKY\n`));
|
|
92
100
|
});
|
|
93
101
|
return app;
|
|
94
102
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -18,83 +18,57 @@ 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.
|
|
21
|
+
const VERSION = '1.0.2';
|
|
22
22
|
|
|
23
23
|
function showBanner() {
|
|
24
|
-
console.log(
|
|
24
|
+
console.log('\n');
|
|
25
|
+
console.log(chalk.yellow('╔══════════════════════════════════════════════════════════╗'));
|
|
25
26
|
console.log(chalk.yellow('║ 💎 PREMIUM SECURITY 💎 ║'));
|
|
26
27
|
console.log(chalk.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
|
|
27
28
|
console.log(chalk.yellow('╚══════════════════════════════════════════════════════════╝\n'));
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
function askPassword(): Promise<string> {
|
|
31
|
-
const rl = readline.createInterface({
|
|
32
|
-
input: process.stdin,
|
|
33
|
-
output: process.stdout
|
|
34
|
-
});
|
|
35
|
-
return new Promise((resolve) => {
|
|
36
|
-
rl.question(chalk.cyan('🔐 Password Premium: '), (answer) => {
|
|
37
|
-
rl.close();
|
|
38
|
-
resolve(answer);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
31
|
function Premium(app: Express) {
|
|
44
32
|
console.log(chalk.cyan('⚙️ Memasang 12 Defense Premium...\n'));
|
|
45
33
|
|
|
46
|
-
// Auto middleware
|
|
47
34
|
app.use(express.json());
|
|
48
35
|
app.use(express.urlencoded({ extended: true }));
|
|
49
36
|
|
|
50
|
-
// 1. Anti DDoS
|
|
51
37
|
app.use(ddosProtection({ maxPerMinute: 100, blockDuration: 60 }));
|
|
52
38
|
console.log(chalk.green(' ✓ ') + 'Anti DDoS');
|
|
53
39
|
|
|
54
|
-
// 2. Anti SQL Injection
|
|
55
40
|
app.use(sqlInjectionProtection);
|
|
56
41
|
console.log(chalk.green(' ✓ ') + 'Anti SQL Injection');
|
|
57
42
|
|
|
58
|
-
// 3. Anti XSS
|
|
59
43
|
app.use(xssProtection);
|
|
60
44
|
console.log(chalk.green(' ✓ ') + 'Anti XSS');
|
|
61
45
|
|
|
62
|
-
// 4. Anti Bot
|
|
63
46
|
app.use(curlBotProtection);
|
|
64
47
|
console.log(chalk.green(' ✓ ') + 'Anti Bot/Curl');
|
|
65
48
|
|
|
66
|
-
// 5. Anti Headers
|
|
67
49
|
app.use(headerProtection);
|
|
68
50
|
console.log(chalk.green(' ✓ ') + 'Anti Malicious Headers');
|
|
69
51
|
|
|
70
|
-
// 6. Anti Brute Force
|
|
71
52
|
app.use(bruteforceProtection);
|
|
72
53
|
console.log(chalk.green(' ✓ ') + 'Anti Brute Force');
|
|
73
54
|
|
|
74
|
-
// 7. Rate Limiter
|
|
75
55
|
app.use(rateLimitProtection({ windowMs: 60000, maxRequests: 100 }));
|
|
76
56
|
console.log(chalk.green(' ✓ ') + 'Rate Limiter');
|
|
77
57
|
|
|
78
|
-
// 8. Anti Malware
|
|
79
58
|
app.use(malwareProtection);
|
|
80
59
|
console.log(chalk.green(' ✓ ') + 'Anti Malware');
|
|
81
60
|
|
|
82
|
-
// 9. Whitelist (opsional)
|
|
83
61
|
console.log(chalk.green(' ✓ ') + 'Whitelist Ready');
|
|
84
62
|
|
|
85
|
-
// 10. Advanced Protection
|
|
86
63
|
app.use(advancedProtection);
|
|
87
64
|
console.log(chalk.green(' ✓ ') + 'Advanced Protection');
|
|
88
65
|
|
|
89
|
-
// 11. Anti Spoofing
|
|
90
66
|
app.use(antiSpoofing);
|
|
91
67
|
console.log(chalk.green(' ✓ ') + 'Anti IP Spoofing');
|
|
92
68
|
|
|
93
|
-
// 12. Anti Timing Attack
|
|
94
69
|
app.use(antiTimingAttack);
|
|
95
70
|
console.log(chalk.green(' ✓ ') + 'Anti Timing Attack');
|
|
96
71
|
|
|
97
|
-
// Default route (optional, bisa ditimpa)
|
|
98
72
|
app.get('/', (req, res) => {
|
|
99
73
|
res.json({
|
|
100
74
|
status: 'Premium Security Active',
|
|
@@ -106,30 +80,52 @@ function Premium(app: Express) {
|
|
|
106
80
|
console.log(chalk.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
|
|
107
81
|
}
|
|
108
82
|
|
|
109
|
-
// ==========
|
|
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
|
+
|
|
106
|
+
// ========== START FUNCTION ==========
|
|
110
107
|
async function start(port: number = 3000) {
|
|
111
108
|
showBanner();
|
|
112
109
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
const isValid = await verifyPassword();
|
|
111
|
+
|
|
112
|
+
if (!isValid) {
|
|
116
113
|
process.exit(1);
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
console.log(chalk.green('\n✅ PREMIUM VERIFIED!\n'));
|
|
120
|
-
|
|
121
116
|
const app = express();
|
|
122
117
|
Premium(app);
|
|
123
118
|
|
|
124
119
|
app.listen(port, () => {
|
|
125
|
-
console.log(chalk.green(`✅
|
|
126
|
-
console.log(chalk.yellow(`🛡️ 12 Defenses Active
|
|
120
|
+
console.log(chalk.green(`✅ Premium server running on http://localhost:${port}`));
|
|
121
|
+
console.log(chalk.yellow(`🛡️ 12 Defenses Active!`));
|
|
122
|
+
console.log(chalk.gray(`💎 Premium Security by YOGNKY\n`));
|
|
127
123
|
});
|
|
128
124
|
|
|
129
125
|
return app;
|
|
130
126
|
}
|
|
131
127
|
|
|
132
|
-
// ==========
|
|
128
|
+
// ========== USE FUNCTION ==========
|
|
133
129
|
function use(app: Express) {
|
|
134
130
|
return Premium(app);
|
|
135
131
|
}
|