@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,454 @@
1
+ # Card Status Checker Module
2
+
3
+ ## Overview
4
+ The Card Status Checker module verifies if credit cards are active/issued by performing authorization checks with payment processors. It integrates seamlessly with the Security AI Agent framework.
5
+
6
+ ---
7
+
8
+ ## 📦 Installation
9
+
10
+ ### 1. Install Required Dependencies
11
+
12
+ ```bash
13
+ # For Stripe support
14
+ npm install stripe
15
+
16
+ # For PayPal support
17
+ npm install @paypal/checkout-server-sdk
18
+
19
+ # For Authorize.Net support
20
+ npm install authorizenet
21
+ ```
22
+
23
+ ### 2. Place Module File
24
+ Save `card-status.js` to:
25
+ ```
26
+ ./modules/security/card-status.js
27
+ ```
28
+
29
+ ### 3. Update Agent Configuration
30
+ The module is already integrated in the updated `agent.js` file with these commands:
31
+ - `check-card-status`
32
+ - `check-card-batch`
33
+ - `configure-card-checker`
34
+ - `card-checker-help`
35
+
36
+ ---
37
+
38
+ ## 🔧 Configuration
39
+
40
+ ### Method 1: Environment Variables (Recommended)
41
+
42
+ ```bash
43
+ # Stripe
44
+ export STRIPE_SECRET_KEY="sk_test_your_key_here"
45
+ export STRIPE_TEST_MODE="true"
46
+
47
+ # PayPal
48
+ export PAYPAL_CLIENT_ID="your_client_id"
49
+ export PAYPAL_CLIENT_SECRET="your_client_secret"
50
+ export PAYPAL_TEST_MODE="true"
51
+
52
+ # Authorize.Net
53
+ export AUTHORIZENET_API_LOGIN="your_api_login"
54
+ export AUTHORIZENET_TRANSACTION_KEY="your_transaction_key"
55
+ export AUTHORIZENET_TEST_MODE="true"
56
+ ```
57
+
58
+ ### Method 2: Configuration File
59
+
60
+ Create `config/payment-processors.json`:
61
+
62
+ ```json
63
+ {
64
+ "stripe": {
65
+ "secretKey": "sk_test_your_key_here",
66
+ "testMode": true
67
+ },
68
+ "paypal": {
69
+ "clientId": "your_client_id",
70
+ "clientSecret": "your_client_secret",
71
+ "testMode": true
72
+ },
73
+ "authorizenet": {
74
+ "apiLogin": "your_api_login",
75
+ "transactionKey": "your_transaction_key",
76
+ "testMode": true
77
+ }
78
+ }
79
+ ```
80
+
81
+ ### Method 3: Interactive Configuration
82
+
83
+ ```bash
84
+ # Configure Stripe
85
+ configure-card-checker stripe sk_test_your_key_here
86
+
87
+ # Configure Authorize.Net
88
+ configure-card-checker authorizenet your_api_login your_transaction_key
89
+
90
+ # Set mode (test or live)
91
+ configure-card-checker mode test
92
+
93
+ # View current configuration
94
+ configure-card-checker
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🚀 Usage Examples
100
+
101
+ ### Check Single Card Status
102
+
103
+ ```bash
104
+ # Using Stripe (default)
105
+ check-card-status 4242424242424242
106
+
107
+ # Using specific provider
108
+ check-card-status 4242424242424242 stripe
109
+ check-card-status 4242424242424242 authorizenet
110
+ ```
111
+
112
+ **Output:**
113
+ ```
114
+ ══════════════════════════════════════════════════════
115
+ Card Status Check
116
+ ══════════════════════════════════════════════════════
117
+ Card: 4242****4242
118
+ Provider: STRIPE
119
+ Mode: TEST
120
+
121
+ ══════════════════════════════════════════════════════
122
+ Result
123
+ ══════════════════════════════════════════════════════
124
+ Status: ACTIVE
125
+ Message: Card is active and valid
126
+ Card Brand: visa
127
+ Last 4: 4242
128
+ Funding: credit
129
+ Country: US
130
+ ```
131
+
132
+ ### Batch Check Multiple Cards
133
+
134
+ Create a file `cards.txt`:
135
+ ```
136
+ 4242424242424242
137
+ 4000000000000002
138
+ 5555555555554444
139
+ 378282246310005
140
+ ```
141
+
142
+ Run batch check:
143
+ ```bash
144
+ check-card-batch cards.txt stripe
145
+ ```
146
+
147
+ **Output:**
148
+ ```
149
+ ══════════════════════════════════════════════════════
150
+ Batch Card Status Check
151
+ ══════════════════════════════════════════════════════
152
+ Cards to check: 4
153
+ Provider: STRIPE
154
+
155
+ [1/4] Checking 4242****4242...
156
+ [2/4] Checking 4000****0002...
157
+ [3/4] Checking 5555****4444...
158
+ [4/4] Checking 3782****0005...
159
+
160
+ ══════════════════════════════════════════════════════
161
+ Batch Results Summary
162
+ ══════════════════════════════════════════════════════
163
+ Total Cards: 4
164
+ Active: 2
165
+ Declined: 1
166
+ Expired: 0
167
+ Invalid: 0
168
+ Errors: 1
169
+
170
+ ══════════════════════════════════════════════════════
171
+ Individual Results
172
+ ══════════════════════════════════════════════════════
173
+ 1. ✓ 4242****4242 - active - Card is active and valid
174
+ 2. ✗ 4000****0002 - declined - Card was declined by issuer
175
+ 3. ✓ 5555****4444 - active - Card is active and valid
176
+ 4. ✗ 3782****0005 - error - Processing error occurred
177
+
178
+ Results exported to: card-status-2025-10-26T15-30-45.json
179
+ ```
180
+
181
+ ### View Help
182
+
183
+ ```bash
184
+ card-checker-help
185
+ ```
186
+
187
+ ---
188
+
189
+ ## 🧪 Test Cards
190
+
191
+ ### Stripe Test Cards
192
+
193
+ | Card Number | Brand | Status | Use Case |
194
+ |------------|-------|--------|----------|
195
+ | 4242424242424242 | Visa | Success | Valid, active card |
196
+ | 4000000000000002 | Visa | Declined | Generic decline |
197
+ | 4000000000009995 | Visa | Declined | Insufficient funds |
198
+ | 4000000000009987 | Visa | Declined | Lost card |
199
+ | 4000000000009979 | Visa | Declined | Stolen card |
200
+ | 4000000000000069 | Visa | Declined | Expired card |
201
+ | 4000000000000127 | Visa | Active | Incorrect CVC |
202
+ | 5555555555554444 | Mastercard | Success | Valid card |
203
+ | 378282246310005 | Amex | Success | Valid card |
204
+ | 6011111111111117 | Discover | Success | Valid card |
205
+
206
+ ### Authorize.Net Test Cards
207
+
208
+ | Card Number | Brand | Status |
209
+ |------------|-------|--------|
210
+ | 4007000000027 | Visa | Success |
211
+ | 4012888818888 | Visa | Success |
212
+ | 5424000000000015 | Mastercard | Success |
213
+ | 370000000000002 | Amex | Success |
214
+
215
+ ---
216
+
217
+ ## 🔒 Security Best Practices
218
+
219
+ ### ⚠️ CRITICAL SECURITY REQUIREMENTS
220
+
221
+ 1. **PCI DSS Compliance**
222
+ - This module handles sensitive payment data
223
+ - Production use requires PCI DSS Level 1 compliance
224
+ - Use tokenization whenever possible
225
+
226
+ 2. **Always Use Test Mode for Development**
227
+ ```bash
228
+ configure-card-checker mode test
229
+ ```
230
+
231
+ 3. **Never Log or Store Full Card Numbers**
232
+ - Module automatically masks card numbers in logs
233
+ - Export files contain masked data only
234
+
235
+ 4. **Implement Rate Limiting**
236
+ - Module includes 1-second delay between batch checks
237
+ - Payment processors have strict rate limits
238
+ - Monitor API usage to avoid blocks
239
+
240
+ 5. **Use Environment Variables**
241
+ - Never commit API keys to version control
242
+ - Use `.env` files with `.gitignore`
243
+ - Rotate keys regularly
244
+
245
+ 6. **Secure API Keys**
246
+ ```bash
247
+ # Set restrictive permissions
248
+ chmod 600 config/payment-processors.json
249
+
250
+ # Use key management services in production
251
+ # AWS Secrets Manager, HashiCorp Vault, etc.
252
+ ```
253
+
254
+ 7. **Fraud Detection**
255
+ - Monitor for unusual patterns
256
+ - Implement CAPTCHA for web interfaces
257
+ - Log all verification attempts
258
+ - Set up alerts for suspicious activity
259
+
260
+ ---
261
+
262
+ ## 📊 Response Status Codes
263
+
264
+ | Status | Description | Action |
265
+ |--------|-------------|--------|
266
+ | `active` | Card is valid and active | ✅ Proceed with transaction |
267
+ | `declined` | Card declined by issuer | ❌ Request different payment method |
268
+ | `expired` | Card has expired | ⚠️ Request updated card |
269
+ | `invalid` | Invalid card format/number | ❌ Check card number |
270
+ | `error` | Processing error occurred | 🔄 Retry or check configuration |
271
+ | `unknown` | Cannot determine status | ⚠️ Manual review required |
272
+ | `info` | Informational response | ℹ️ Read message |
273
+
274
+ ---
275
+
276
+ ## 🔌 API Integration Details
277
+
278
+ ### Stripe Integration
279
+ - Uses **Payment Methods API** for card verification
280
+ - Creates **Setup Intent** for zero-dollar authorization
281
+ - Provides detailed card metadata (brand, country, funding type)
282
+ - Best for: Direct card verification without merchant account
283
+
284
+ ### Authorize.Net Integration
285
+ - Uses **AUTH_ONLY** transaction type with $0.00 amount
286
+ - Returns transaction ID for tracking
287
+ - Requires active merchant account
288
+ - Best for: Traditional merchant card verification
289
+
290
+ ### PayPal Integration
291
+ - Limited standalone verification support
292
+ - Requires transaction context (order/payment)
293
+ - Best for: PayPal-specific workflows
294
+
295
+ ---
296
+
297
+ ## 🐛 Troubleshooting
298
+
299
+ ### "Provider not configured" Error
300
+ ```bash
301
+ # Check configuration
302
+ configure-card-checker
303
+
304
+ # Set up provider
305
+ configure-card-checker stripe sk_test_your_key
306
+ ```
307
+
308
+ ### "Module not available" Error
309
+ ```bash
310
+ # Install missing dependencies
311
+ npm install stripe authorizenet @paypal/checkout-server-sdk
312
+ ```
313
+
314
+ ### Rate Limit Errors
315
+ ```bash
316
+ # Reduce batch size
317
+ # Increase delay between requests
318
+ # Contact provider to increase limits
319
+ ```
320
+
321
+ ### SSL/TLS Errors
322
+ ```bash
323
+ # Update Node.js to latest LTS version
324
+ # Check system certificates
325
+ # Verify network connectivity
326
+ ```
327
+
328
+ ### Invalid Card Format
329
+ ```bash
330
+ # Remove spaces and dashes
331
+ # Ensure 13-19 digits
332
+ # Verify Luhn checksum
333
+ ```
334
+
335
+ ---
336
+
337
+ ## 📈 Advanced Features
338
+
339
+ ### Custom Timeout Configuration
340
+ ```javascript
341
+ // In card-status.js constructor
342
+ this.config = {
343
+ testMode: true,
344
+ timeout: 15000, // 15 seconds
345
+ retryAttempts: 3
346
+ };
347
+ ```
348
+
349
+ ### Webhook Integration
350
+ ```javascript
351
+ // Listen for payment processor webhooks
352
+ // Update card status in real-time
353
+ // Implement in your web application
354
+ ```
355
+
356
+ ### Database Integration
357
+ ```javascript
358
+ // Store verification results
359
+ // Track card history
360
+ // Implement fraud scoring
361
+ ```
362
+
363
+ ---
364
+
365
+ ## 🔗 Useful Resources
366
+
367
+ ### Documentation
368
+ - [Stripe API Docs](https://stripe.com/docs/api)
369
+ - [Authorize.Net Docs](https://developer.authorize.net/)
370
+ - [PayPal Docs](https://developer.paypal.com/docs/)
371
+
372
+ ### Compliance
373
+ - [PCI DSS Requirements](https://www.pcisecuritystandards.org/)
374
+ - [PCI SAQ (Self-Assessment)](https://www.pcisecuritystandards.org/document_library/)
375
+
376
+ ### Testing
377
+ - [Stripe Test Cards](https://stripe.com/docs/testing)
378
+ - [Authorize.Net Test Guide](https://developer.authorize.net/hello_world/testing_guide/)
379
+
380
+ ---
381
+
382
+ ## 💡 Example Workflows
383
+
384
+ ### E-Commerce Card Validation
385
+ ```bash
386
+ # 1. Check format first (fast, free)
387
+ validate-card 4242424242424242
388
+
389
+ # 2. Verify with payment processor
390
+ check-card-status 4242424242424242 stripe
391
+
392
+ # 3. If active, proceed with transaction
393
+ ```
394
+
395
+ ### Bulk Card Database Cleanup
396
+ ```bash
397
+ # 1. Export cards from database to file
398
+ # 2. Run batch verification
399
+ check-card-batch expired_cards.txt stripe
400
+
401
+ # 3. Review results
402
+ # 4. Update database based on status
403
+ ```
404
+
405
+ ### Fraud Detection Pipeline
406
+ ```bash
407
+ # 1. Check suspicious cards
408
+ check-card-status 4000000000000002 stripe
409
+
410
+ # 2. Analyze BIN for fraud patterns
411
+ analyze-bin 400000
412
+
413
+ # 3. Generate security report
414
+ card-security-report suspicious_cards.txt
415
+ ```
416
+
417
+ ---
418
+
419
+ ## 📝 License & Legal
420
+
421
+ **IMPORTANT DISCLAIMERS:**
422
+
423
+ 1. This module is for **authorized testing only**
424
+ 2. Requires proper **agreements with payment processors**
425
+ 3. Must comply with **PCI DSS** in production
426
+ 4. Not for **carding or fraudulent activity**
427
+ 5. User assumes **all legal responsibility**
428
+
429
+ **Recommended Use Cases:**
430
+ - ✅ Validating customer payment methods
431
+ - ✅ Testing payment integration
432
+ - ✅ Fraud prevention systems
433
+ - ✅ Card-on-file verification
434
+ - ✅ Subscription management
435
+ - ❌ Unauthorized card testing
436
+ - ❌ Card number harvesting
437
+ - ❌ Fraud or illegal activity
438
+
439
+ ---
440
+
441
+ ## 🤝 Support
442
+
443
+ For issues or questions:
444
+ 1. Check this documentation
445
+ 2. Run `card-checker-help` for command help
446
+ 3. Enable debug mode: `DEBUG=1 node agent.js`
447
+ 4. Review payment processor documentation
448
+ 5. Contact your payment processor support
449
+
450
+ ---
451
+
452
+ **Version:** 1.0.0
453
+ **Last Updated:** October 26, 2025
454
+ **Author:** Security AI Agent Team