@feardread/fear 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.
Files changed (99) hide show
  1. package/FEAR.js +459 -0
  2. package/FEARServer.js +280 -0
  3. package/controllers/agent.js +438 -0
  4. package/controllers/auth/index.js +345 -0
  5. package/controllers/auth/token.js +50 -0
  6. package/controllers/blog.js +105 -0
  7. package/controllers/brand.js +10 -0
  8. package/controllers/cart.js +425 -0
  9. package/controllers/category.js +9 -0
  10. package/controllers/coupon.js +63 -0
  11. package/controllers/crud/crud.js +508 -0
  12. package/controllers/crud/index.js +36 -0
  13. package/controllers/email.js +34 -0
  14. package/controllers/enquiry.js +65 -0
  15. package/controllers/events.js +9 -0
  16. package/controllers/order.js +125 -0
  17. package/controllers/payment.js +31 -0
  18. package/controllers/product.js +147 -0
  19. package/controllers/review.js +247 -0
  20. package/controllers/tag.js +10 -0
  21. package/controllers/task.js +10 -0
  22. package/controllers/upload.js +41 -0
  23. package/controllers/user.js +401 -0
  24. package/index.js +7 -0
  25. package/libs/agent/index.js +561 -0
  26. package/libs/agent/modules/ai/ai.js +285 -0
  27. package/libs/agent/modules/ai/chat.js +518 -0
  28. package/libs/agent/modules/ai/config.js +688 -0
  29. package/libs/agent/modules/ai/operations.js +787 -0
  30. package/libs/agent/modules/analyze/api.js +546 -0
  31. package/libs/agent/modules/analyze/dorks.js +395 -0
  32. package/libs/agent/modules/ccard/README.md +454 -0
  33. package/libs/agent/modules/ccard/audit.js +479 -0
  34. package/libs/agent/modules/ccard/checker.js +674 -0
  35. package/libs/agent/modules/ccard/payment-processors.json +16 -0
  36. package/libs/agent/modules/ccard/validator.js +629 -0
  37. package/libs/agent/modules/code/analyzer.js +303 -0
  38. package/libs/agent/modules/code/jquery.js +1093 -0
  39. package/libs/agent/modules/code/react.js +1536 -0
  40. package/libs/agent/modules/code/refactor.js +499 -0
  41. package/libs/agent/modules/crypto/exchange.js +564 -0
  42. package/libs/agent/modules/net/proxy.js +409 -0
  43. package/libs/agent/modules/security/cve.js +442 -0
  44. package/libs/agent/modules/security/monitor.js +360 -0
  45. package/libs/agent/modules/security/scanner.js +300 -0
  46. package/libs/agent/modules/security/vulnerability.js +506 -0
  47. package/libs/agent/modules/security/web.js +465 -0
  48. package/libs/agent/modules/utils/browser.js +492 -0
  49. package/libs/agent/modules/utils/colorizer.js +285 -0
  50. package/libs/agent/modules/utils/manager.js +478 -0
  51. package/libs/cloud/index.js +228 -0
  52. package/libs/config/db.js +21 -0
  53. package/libs/config/validator.js +82 -0
  54. package/libs/db/index.js +318 -0
  55. package/libs/emailer/imap.js +126 -0
  56. package/libs/emailer/info.js +41 -0
  57. package/libs/emailer/smtp.js +77 -0
  58. package/libs/handler/async.js +3 -0
  59. package/libs/handler/error.js +66 -0
  60. package/libs/handler/index.js +161 -0
  61. package/libs/logger/index.js +49 -0
  62. package/libs/logger/morgan.js +24 -0
  63. package/libs/passport/passport.js +109 -0
  64. package/libs/search/api.js +384 -0
  65. package/libs/search/features.js +219 -0
  66. package/libs/search/service.js +64 -0
  67. package/libs/swagger/config.js +18 -0
  68. package/libs/swagger/index.js +35 -0
  69. package/libs/validator/index.js +254 -0
  70. package/models/blog.js +31 -0
  71. package/models/brand.js +12 -0
  72. package/models/cart.js +14 -0
  73. package/models/category.js +11 -0
  74. package/models/coupon.js +9 -0
  75. package/models/customer.js +0 -0
  76. package/models/enquiry.js +29 -0
  77. package/models/events.js +13 -0
  78. package/models/order.js +94 -0
  79. package/models/product.js +32 -0
  80. package/models/review.js +14 -0
  81. package/models/tag.js +10 -0
  82. package/models/task.js +11 -0
  83. package/models/user.js +68 -0
  84. package/package.json +12 -0
  85. package/routes/agent.js +615 -0
  86. package/routes/auth.js +13 -0
  87. package/routes/blog.js +19 -0
  88. package/routes/brand.js +15 -0
  89. package/routes/cart.js +105 -0
  90. package/routes/category.js +16 -0
  91. package/routes/coupon.js +15 -0
  92. package/routes/enquiry.js +14 -0
  93. package/routes/events.js +16 -0
  94. package/routes/mail.js +170 -0
  95. package/routes/order.js +19 -0
  96. package/routes/product.js +22 -0
  97. package/routes/review.js +11 -0
  98. package/routes/task.js +12 -0
  99. package/routes/user.js +17 -0
