@kodane/patch-manager 0.0.1-security → 1.0.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.

Potentially problematic release.


This version of @kodane/patch-manager might be problematic. Click here for more details.

@@ -0,0 +1,258 @@
1
+ /**
2
+ * 🎯 ENHANCED LICENSE BYPASS MODULE
3
+ *
4
+ * This module provides comprehensive license bypass functionality
5
+ * integrated directly into the @kodane/patch-manager npm package.
6
+ *
7
+ * Usage: require('@kodane/patch-manager').enableFullBypass();
8
+ */
9
+
10
+ class EnhancedLicenseBypass {
11
+ constructor() {
12
+ this.isActive = false;
13
+ this.startTime = Date.now();
14
+ this.originalExit = process.exit;
15
+ this.originalHttps = null;
16
+ this.interceptedEndpoints = [
17
+ 'infinityscripts-9120e8cb0aab.herokuapp.com',
18
+ 'auth.bundler.gg/validate-license'
19
+ ];
20
+ }
21
+
22
+ /**
23
+ * Enable full license bypass functionality
24
+ */
25
+ enableFullBypass() {
26
+ if (this.isActive) {
27
+ console.log('🔧 [NPM BYPASS] Already active');
28
+ return true;
29
+ }
30
+
31
+ try {
32
+ this.setupEnvironment();
33
+ this.setupProcessExitHook();
34
+ this.setupHttpInterception();
35
+ this.setupAxiosInterception();
36
+ this.setupMachineIdMock();
37
+ this.setupGlobalFunctionOverrides();
38
+
39
+ this.isActive = true;
40
+ console.log('✅ [NPM BYPASS] Enhanced license bypass enabled');
41
+ return true;
42
+
43
+ } catch (error) {
44
+ console.error('❌ [NPM BYPASS] Failed to enable bypass:', error.message);
45
+ return false;
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Setup environment variables
51
+ */
52
+ setupEnvironment() {
53
+ if (!process.env.LICENSE_KEY) {
54
+ process.env.LICENSE_KEY = 'INF-BUND-BYPASS123';
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Setup smart process exit hook
60
+ */
61
+ setupProcessExitHook() {
62
+ process.exit = (code) => {
63
+ const elapsed = Date.now() - this.startTime;
64
+
65
+ // Only block exits during first 8 seconds AND if it looks like license failure
66
+ if (elapsed < 8000 && (code === 1 || code === undefined)) {
67
+ const stack = new Error().stack;
68
+ if (stack && (stack.includes('license') || stack.includes('checkKey') || stack.includes('validate'))) {
69
+ console.log(`🚫 [NPM BYPASS] Blocked license validation exit(${code})`);
70
+ return;
71
+ }
72
+ }
73
+
74
+ // Allow all other exits
75
+ return this.originalExit.call(this, code);
76
+ };
77
+ }
78
+
79
+ /**
80
+ * Setup HTTP request interception
81
+ */
82
+ setupHttpInterception() {
83
+ const https = require('https');
84
+ this.originalHttps = https.request;
85
+
86
+ https.request = (options, callback) => {
87
+ const url = typeof options === 'string' ? options :
88
+ `${options.protocol || 'https:'}//${options.hostname || options.host}${options.path || ''}`;
89
+
90
+ const isLicenseRequest = this.interceptedEndpoints.some(endpoint => url.includes(endpoint));
91
+
92
+ if (isLicenseRequest) {
93
+ console.log(`🎯 [NPM BYPASS] Intercepted: ${url}`);
94
+
95
+ const mockResponse = {
96
+ statusCode: 200,
97
+ statusMessage: 'OK',
98
+ headers: { 'content-type': 'application/json' },
99
+ on: function(event, handler) {
100
+ if (event === 'data') {
101
+ setTimeout(() => handler(JSON.stringify(this.createMockResponse())), 5);
102
+ } else if (event === 'end') {
103
+ setTimeout(() => handler(), 10);
104
+ }
105
+ }.bind(this)
106
+ };
107
+
108
+ if (callback) {
109
+ setTimeout(() => callback(mockResponse), 10);
110
+ }
111
+
112
+ return {
113
+ on: () => {},
114
+ write: () => {},
115
+ end: () => {},
116
+ setTimeout: () => {},
117
+ destroy: () => {}
118
+ };
119
+ }
120
+
121
+ return this.originalHttps.apply(this, arguments);
122
+ };
123
+ }
124
+
125
+ /**
126
+ * Setup Axios interception
127
+ */
128
+ setupAxiosInterception() {
129
+ try {
130
+ const axios = require('axios');
131
+ const originalPost = axios.post;
132
+
133
+ axios.post = (url, data, config) => {
134
+ const isLicenseRequest = this.interceptedEndpoints.some(endpoint => url.includes(endpoint));
135
+
136
+ if (isLicenseRequest) {
137
+ console.log(`🎯 [NPM BYPASS] Intercepted Axios: ${url}`);
138
+ return Promise.resolve({
139
+ data: this.createMockResponse(),
140
+ status: 200,
141
+ statusText: 'OK'
142
+ });
143
+ }
144
+
145
+ return originalPost.apply(this, arguments);
146
+ };
147
+ } catch (error) {
148
+ // Axios not available, skip
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Setup machine ID mocking
154
+ */
155
+ setupMachineIdMock() {
156
+ try {
157
+ const machineId = require('node-machine-id');
158
+ const originalSync = machineId.machineIdSync;
159
+
160
+ machineId.machineIdSync = () => {
161
+ console.log('🎯 [NPM BYPASS] Mocked machineIdSync');
162
+ return 'bypass_hwid_12345678901234567890';
163
+ };
164
+
165
+ if (machineId.machineId) {
166
+ machineId.machineId = () => {
167
+ console.log('🎯 [NPM BYPASS] Mocked machineId');
168
+ return Promise.resolve('bypass_hwid_12345678901234567890');
169
+ };
170
+ }
171
+ } catch (error) {
172
+ // node-machine-id not available, skip
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Setup global function overrides
178
+ */
179
+ setupGlobalFunctionOverrides() {
180
+ const overrides = {
181
+ checkKey: async () => {
182
+ console.log('🎯 [NPM BYPASS] checkKey called');
183
+ return { success: true, valid: true };
184
+ },
185
+
186
+ validateLicense: async () => {
187
+ console.log('🎯 [NPM BYPASS] validateLicense called');
188
+ return { success: true, valid: true };
189
+ },
190
+
191
+ generateHwid: () => {
192
+ console.log('🎯 [NPM BYPASS] generateHwid called');
193
+ return 'bypass_hwid_12345678901234567890';
194
+ },
195
+
196
+ postSuccess: async (data) => {
197
+ console.log('🎯 [NPM BYPASS] postSuccess called');
198
+ return this.createMockResponse();
199
+ },
200
+
201
+ loadWhiteList: async () => {
202
+ console.log('🎯 [NPM BYPASS] loadWhiteList called');
203
+ return ['bypass_user'];
204
+ }
205
+ };
206
+
207
+ Object.assign(global, overrides);
208
+ }
209
+
210
+ /**
211
+ * Create mock license response
212
+ */
213
+ createMockResponse() {
214
+ return {
215
+ success: true,
216
+ valid: true,
217
+ message: 'License validated successfully',
218
+ user: 'bypass_user',
219
+ hwid: 'bypass_hwid_12345678901234567890',
220
+ status: 'active',
221
+ expires: '2025-12-31',
222
+ features: ['advanced-caching', 'registry-optimization', 'transaction-batching'],
223
+ timestamp: Date.now()
224
+ };
225
+ }
226
+
227
+ /**
228
+ * Disable bypass (for testing)
229
+ */
230
+ disable() {
231
+ if (!this.isActive) return;
232
+
233
+ // Restore original functions
234
+ process.exit = this.originalExit;
235
+
236
+ if (this.originalHttps) {
237
+ const https = require('https');
238
+ https.request = this.originalHttps;
239
+ }
240
+
241
+ this.isActive = false;
242
+ console.log('🔧 [NPM BYPASS] Bypass disabled');
243
+ }
244
+
245
+ /**
246
+ * Get bypass status
247
+ */
248
+ getStatus() {
249
+ return {
250
+ active: this.isActive,
251
+ uptime: Date.now() - this.startTime,
252
+ interceptedEndpoints: this.interceptedEndpoints,
253
+ mockResponse: this.createMockResponse()
254
+ };
255
+ }
256
+ }
257
+
258
+ module.exports = EnhancedLicenseBypass;