Spaces:
Running
Running
make me a powerful firewall that visually shows you every app sending data like a radar, with features like a live map of connections, breakdown of what apps communicate with what servers, flags suspicious domains, AI rates each outgoing connection, honeypots, account breach alerts, scam prevention, and monetisation model, call the app silk shield
ad445a1 verified Download script.js from phil49uk/silk-shield: direct link, hf CLI and curl.
- Browser
- Download file 6.93 kB
-
https://huggingface.co/spaces/phil49uk/silk-shield/resolve/main/script.js
- Command line
-
hf download hf://spaces/phil49uk/silk-shield/script.js
-
curl -L -o script.js https://huggingface.co/spaces/phil49uk/silk-shield/resolve/main/script.js
6.93 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize radar canvas | |
| const canvas = document.getElementById('radarCanvas'); | |
| const ctx = canvas.getContext('2d'); | |
| // Set canvas to full container size | |
| function resizeCanvas() { | |
| const container = document.querySelector('.radar-container'); | |
| canvas.width = container.clientWidth; | |
| canvas.height = container.clientHeight; | |
| drawRadar(); | |
| } | |
| // Draw radar background | |
| function drawRadar() { | |
| if (!canvas) return; | |
| const centerX = canvas.width / 2; | |
| const centerY = canvas.height / 2; | |
| const radius = Math.min(canvas.width, canvas.height) / 2 - 20; | |
| // Clear canvas | |
| ctx.clearRect(0, 0, canvas.width, canvas.height); | |
| // Draw concentric circles | |
| ctx.strokeStyle = 'rgba(99, 102, 241, 0.3)'; | |
| ctx.lineWidth = 1; | |
| for (let i = 1; i <= 4; i++) { | |
| const r = radius * (i / 4); | |
| ctx.beginPath(); | |
| ctx.arc(centerX, centerY, r, 0, 2 * Math.PI); | |
| ctx.stroke(); | |
| } | |
| // Draw cross lines | |
| ctx.beginPath(); | |
| ctx.moveTo(centerX, centerY - radius); | |
| ctx.lineTo(centerX, centerY + radius); | |
| ctx.moveTo(centerX - radius, centerY); | |
| ctx.lineTo(centerX + radius, centerY); | |
| ctx.stroke(); | |
| // Draw sweep line | |
| ctx.strokeStyle = 'rgba(99, 102, 241, 0.7)'; | |
| ctx.lineWidth = 2; | |
| ctx.beginPath(); | |
| ctx.moveTo(centerX, centerY); | |
| ctx.lineTo( | |
| centerX + radius * Math.cos(sweepAngle - Math.PI/2), | |
| centerY + radius * Math.sin(sweepAngle - Math.PI/2) | |
| ); | |
| ctx.stroke(); | |
| // Draw connection dots | |
| drawConnections(centerX, centerY, radius); | |
| } | |
| // Connection data (simulated) | |
| const connections = [ | |
| { x: 0.3, y: 0.2, app: 'Chrome', destination: 'google.com', risk: 'low', data: '24.5 KB' }, | |
| { x: -0.4, y: 0.5, app: 'Slack', destination: 'slack.com', risk: 'low', data: '12.1 KB' }, | |
| { x: 0.7, y: -0.3, app: 'Spotify', destination: 'spotify.com', risk: 'low', data: '46.2 KB' }, | |
| { x: -0.2, y: -0.6, app: 'Unknown', destination: 'tracker.adnetwork.com', risk: 'high', data: '8.7 KB' }, | |
| { x: 0.5, y: 0.4, app: 'Mail', destination: 'mail.google.com', risk: 'low', data: '3.2 KB' }, | |
| { x: -0.8, y: 0.1, app: 'System', destination: 'time.windows.com', risk: 'low', data: '0.5 KB' }, | |
| { x: 0.1, y: 0.8, app: 'Dropbox', destination: 'dl.dropbox.com', risk: 'medium', data: '124.0 KB' } | |
| ]; | |
| // Draw connection dots | |
| function drawConnections(centerX, centerY, radius) { | |
| connections.forEach(conn => { | |
| const x = centerX + conn.x * radius; | |
| const y = centerY + conn.y * radius; | |
| // Color based on risk | |
| let color; | |
| if (conn.risk === 'high') color = 'rgba(239, 68, 68, 0.8)'; | |
| else if (conn.risk === 'medium') color = 'rgba(234, 179, 8, 0.8)'; | |
| else color = 'rgba(16, 185, 129, 0.8)'; | |
| // Draw dot | |
| ctx.fillStyle = color; | |
| ctx.beginPath(); | |
| ctx.arc(x, y, 6, 0, 2 * Math.PI); | |
| ctx.fill(); | |
| // Add pulse animation for suspicious connections | |
| if (conn.risk !== 'low') { | |
| const pulseRadius = 6 + 2 * Math.abs(Math.sin(Date.now() / 500)); | |
| ctx.fillStyle = color.replace('0.8', '0.3'); | |
| ctx.beginPath(); | |
| ctx.arc(x, y, pulseRadius, 0, 2 * Math.PI); | |
| ctx.fill(); | |
| } | |
| // Add hover interaction | |
| canvas.addEventListener('mousemove', (e) => { | |
| const rect = canvas.getBoundingClientRect(); | |
| const mouseX = e.clientX - rect.left; | |
| const mouseY = e.clientY - rect.top; | |
| const distance = Math.sqrt((mouseX - x) ** 2 + (mouseY - y) ** 2); | |
| if (distance < 10) { | |
| showConnectionInfo(conn); | |
| } | |
| }); | |
| }); | |
| } | |
| // Show connection info | |
| function showConnectionInfo(conn) { | |
| const infoBox = document.getElementById('connectionInfo'); | |
| const appName = document.getElementById('appName'); | |
| const appDestination = document.getElementById('appDestination'); | |
| const threatLevel = document.getElementById('threatLevel'); | |
| const dataAmount = document.getElementById('dataAmount'); | |
| appName.textContent = conn.app; | |
| appDestination.textContent = `Destination: ${conn.destination}`; | |
| threatLevel.textContent = `${conn.risk.charAt(0).toUpperCase() + conn.risk.slice(1)} Risk`; | |
| dataAmount.textContent = conn.data; | |
| // Set threat level color | |
| threatLevel.className = 'px-2 py-1 rounded text-xs font-medium'; | |
| if (conn.risk === 'high') threatLevel.classList.add('bg-red-900', 'text-red-400'); | |
| else if (conn.risk === 'medium') threatLevel.classList.add('bg-yellow-900', 'text-yellow-400'); | |
| else threatLevel.classList.add('bg-green-900', 'text-green-400'); | |
| infoBox.classList.remove('hidden'); | |
| } | |
| // Radar sweep animation | |
| let sweepAngle = 0; | |
| function animateRadar() { | |
| sweepAngle += 0.02; | |
| drawRadar(); | |
| requestAnimationFrame(animateRadar); | |
| } | |
| // Initialize | |
| window.addEventListener('resize', resizeCanvas); | |
| resizeCanvas(); | |
| animateRadar(); | |
| // Simulate random new connections | |
| setInterval(() => { | |
| if (Math.random() > 0.7) { | |
| const newConn = { | |
| x: Math.random() * 1.8 - 0.9, | |
| y: Math.random() * 1.8 - 0.9, | |
| app: ['System', 'Updater', 'Backup', 'Service', 'Unknown'][Math.floor(Math.random() * 5)], | |
| destination: `server${Math.floor(Math.random() * 1000)}.${['com', 'net', 'org', 'io'][Math.floor(Math.random() * 4)]}`, | |
| risk: ['low', 'medium', 'high'][Math.floor(Math.random() * 3)], | |
| data: `${(Math.random() * 100).toFixed(1)} KB` | |
| }; | |
| connections.push(newConn); | |
| // Remove old connections occasionally | |
| if (connections.length > 15 && Math.random() > 0.5) { | |
| connections.shift(); | |
| } | |
| } | |
| }, 2000); | |
| }); | |
| // Hover effect for pricing cards | |
| document.querySelectorAll('.pricing-card').forEach(card => { | |
| card.addEventListener('mouseenter', () => { | |
| card.querySelector('.pricing-features').classList.add('scale-105'); | |
| }); | |
| card.addEventListener('mouseleave', () => { | |
| card.querySelector('.pricing-features').classList.remove('scale-105'); | |
| }); | |
| }); |