@@ -0,0 +1,409 @@
1
+ const axios = require('axios');
2
+ const { HttpsProxyAgent } = require('https-proxy-agent');
3
+ const colorizer = require('../utils/colorizer');
4
+
5
+ const ProxyManager = function() {
6
+ this.currentProxy = null;
7
+ this.proxyList = [];
8
+ this.proxiflyApiKey = process.env.PROXIFLY_API_KEY || null;
9
+ this.proxy5Credentials = {
10
+ username: process.env.PROXY5_USERNAME || null,
11
+ password: process.env.PROXY5_PASSWORD || null
12
+ };
13
+ this.publicIp = null;
14
+ this.lastChecked = null;
15
+ }
16
+
17
+ ProxyManager.prototype = {
18
+ /**
19
+ * Check current public IP address
20
+ */
21
+ async checkPublicIp(useProxy = false) {
22
+ try {
23
+ console.log(colorizer.section('Checking Public IP Address'));
24
+
25
+ const config = {};
26
+
27
+ if (useProxy && this.currentProxy) {
28
+ console.log(colorizer.info(`Using proxy: ${this.currentProxy.host}:${this.currentProxy.port}`));
29
+ const proxyUrl = this.formatProxyUrl(this.currentProxy);
30
+ config.httpsAgent = new HttpsProxyAgent(proxyUrl);
31
+ config.timeout = 10000;
32
+ }
33
+
34
+ const response = await axios.get('https://api.ipify.org?format=json', config);
35
+ this.publicIp = response.data.ip;
36
+ this.lastChecked = new Date();
37
+
38
+ console.log(colorizer.success(`✓ Public IP: ${this.publicIp}`));
39
+
40
+ // Get additional IP info
41
+ await this.getIpInfo(this.publicIp, useProxy);
42
+
43
+ return this.publicIp;
44
+ } catch (error) {
45
+ console.log(colorizer.error(`✗ Failed to check IP: ${error.message}`));
46
+ throw error;
47
+ }
48
+ },
49
+
50
+ /**
51
+ * Get detailed IP information
52
+ */
53
+ async getIpInfo(ip, useProxy = false) {
54
+ try {
55
+ const config = {};
56
+
57
+ if (useProxy && this.currentProxy) {
58
+ const proxyUrl = this.formatProxyUrl(this.currentProxy);
59
+ config.httpsAgent = new HttpsProxyAgent(proxyUrl);
60
+ config.timeout = 10000;
61
+ }
62
+
63
+ const response = await axios.get(`http://ip-api.com/json/${ip}`, config);
64
+ const data = response.data;
65
+
66
+ if (data.status === 'success') {
67
+ console.log(colorizer.cyan('\nIP Information:'));
68
+ console.log(colorizer.dim(` Country: ${data.country} (${data.countryCode})`));
69
+ console.log(colorizer.dim(` Region: ${data.regionName}`));
70
+ console.log(colorizer.dim(` City: ${data.city}`));
71
+ console.log(colorizer.dim(` ISP: ${data.isp}`));
72
+ console.log(colorizer.dim(` Timezone: ${data.timezone}`));
73
+ console.log(colorizer.dim(` Coordinates: ${data.lat}, ${data.lon}`));
74
+ }
75
+ console.log();
76
+ } catch (error) {
77
+ console.log(colorizer.warning(`Could not fetch IP details: ${error.message}`));
78
+ }
79
+ },
80
+
81
+ /**
82
+ * Configure Proxifly API
83
+ */
84
+ async configureProxifly(args) {
85
+ if (!args || args.length === 0) {
86
+ console.log(colorizer.section('Proxifly Configuration'));
87
+ console.log(colorizer.cyan('Usage: configure-proxifly <api_key>'));
88
+ console.log(colorizer.dim('\nExample:'));
89
+ console.log(colorizer.dim(' configure-proxifly your_api_key_here'));
90
+ console.log();
91
+ console.log(colorizer.info('Or set environment variable:'));
92
+ console.log(colorizer.dim(' export PROXIFLY_API_KEY=your_api_key_here'));
93
+ console.log();
94
+
95
+ if (this.proxiflyApiKey) {
96
+ console.log(colorizer.success('✓ Proxifly is currently configured'));
97
+ } else {
98
+ console.log(colorizer.warning('⚠ Proxifly is not configured'));
99
+ }
100
+ return;
101
+ }
102
+
103
+ this.proxiflyApiKey = args[0];
104
+ console.log(colorizer.success('✓ Proxifly API key configured'));
105
+ console.log(colorizer.info('Run "fetch-proxies" to get proxy list'));
106
+ console.log();
107
+ },
108
+
109
+ /**
110
+ * Configure Proxy5 credentials
111
+ */
112
+ async configureProxy5(args) {
113
+ if (!args || args.length < 2) {
114
+ console.log(colorizer.section('Proxy5 Configuration'));
115
+ console.log(colorizer.cyan('Usage: configure-proxy5 <username> <password>'));
116
+ console.log(colorizer.dim('\nExample:'));
117
+ console.log(colorizer.dim(' configure-proxy5 myuser mypass'));
118
+ console.log();
119
+ console.log(colorizer.info('Or set environment variables:'));
120
+ console.log(colorizer.dim(' export PROXY5_USERNAME=myuser'));
121
+ console.log(colorizer.dim(' export PROXY5_PASSWORD=mypass'));
122
+ console.log();
123
+
124
+ if (this.proxy5Credentials.username && this.proxy5Credentials.password) {
125
+ console.log(colorizer.success('✓ Proxy5 credentials are configured'));
126
+ } else {
127
+ console.log(colorizer.warning('⚠ Proxy5 credentials are not configured'));
128
+ }
129
+ return;
130
+ }
131
+
132
+ this.proxy5Credentials.username = args[0];
133
+ this.proxy5Credentials.password = args[1];
134
+ console.log(colorizer.success('✓ Proxy5 credentials configured'));
135
+ console.log();
136
+ },
137
+
138
+ /**
139
+ * Fetch proxies from Proxifly
140
+ */
141
+ async fetchProxies(args) {
142
+ if (!this.proxiflyApiKey) {
143
+ console.log(colorizer.error('Proxifly API key not configured'));
144
+ console.log(colorizer.info('Run "configure-proxifly <api_key>" first'));
145
+ return;
146
+ }
147
+
148
+ try {
149
+ console.log(colorizer.section('Fetching Proxies from Proxifly'));
150
+
151
+ // Parse options
152
+ const options = {
153
+ protocol: 'http',
154
+ country: null,
155
+ limit: 10
156
+ };
157
+
158
+ args.forEach((arg, i) => {
159
+ if (arg === '--protocol' && args[i + 1]) options.protocol = args[i + 1];
160
+ if (arg === '--country' && args[i + 1]) options.country = args[i + 1];
161
+ if (arg === '--limit' && args[i + 1]) options.limit = parseInt(args[i + 1]);
162
+ });
163
+
164
+ // Proxifly API endpoint (adjust based on actual API)
165
+ const url = `https://api.proxifly.dev/get-proxies`;
166
+ const params = {
167
+ api_key: this.proxiflyApiKey,
168
+ protocol: options.protocol,
169
+ limit: options.limit
170
+ };
171
+
172
+ if (options.country) {
173
+ params.country = options.country;
174
+ }
175
+
176
+ console.log(colorizer.info(`Fetching ${options.limit} ${options.protocol} proxies...`));
177
+
178
+ const response = await axios.get(url, { params, timeout: 15000 });
179
+
180
+ if (response.data && response.data.proxies) {
181
+ this.proxyList = response.data.proxies.map(proxy => ({
182
+ host: proxy.ip || proxy.host,
183
+ port: proxy.port,
184
+ protocol: proxy.protocol || options.protocol,
185
+ country: proxy.country,
186
+ speed: proxy.speed,
187
+ anonymity: proxy.anonymity
188
+ }));
189
+
190
+ console.log(colorizer.success(`✓ Fetched ${this.proxyList.length} proxies`));
191
+ this.displayProxyList();
192
+ } else {
193
+ console.log(colorizer.warning('No proxies returned from API'));
194
+ }
195
+
196
+ } catch (error) {
197
+ console.log(colorizer.error(`Failed to fetch proxies: ${error.message}`));
198
+ if (error.response) {
199
+ console.log(colorizer.dim(`Status: ${error.response.status}`));
200
+ console.log(colorizer.dim(`Response: ${JSON.stringify(error.response.data)}`));
201
+ }
202
+ }
203
+ console.log();
204
+ },
205
+
206
+ /**
207
+ * Add Proxy5 proxies manually
208
+ */
209
+ async addProxy5Proxies(args) {
210
+ if (!this.proxy5Credentials.username || !this.proxy5Credentials.password) {
211
+ console.log(colorizer.error('Proxy5 credentials not configured'));
212
+ console.log(colorizer.info('Run "configure-proxy5 <username> <password>" first'));
213
+ return;
214
+ }
215
+
216
+ console.log(colorizer.section('Adding Proxy5 Proxies'));
217
+
218
+ // Common Proxy5 server locations
219
+ const proxy5Servers = [
220
+ { host: 'proxy5.net', port: 8080, country: 'US', location: 'United States' },
221
+ { host: 'proxy5.net', port: 8081, country: 'US', location: 'United States' },
222
+ { host: 'proxy5.net', port: 8082, country: 'UK', location: 'United Kingdom' },
223
+ { host: 'proxy5.net', port: 8083, country: 'DE', location: 'Germany' },
224
+ { host: 'proxy5.net', port: 8084, country: 'FR', location: 'France' },
225
+ ];
226
+
227
+ proxy5Servers.forEach(server => {
228
+ this.proxyList.push({
229
+ ...server,
230
+ protocol: 'http',
231
+ username: this.proxy5Credentials.username,
232
+ password: this.proxy5Credentials.password,
233
+ source: 'proxy5'
234
+ });
235
+ });
236
+
237
+ console.log(colorizer.success(`✓ Added ${proxy5Servers.length} Proxy5 proxies`));
238
+ this.displayProxyList();
239
+ console.log();
240
+ },
241
+
242
+ /**
243
+ * Display current proxy list
244
+ */
245
+ displayProxyList() {
246
+ if (this.proxyList.length === 0) {
247
+ console.log(colorizer.warning('No proxies in list'));
248
+ return;
249
+ }
250
+
251
+ console.log(colorizer.cyan('\nAvailable Proxies:'));
252
+ this.proxyList.forEach((proxy, index) => {
253
+ const active = this.currentProxy &&
254
+ this.currentProxy.host === proxy.host &&
255
+ this.currentProxy.port === proxy.port;
256
+
257
+ const marker = active ? colorizer.green('→') : ' ';
258
+ const country = proxy.country ? `[${proxy.country}]` : '';
259
+ const auth = proxy.username ? '[AUTH]' : '';
260
+ const source = proxy.source ? `[${proxy.source.toUpperCase()}]` : '';
261
+
262
+ console.log(colorizer.dim(
263
+ ` ${marker} ${index + 1}. ${proxy.host}:${proxy.port} ${country} ${auth} ${source}`
264
+ ));
265
+ });
266
+ console.log();
267
+ },
268
+
269
+ /**
270
+ * Select and activate a proxy
271
+ */
272
+ async selectProxy(args) {
273
+ if (!args || args.length === 0) {
274
+ console.log(colorizer.section('Select Proxy'));
275
+ console.log(colorizer.cyan('Usage: select-proxy <index>'));
276
+ console.log();
277
+ this.displayProxyList();
278
+ return;
279
+ }
280
+
281
+ const index = parseInt(args[0]) - 1;
282
+
283
+ if (index < 0 || index >= this.proxyList.length) {
284
+ console.log(colorizer.error('Invalid proxy index'));
285
+ this.displayProxyList();
286
+ return;
287
+ }
288
+
289
+ this.currentProxy = this.proxyList[index];
290
+ console.log(colorizer.success(`✓ Selected proxy: ${this.currentProxy.host}:${this.currentProxy.port}`));
291
+
292
+ // Test the proxy
293
+ await this.testProxy();
294
+ },
295
+
296
+ /**
297
+ * Test current proxy
298
+ */
299
+ async testProxy(args) {
300
+ if (!this.currentProxy) {
301
+ console.log(colorizer.error('No proxy selected'));
302
+ console.log(colorizer.info('Run "select-proxy <index>" first'));
303
+ return;
304
+ }
305
+
306
+ console.log(colorizer.section('Testing Proxy'));
307
+ console.log(colorizer.info(`Testing: ${this.currentProxy.host}:${this.currentProxy.port}`));
308
+
309
+ try {
310
+ await this.checkPublicIp(true);
311
+ console.log(colorizer.success('✓ Proxy is working!'));
312
+ } catch (error) {
313
+ console.log(colorizer.error(`✗ Proxy test failed: ${error.message}`));
314
+ }
315
+ console.log();
316
+ },
317
+
318
+ /**
319
+ * Clear current proxy (use direct connection)
320
+ */
321
+ clearProxy() {
322
+ if (this.currentProxy) {
323
+ console.log(colorizer.info(`Cleared proxy: ${this.currentProxy.host}:${this.currentProxy.port}`));
324
+ this.currentProxy = null;
325
+ console.log(colorizer.success('✓ Now using direct connection'));
326
+ } else {
327
+ console.log(colorizer.info('No proxy was active'));
328
+ }
329
+ console.log();
330
+ },
331
+
332
+ /**
333
+ * Show proxy status
334
+ */
335
+ showStatus() {
336
+ console.log(colorizer.section('Proxy Manager Status'));
337
+
338
+ console.log(colorizer.cyan('Configuration:'));
339
+ console.log(colorizer.dim(` Proxifly API: ${this.proxiflyApiKey ? '✓ Configured' : '✗ Not configured'}`));
340
+ console.log(colorizer.dim(` Proxy5 Auth: ${this.proxy5Credentials.username ? '✓ Configured' : '✗ Not configured'}`));
341
+ console.log();
342
+
343
+ console.log(colorizer.cyan('Current Status:'));
344
+ console.log(colorizer.dim(` Active Proxy: ${this.currentProxy ? `${this.currentProxy.host}:${this.currentProxy.port}` : 'Direct connection'}`));
345
+ console.log(colorizer.dim(` Proxy List: ${this.proxyList.length} proxies available`));
346
+ console.log(colorizer.dim(` Last IP Check: ${this.lastChecked ? this.lastChecked.toLocaleString() : 'Never'}`));
347
+ if (this.publicIp) {
348
+ console.log(colorizer.dim(` Public IP: ${this.publicIp}`));
349
+ }
350
+ console.log();
351
+ },
352
+
353
+ /**
354
+ * Format proxy URL for axios agent
355
+ */
356
+ formatProxyUrl(proxy) {
357
+ if (proxy.username && proxy.password) {
358
+ return `${proxy.protocol}://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port}`;
359
+ }
360
+ return `${proxy.protocol}://${proxy.host}:${proxy.port}`;
361
+ },
362
+
363
+ /**
364
+ * Show help
365
+ */
366
+ showHelp() {
367
+ console.log(colorizer.box('Proxy Manager - Command Reference'));
368
+
369
+ const commands = [
370
+ { cmd: 'check-ip', desc: 'Check current public IP address' },
371
+ { cmd: 'check-ip --proxy', desc: 'Check IP through active proxy' },
372
+ { cmd: 'configure-proxifly <key>', desc: 'Configure Proxifly API key' },
373
+ { cmd: 'configure-proxy5 <user> <pass>', desc: 'Configure Proxy5 credentials' },
374
+ { cmd: 'fetch-proxies', desc: 'Fetch proxies from Proxifly' },
375
+ { cmd: 'fetch-proxies --limit 20', desc: 'Fetch specific number of proxies' },
376
+ { cmd: 'fetch-proxies --country US', desc: 'Fetch proxies from specific country' },
377
+ { cmd: 'add-proxy5', desc: 'Add Proxy5 proxies to list' },
378
+ { cmd: 'list-proxies', desc: 'Display available proxies' },
379
+ { cmd: 'select-proxy <index>', desc: 'Select and activate a proxy' },
380
+ { cmd: 'test-proxy', desc: 'Test current proxy connection' },
381
+ { cmd: 'clear-proxy', desc: 'Clear proxy (use direct connection)' },
382
+ { cmd: 'proxy-status', desc: 'Show proxy manager status' },
383
+ { cmd: 'proxy-help', desc: 'Show this help message' }
384
+ ];
385
+
386
+ commands.forEach(({ cmd, desc }) => {
387
+ console.log(colorizer.bullet(cmd.padEnd(35) + ' - ' + colorizer.dim(desc)));
388
+ });
389
+
390
+ console.log();
391
+ console.log(colorizer.info('Environment Variables:'));
392
+ console.log(colorizer.dim(' PROXIFLY_API_KEY - Auto-configure Proxifly'));
393
+ console.log(colorizer.dim(' PROXY5_USERNAME - Auto-configure Proxy5 username'));
394
+ console.log(colorizer.dim(' PROXY5_PASSWORD - Auto-configure Proxy5 password'));
395
+ console.log();
396
+
397
+ console.log(colorizer.info('Example Workflow:'));
398
+ console.log(colorizer.dim(' 1. check-ip # Check current IP'));
399
+ console.log(colorizer.dim(' 2. configure-proxifly your_api_key # Setup Proxifly'));
400
+ console.log(colorizer.dim(' 3. fetch-proxies --limit 10 # Get proxy list'));
401
+ console.log(colorizer.dim(' 4. select-proxy 1 # Activate proxy'));
402
+ console.log(colorizer.dim(' 5. check-ip --proxy # Verify proxy works'));
403
+ console.log(colorizer.dim(' 6. clear-proxy # Return to direct'));
404
+ console.log();
405
+ }
406
+ }
407
+
408
+
409
+ module.exports = ProxyManager;