@yognky/premium-security 1.0.0 → 1.0.1
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 +6 -2
- package/dist/index.js +40 -40
- package/package.json +1 -1
- package/src/index.ts +62 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
declare function Premium(app: Express): void;
|
|
2
3
|
declare function start(port?: number): Promise<import("express-serve-static-core").Express>;
|
|
3
|
-
|
|
4
|
+
declare function use(app: Express): void;
|
|
5
|
+
export { start, use, Premium };
|
|
4
6
|
declare const _default: {
|
|
5
7
|
start: typeof start;
|
|
8
|
+
use: typeof use;
|
|
9
|
+
Premium: typeof Premium;
|
|
6
10
|
};
|
|
7
11
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PREMIUM_VERSION = void 0;
|
|
7
6
|
exports.start = start;
|
|
7
|
+
exports.use = use;
|
|
8
|
+
exports.Premium = Premium;
|
|
8
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
10
|
const readline_1 = __importDefault(require("readline"));
|
|
10
11
|
const express_1 = __importDefault(require("express"));
|
|
11
|
-
const PREMIUM_VERSION = '1.0.0';
|
|
12
|
-
exports.PREMIUM_VERSION = PREMIUM_VERSION;
|
|
13
|
-
const PREMIUM_PASSWORD = 'Yongkykiyotaka';
|
|
14
12
|
const ddos_1 = require("./defenses/ddos");
|
|
15
13
|
const sqlInjection_1 = require("./defenses/sqlInjection");
|
|
16
14
|
const xss_1 = require("./defenses/xss");
|
|
@@ -22,16 +20,13 @@ const malware_1 = require("./defenses/malware");
|
|
|
22
20
|
const advanced_1 = require("./defenses/advanced");
|
|
23
21
|
const spoofing_1 = require("./defenses/spoofing");
|
|
24
22
|
const timingAttack_1 = require("./defenses/timingAttack");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
console.log(chalk_1.default.yellow('
|
|
29
|
-
console.log(chalk_1.default.
|
|
30
|
-
console.log(chalk_1.default.
|
|
31
|
-
console.log(chalk_1.default.
|
|
32
|
-
console.log(chalk_1.default.white(` 💎 Version : ${chalk_1.default.green(PREMIUM_VERSION)}`));
|
|
33
|
-
console.log(chalk_1.default.white(` 🔐 Security : ${chalk_1.default.green('PASSWORD PROTECTED')}`));
|
|
34
|
-
console.log(chalk_1.default.red('\n╚════════════════════════════════════════════════════════════════╝\n'));
|
|
23
|
+
const PREMIUM_PASSWORD = 'Yongkykiyotaka';
|
|
24
|
+
const VERSION = '1.0.1';
|
|
25
|
+
function showBanner() {
|
|
26
|
+
console.log(chalk_1.default.yellow('\n╔══════════════════════════════════════════════════════════╗'));
|
|
27
|
+
console.log(chalk_1.default.yellow('║ 💎 PREMIUM SECURITY 💎 ║'));
|
|
28
|
+
console.log(chalk_1.default.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
|
|
29
|
+
console.log(chalk_1.default.yellow('╚══════════════════════════════════════════════════════════╝\n'));
|
|
35
30
|
}
|
|
36
31
|
function askPassword() {
|
|
37
32
|
const rl = readline_1.default.createInterface({
|
|
@@ -39,60 +34,65 @@ function askPassword() {
|
|
|
39
34
|
output: process.stdout
|
|
40
35
|
});
|
|
41
36
|
return new Promise((resolve) => {
|
|
42
|
-
rl.question(chalk_1.default.
|
|
37
|
+
rl.question(chalk_1.default.cyan('🔐 Password Premium: '), (answer) => {
|
|
43
38
|
rl.close();
|
|
44
39
|
resolve(answer);
|
|
45
40
|
});
|
|
46
41
|
});
|
|
47
42
|
}
|
|
48
|
-
function
|
|
49
|
-
console.log(chalk_1.default.cyan('⚙️
|
|
43
|
+
function Premium(app) {
|
|
44
|
+
console.log(chalk_1.default.cyan('⚙️ Memasang 12 Defense Premium...\n'));
|
|
50
45
|
app.use(express_1.default.json());
|
|
51
46
|
app.use(express_1.default.urlencoded({ extended: true }));
|
|
52
47
|
app.use((0, ddos_1.ddosProtection)({ maxPerMinute: 100, blockDuration: 60 }));
|
|
53
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
48
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti DDoS');
|
|
54
49
|
app.use(sqlInjection_1.sqlInjectionProtection);
|
|
55
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
50
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti SQL Injection');
|
|
56
51
|
app.use(xss_1.xssProtection);
|
|
57
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
52
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti XSS');
|
|
58
53
|
app.use(curlBot_1.curlBotProtection);
|
|
59
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
54
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti Bot/Curl');
|
|
60
55
|
app.use(headers_1.headerProtection);
|
|
61
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
56
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti Malicious Headers');
|
|
62
57
|
app.use(bruteforce_1.bruteforceProtection);
|
|
63
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
58
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti Brute Force');
|
|
64
59
|
app.use((0, rateLimit_1.rateLimitProtection)({ windowMs: 60000, maxRequests: 100 }));
|
|
65
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
60
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Rate Limiter');
|
|
66
61
|
app.use(malware_1.malwareProtection);
|
|
67
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
62
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti Malware');
|
|
63
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Whitelist Ready');
|
|
68
64
|
app.use(advanced_1.advancedProtection);
|
|
69
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
65
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Advanced Protection');
|
|
70
66
|
app.use(spoofing_1.antiSpoofing);
|
|
71
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
67
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti IP Spoofing');
|
|
72
68
|
app.use(timingAttack_1.antiTimingAttack);
|
|
73
|
-
console.log(chalk_1.default.green(' ✓ ') +
|
|
69
|
+
console.log(chalk_1.default.green(' ✓ ') + 'Anti Timing Attack');
|
|
74
70
|
app.get('/', (req, res) => {
|
|
75
71
|
res.json({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
status: 'Premium Security Active',
|
|
73
|
+
defenses: '12 Layers',
|
|
74
|
+
version: VERSION
|
|
79
75
|
});
|
|
80
76
|
});
|
|
81
|
-
console.log(chalk_1.default.
|
|
77
|
+
console.log(chalk_1.default.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
|
|
82
78
|
}
|
|
83
79
|
async function start(port = 3000) {
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
console.log(chalk_1.default.red('\n❌
|
|
80
|
+
showBanner();
|
|
81
|
+
const pass = await askPassword();
|
|
82
|
+
if (pass !== PREMIUM_PASSWORD) {
|
|
83
|
+
console.log(chalk_1.default.red('\n❌ PASSWORD SALAH!\n'));
|
|
88
84
|
process.exit(1);
|
|
89
85
|
}
|
|
90
|
-
console.log(chalk_1.default.green('\n✅ PREMIUM
|
|
86
|
+
console.log(chalk_1.default.green('\n✅ PREMIUM VERIFIED!\n'));
|
|
91
87
|
const app = (0, express_1.default)();
|
|
92
|
-
|
|
88
|
+
Premium(app);
|
|
93
89
|
app.listen(port, () => {
|
|
94
|
-
console.log(chalk_1.default.green(`✅
|
|
90
|
+
console.log(chalk_1.default.green(`✅ Server running on http://localhost:${port}`));
|
|
91
|
+
console.log(chalk_1.default.yellow(`🛡️ 12 Defenses Active!\n`));
|
|
95
92
|
});
|
|
96
93
|
return app;
|
|
97
94
|
}
|
|
98
|
-
|
|
95
|
+
function use(app) {
|
|
96
|
+
return Premium(app);
|
|
97
|
+
}
|
|
98
|
+
exports.default = { start, use, Premium };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { Express, Request, Response, NextFunction } from 'express';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import figlet from 'figlet';
|
|
4
|
-
import gradient from 'gradient-string';
|
|
5
3
|
import readline from 'readline';
|
|
6
|
-
import express from 'express';
|
|
4
|
+
import express from 'express';
|
|
7
5
|
|
|
8
|
-
// ========== PREMIUM
|
|
9
|
-
const PREMIUM_VERSION = '1.0.0';
|
|
10
|
-
const PREMIUM_PASSWORD = 'Yongkykiyotaka';
|
|
11
|
-
|
|
12
|
-
// ========== PREMIUM DEFENSES ==========
|
|
6
|
+
// ========== 12 DEFENSES PREMIUM ==========
|
|
13
7
|
import { ddosProtection } from './defenses/ddos';
|
|
14
8
|
import { sqlInjectionProtection } from './defenses/sqlInjection';
|
|
15
9
|
import { xssProtection } from './defenses/xss';
|
|
@@ -23,16 +17,14 @@ import { advancedProtection } from './defenses/advanced';
|
|
|
23
17
|
import { antiSpoofing } from './defenses/spoofing';
|
|
24
18
|
import { antiTimingAttack } from './defenses/timingAttack';
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
console.log(chalk.
|
|
31
|
-
console.log(chalk.
|
|
32
|
-
console.log(chalk.
|
|
33
|
-
console.log(chalk.
|
|
34
|
-
console.log(chalk.white(` 🔐 Security : ${chalk.green('PASSWORD PROTECTED')}`));
|
|
35
|
-
console.log(chalk.red('\n╚════════════════════════════════════════════════════════════════╝\n'));
|
|
20
|
+
const PREMIUM_PASSWORD = 'Yongkykiyotaka';
|
|
21
|
+
const VERSION = '1.0.1';
|
|
22
|
+
|
|
23
|
+
function showBanner() {
|
|
24
|
+
console.log(chalk.yellow('\n╔══════════════════════════════════════════════════════════╗'));
|
|
25
|
+
console.log(chalk.yellow('║ 💎 PREMIUM SECURITY 💎 ║'));
|
|
26
|
+
console.log(chalk.green(`║ 12 DEFENSES ACTIVE | v${VERSION} ║`));
|
|
27
|
+
console.log(chalk.yellow('╚══════════════════════════════════════════════════════════╝\n'));
|
|
36
28
|
}
|
|
37
29
|
|
|
38
30
|
function askPassword(): Promise<string> {
|
|
@@ -40,86 +32,108 @@ function askPassword(): Promise<string> {
|
|
|
40
32
|
input: process.stdin,
|
|
41
33
|
output: process.stdout
|
|
42
34
|
});
|
|
43
|
-
|
|
44
35
|
return new Promise((resolve) => {
|
|
45
|
-
rl.question(chalk.
|
|
36
|
+
rl.question(chalk.cyan('🔐 Password Premium: '), (answer) => {
|
|
46
37
|
rl.close();
|
|
47
38
|
resolve(answer);
|
|
48
39
|
});
|
|
49
40
|
});
|
|
50
41
|
}
|
|
51
42
|
|
|
52
|
-
function
|
|
53
|
-
console.log(chalk.cyan('⚙️
|
|
43
|
+
function Premium(app: Express) {
|
|
44
|
+
console.log(chalk.cyan('⚙️ Memasang 12 Defense Premium...\n'));
|
|
54
45
|
|
|
46
|
+
// Auto middleware
|
|
55
47
|
app.use(express.json());
|
|
56
48
|
app.use(express.urlencoded({ extended: true }));
|
|
57
49
|
|
|
50
|
+
// 1. Anti DDoS
|
|
58
51
|
app.use(ddosProtection({ maxPerMinute: 100, blockDuration: 60 }));
|
|
59
|
-
console.log(chalk.green(' ✓ ') +
|
|
52
|
+
console.log(chalk.green(' ✓ ') + 'Anti DDoS');
|
|
60
53
|
|
|
54
|
+
// 2. Anti SQL Injection
|
|
61
55
|
app.use(sqlInjectionProtection);
|
|
62
|
-
console.log(chalk.green(' ✓ ') +
|
|
56
|
+
console.log(chalk.green(' ✓ ') + 'Anti SQL Injection');
|
|
63
57
|
|
|
58
|
+
// 3. Anti XSS
|
|
64
59
|
app.use(xssProtection);
|
|
65
|
-
console.log(chalk.green(' ✓ ') +
|
|
60
|
+
console.log(chalk.green(' ✓ ') + 'Anti XSS');
|
|
66
61
|
|
|
62
|
+
// 4. Anti Bot
|
|
67
63
|
app.use(curlBotProtection);
|
|
68
|
-
console.log(chalk.green(' ✓ ') +
|
|
64
|
+
console.log(chalk.green(' ✓ ') + 'Anti Bot/Curl');
|
|
69
65
|
|
|
66
|
+
// 5. Anti Headers
|
|
70
67
|
app.use(headerProtection);
|
|
71
|
-
console.log(chalk.green(' ✓ ') +
|
|
68
|
+
console.log(chalk.green(' ✓ ') + 'Anti Malicious Headers');
|
|
72
69
|
|
|
70
|
+
// 6. Anti Brute Force
|
|
73
71
|
app.use(bruteforceProtection);
|
|
74
|
-
console.log(chalk.green(' ✓ ') +
|
|
72
|
+
console.log(chalk.green(' ✓ ') + 'Anti Brute Force');
|
|
75
73
|
|
|
74
|
+
// 7. Rate Limiter
|
|
76
75
|
app.use(rateLimitProtection({ windowMs: 60000, maxRequests: 100 }));
|
|
77
|
-
console.log(chalk.green(' ✓ ') +
|
|
76
|
+
console.log(chalk.green(' ✓ ') + 'Rate Limiter');
|
|
78
77
|
|
|
78
|
+
// 8. Anti Malware
|
|
79
79
|
app.use(malwareProtection);
|
|
80
|
-
console.log(chalk.green(' ✓ ') +
|
|
80
|
+
console.log(chalk.green(' ✓ ') + 'Anti Malware');
|
|
81
81
|
|
|
82
|
+
// 9. Whitelist (opsional)
|
|
83
|
+
console.log(chalk.green(' ✓ ') + 'Whitelist Ready');
|
|
84
|
+
|
|
85
|
+
// 10. Advanced Protection
|
|
82
86
|
app.use(advancedProtection);
|
|
83
|
-
console.log(chalk.green(' ✓ ') +
|
|
87
|
+
console.log(chalk.green(' ✓ ') + 'Advanced Protection');
|
|
84
88
|
|
|
89
|
+
// 11. Anti Spoofing
|
|
85
90
|
app.use(antiSpoofing);
|
|
86
|
-
console.log(chalk.green(' ✓ ') +
|
|
91
|
+
console.log(chalk.green(' ✓ ') + 'Anti IP Spoofing');
|
|
87
92
|
|
|
93
|
+
// 12. Anti Timing Attack
|
|
88
94
|
app.use(antiTimingAttack);
|
|
89
|
-
console.log(chalk.green(' ✓ ') +
|
|
95
|
+
console.log(chalk.green(' ✓ ') + 'Anti Timing Attack');
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
// Default route (optional, bisa ditimpa)
|
|
98
|
+
app.get('/', (req, res) => {
|
|
92
99
|
res.json({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
status: 'Premium Security Active',
|
|
101
|
+
defenses: '12 Layers',
|
|
102
|
+
version: VERSION
|
|
96
103
|
});
|
|
97
104
|
});
|
|
98
105
|
|
|
99
|
-
console.log(chalk.
|
|
106
|
+
console.log(chalk.green('\n✨ PREMIUM 12 DEFENSES READY! ✨\n'));
|
|
100
107
|
}
|
|
101
108
|
|
|
109
|
+
// ========== CARA 1: AUTO START (PALING SIMPLE) ==========
|
|
102
110
|
async function start(port: number = 3000) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const password = await askPassword();
|
|
111
|
+
showBanner();
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
const pass = await askPassword();
|
|
114
|
+
if (pass !== PREMIUM_PASSWORD) {
|
|
115
|
+
console.log(chalk.red('\n❌ PASSWORD SALAH!\n'));
|
|
109
116
|
process.exit(1);
|
|
110
117
|
}
|
|
111
118
|
|
|
112
|
-
console.log(chalk.green('\n✅ PREMIUM
|
|
119
|
+
console.log(chalk.green('\n✅ PREMIUM VERIFIED!\n'));
|
|
113
120
|
|
|
114
121
|
const app = express();
|
|
115
|
-
|
|
122
|
+
Premium(app);
|
|
116
123
|
|
|
117
124
|
app.listen(port, () => {
|
|
118
|
-
console.log(chalk.green(`✅
|
|
125
|
+
console.log(chalk.green(`✅ Server running on http://localhost:${port}`));
|
|
126
|
+
console.log(chalk.yellow(`🛡️ 12 Defenses Active!\n`));
|
|
119
127
|
});
|
|
120
128
|
|
|
121
129
|
return app;
|
|
122
130
|
}
|
|
123
131
|
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
// ========== CARA 2: PAKE EXPRESS (FLEKSIBEL) ==========
|
|
133
|
+
function use(app: Express) {
|
|
134
|
+
return Premium(app);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ========== EXPORT ==========
|
|
138
|
+
export { start, use, Premium };
|
|
139
|
+
export default { start, use, Premium };
|