<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DEPENDENCY RISK RANKER // CROWDSOURCED</title>
<!-- Tailwind CSS (CDN) -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- GSAP (CDN) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<!-- Google Fonts (Raw & Aggressive) -->
<link href="https://fonts.googleapis.com/css2?family=Bungee&family=Courier+Prime:wght@400;700&family=VT323&display=swap" rel="stylesheet">
<!-- Custom Config & Styles -->
<script>
tailwind.config = {
theme: {
extend: {
colors: {
'acid-green': '#CCFF00',
'acid-pink': '#FF00FF',
'acid-cyan': '#00FFFF',
'acid-yellow': '#FFFF00',
'alert-red': '#FF3333',
'deep-black': '#0a0a0a',
'off-white': '#f0f0f0'
},
fontFamily: {
'display': ['"Bungee"', 'cursive'],
'mono': ['"Courier Prime"', 'monospace'],
'terminal': ['"VT323"', 'monospace'],
},
boxShadow: {
'hard': '4px 4px 0px 0px #000',
'hard-sm': '2px 2px 0px 0px #000',
'glow': '0 0 10px #CCFF00',
},
spacing: {
'128': '32rem',
}
}
}
}
</script>
<style>
/* Global Styles */
body {
background-color: #ffffff;
color: #000000;
overflow-x: hidden;
cursor: crosshair; /* Harsh cursor */
}
/* Scanline Overlay */
.scanlines {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: linear-gradient(
to bottom,
rgba(255,255,255,0),
rgba(255,255,255,0) 50%,
rgba(0,0,0,0.1) 50%,
rgba(0,0,0,0.1)
);
background-size: 100% 4px;
pointer-events: none;
z-index: 50;
}
/* Glitch Text Effect */
.glitch-text {
position: relative;
}
.glitch-text::before, .glitch-text::after {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #ffffff;
}
.glitch-text::before {
left: 2px;
text-shadow: -1px 0 #FF00FF;
clip-path: inset(0 0 0 0);
animation: glitch-anim-1 2s infinite linear alternate-reverse;
}
.glitch-text::after {
left: -2px;
text-shadow: -1px 0 #00FFFF;
clip-path: inset(0 0 0 0);
animation: glitch-anim-2 2s infinite linear alternate-reverse;
}
@keyframes glitch-anim-1 {
0% { clip-path: inset(20% 0 30% 0); }
20% { clip-path: inset(60% 0 10% 0); }
40% { clip-path: inset(10% 0 80% 0); }
60% { clip-path: inset(80% 0 5% 0); }
80% { clip-path: inset(30% 0 40% 0); }
100% { clip-path: inset(50% 0 20% 0); }
}
@keyframes glitch-anim-2 {
0% { clip-path: inset(10% 0 60% 0); }
20% { clip-path: inset(30% 0 20% 0); }
40% { clip-path: inset(70% 0 10% 0); }
60% { clip-path: inset(20% 0 50% 0); }
80% { clip-path: inset(60% 0 30% 0); }
100% { clip-path: inset(10% 0 70% 0); }
}
/* Marquee */
.marquee-container {
overflow: hidden;
white-space: nowrap;
border-bottom: 4px solid #000;
background: #000;
color: #CCFF00;
font-family: 'VT323', monospace;
font-size: 1.5rem;
text-transform: uppercase;
}
.marquee-content {
display: inline-block;
animation: scroll 20s linear infinite;
}
@keyframes scroll {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
/* Custom Hard Buttons */
.btn-hard {
transition: all 0.1s;
transform: translate(1px, 1px);
}
.btn-hard:active {
transform: translate(2px, 2px);
box-shadow: none !important;
}
.btn-hard:hover {
background-color: #CCFF00;
}
/* Card Hover */
.card-hover:hover {
transform: translate(-2px, -2px);
box-shadow: 6px 6px 0px 0px #000;
border-color: #FF00FF;
}
.card-hover:active {
transform: translate(1px, 1px);
box-shadow: 2px 2px 0px 0px #000;
}
/* Utility for raw look */
.no-select {
user-select: none;
}
/* Progress Bar Blocky */
.risk-bar-fill {
height: 12px;
transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
</style>
</head>
<body class="selection:bg-acid-green selection:text-black">
<!-- CRT Scanline Overlay -->
<div class="scanlines"></div>
<!-- Container -->
<div class="max-w-[1600px] mx-auto px-4 py-6 relative">
<!-- HEADER SECTION -->
<header class="mb-8 relative border-b-4 border-black pb-4">
<!-- Decorative Elements -->
<div class="absolute -top-4 -right-4 w-24 h-24 bg-acid-pink border-4 border-black rotate-12"></div>
<div class="absolute -bottom-4 -left-4 w-32 h-32 bg-acid-cyan border-4 border-black -rotate-12 mix-blend-multiply"></div>
<h1 class="text-5xl md:text-8xl font-display uppercase leading-none text-black mb-2 relative z-10 mix-blend-difference">
Risk<br>Ranker
</h1>
<div class="flex items-center gap-4 flex flex-wrap">
<span class="bg-acid-yellow border-2 border-black px-2 py-1 font-bold text-sm transform -skew-x-12">BETA</span>
<span class="font-mono text-sm">CROWD-SOURCED CVE TRACKING // ACTIVE DATAFEED</span>
</div>
</header>
<!-- MARQUEE -->
<div class="marquee-container font-terminal no-select mb-8">
<div class="marquee-content">
*** WARNING *** CRITICAL VULNERABILITIES DETECTED IN PACKAGES: LODASH, DEBUG, SOCKET.IO, EXPRESS, MOMENT, REQUEST, Y18N, MINIMIST, SANITIZE.HTML, MKDRP *** COMMUNITY VOTE IS IN: ELEVATED RISK *** TELEMETRY SHOWS 12M+ INSTALLS AT RISK *** UPDATE YOUR DEPENDENCIES NOW ***
*** WARNING *** CRITICAL VULNERABILITIES DETECTED IN PACKAGES: LODASH, DEBUG, SOCKET.IO, EXPRESS, MOMENT, REQUEST, Y18N, MINIMIST, SANITIZE.HTML, MKDRP *** COMMUNITY VOTE IS IN: ELEVATED RISK *** TELEMETRY SHOWS 12M+ INSTALLS AT RISK *** UPDATE YOUR DEPENDENCIES NOW ***
</div>
</div>
<!-- CONTROLS BAR -->
<div class="bg-white border-t-4 border-l-4 border-b-2 border-r-2 border-black mb-6 p-4 flex flex-col md:flex-row justify-between items-center gap-4 bg-off-white shadow-hard">
<div class="flex items-center gap-2 w-full md:w-auto">
<div class="p-2 border-2 border-black bg-white">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="square" stroke-linejoin="miter" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
</div>
<input type="text" id="searchInput" placeholder="SCAN FOR PACKAGE..." class="w-full border-2 border-black p-2 font-mono text-lg uppercase focus:bg-acid-green outline-none">
</div>
<div class="flex gap-2 font-mono text-sm">
<button class="btn-hard border-2 border-black bg-acid-green px-4 py-2 font-bold black" onclick="app.setSort('risk')">SORT: RISK</button>
<button class="btn-hard border-2 border-black bg-white px-4 py-2 font-bold" onclick="app.setSort('votes')">SORT: VOTES</button>
<button class="btn-hard border-2 border-black bg-white px-4 py-2 font-bold" onclick="app.toggleFilters()">FILTERS</button>
</div>
</div>
<!-- HERO STATS -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
<div class="bg-black text-white border-4 border-black p-4 relative">
<div class="absolute -top-3 -right-3 w-10 h-10 bg-acid-pink border-2 border-black"></div>
<div class="text-xs font-mono text-gray-400">ACTIVE CVEs</div>
<div class="text-4xl font-display text-acid-green" id="stat-cve">1,284</div>
</div>
<div class="bg-white border-4 border-black p-4 relative">
<div class="absolute -top-3 -right-3 w-10 h-10 bg-acid-cyan border-2 border-black"></div>
<div class="text-xs font-mono text-gray-400">PACKAGES TRACKED</div>
<div class="text-4xl font-display" id="stat-pkgs">842</div>
</div>
<div class="bg-acid-yellow border-4 border-black p-4 relative overflow-hidden">
<div class="absolute -bottom-2 -left-2 w-16 h-16 bg-black opacity-10"></div>
<div class="text-xs font-mono text-black">CRITICAL ALERTS</div>
<div class="text-4xl font-display text-black" id="stat-critical">47</div>
</div>
<div class="bg-white border-4 border-black border-l-8 border-l-acid-pink p-4">
<div class="text-xs font-mono text-gray-400">COMMUNITY VOTES (24H)</div>
<div class="text-4xl font-display text-black">89,102</div>
</div>
</div>
<!-- MAIN DEPENDENCY LIST -->
<main id="dependency-list" class="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-8 pb-20">
<!-- Cards injected by JS -->
</main>
<!-- FOOTER / SYSTEM STATUS -->
<footer class="mt-12 border-t-4 border-black pt-4 flex justify-between items-center font-mono text-xs uppercase bg-black text-white p-4">
<div>System Status: <span class="text-acid-green blink">ONLINE</span></div>
<div>LAST SYNC: <span id="last-sync">JUST NOW</span></div>
<div class="flex gap-2">
<div class="w-3 h-3 bg-acid-pink animate-pulse"></div>
<div class="w-3 h-3 bg-acid-cyan animate-pulse"></div>
<div class="w-3 h-3 bg-acid-green animate-pulse"></div>
</div>
</footer>
</div>
<!-- TEMPLATE FOR CARD -->
<template id="card-template">
<article class="bg-white border-4 border-black p-4 relative card-hover flex flex-col justify-between h-full group">
<!-- Danger Indicator (Shown if high risk) -->
<div class="absolute -top-3 -right-3 w-10 h-10 bg-alert-red border-2 border-black flex items-center justify-center z-20 hidden risk-icon">
<span class="font-display text-white text-lg">!</span>
</div>
<div>
<!-- Header: Name & Version -->
<div class="flex justify-between items-start mb-2">
<div>
<h3 class="text-xl font-display uppercase leading-none mb-1 truncate max-w-[150px]">{name}</h3>
<span class="text-xs font-mono text-gray-500">v{version}</span>
</div>
<div class="text-xs font-mono bg-black text-white px-1 border border-white">{license}</div>
</div>
<!-- Meta Row: CVEs & Telemetry -->
<div class="flex gap-2 mb-4 flex-wrap">
<span class="cve-badge border-2 border-alert-red text-alert-red px-2 py-1 text-xs font-bold uppercase flex items-center gap-1">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z" clip-rule="evenodd"></path></svg>
{cveCount} CVEs
</span>
<span class="bg-acid-cyan border-2 border-black text-black px-2 py-1 text-xs font-mono uppercase">
DW: {downloads}
</span>
<span class="bg-gray-200 border-2 border-black px-2 py-1 text-xs font-mono uppercase">
Trend: {trend}
</span>
</div>
<!-- Risk Bar Visual -->
<div class="w-full bg-gray-200 border-2 border-black h-6 relative mb-2">
<div class="risk-bar-fill bg-acid-green border-r-2 border-black h-full" style="width: {risk}%"></div>
<div class="absolute inset-0 flex items-center justify-center text-[10px] font-mono font-bold uppercase mix-blend-difference text-white pointer-events-none">
Risk: {risk}%
</div>
</div>
</div>
<!-- Footer: Voting & Action -->
<div class="border-t-2 border-black pt-3 mt-2 flex justify-between items-center bg-gray-50">
<div class="flex flex-col">
<div class="text-xs font-mono text-gray-500 mb-1">Community Votes</div>
<div class="flex items-center gap-2">
<button class="vote-down h-8 w-8 bg-white border-2 border-black flex items-center justify-center active:bg-black active:text-white transition-colors font-bold">-</button>
<span class="w-10 text-center font-display text-lg votes-display">{totalVotes}</span>
<button class="vote-up h-8 w-8 bg-white border-2 border-black flex items-center justify-center active:bg-black active:text-white transition-colors font-bold">+</button>
</div>
</div>
<button class="btn-hard bg-acid-pink text-black border-2 border-black px-4 py-2 font-bold uppercase text-sm whitespace-nowrap shadow-hard-sm" onclick="app.simulateUpdate()">
UPDATE NOW
</button>
</div>
</article>
</template>
<!-- JAVASCRIPT LOGIC -->
<script>
// --- Mock Data Generation ---
const LANGUAGES = ['node', 'react', 'vue', 'angular', 'python', 'go', 'java', 'rust'];
const PREFIXES = ['lodash', 'axios', 'express', 'async', 'bluebird', 'moment', 'debug', 'chalk', 'commander', 'inquirer', 'socket.io', 'sequelize', 'underscore', 'request', 'babel', 'webpack', 'typescript'];
const SUFFIXES = ['', '-core', '-utils', '-client', '-server', '-api', '-lib', '-sdk', '-toolkit'];
const TRENDS = ['rising', 'stable', 'falling', 'volatile'];
const LICENSES = ['MIT', 'Apache-2.0', 'ISC', 'BSD-3', 'GPL-3.0'];
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function generateDeps(count) {
const deps = [];
for (let i = 0; i < count; i++) {
const prefix = PREFIXES[randomInt(0, PREFIXES.length - 1)];
const suffix = Math.random() > 0.7 ? SUFFIXES[randomInt(0, SUFFIXES.length - 1)] : '';
const name = prefix + suffix;
// Risk logic: Base CVE count + random volatility
const baseCve = randomInt(0, 40);
const baseRisk = Math.min(100, baseCve * 2.5 + randomInt(5, 30));
// Telemetry popularity (inverse somewhat to risk for realism? Not necessarily)
const downloads = Math.floor(Math.random() * 5000000) + 5000;
deps.push({
id: i,
name: name,
version: `${randomInt(1,4)}.${randomInt(0,9)}.${randomInt(0,9)}`,
license: LICENSES[randomInt(0, LICENSES.length - 1)],
cveCount: baseCve,
downloads: formatNumber(downloads),
trend: TRENDS[randomInt(0, TRENDS.length - 1)],
risk: Math.floor(baseRisk),
totalVotes: randomInt(10, 5000),
timestamp: Date.now()
});
}
return deps;
}
function formatNumber(num) {
if (num >= 1000000) return (num / 1000000).toFixed(1) + 'M';
if (num >= 1000) return (num / 1000).toFixed(1) + 'K';
return num;
}
// --- Application Logic ---
class App {
constructor() {
this.data = generateDeps(24); // Generate a manageable amount for grid
this.container = document.getElementById('dependency-list');
this.searchInput = document.getElementById('searchInput');
this.sortMode = 'risk'; // 'risk' or 'votes'
this.render();
this.setupListeners();
this.startBackgroundCanvas();
}
// Calculate composite score (just using 'risk' field right now but could be expanded)
getCompositeScore(item) {
return item.risk;
}
setSort(mode) {
if (this.sortMode === mode) return;
this.sortMode = mode;
// Visual feedback for buttons
document.querySelectorAll('.btn-hard').forEach(btn => {
if(btn.textContent.toLowerCase().includes(mode)) {
btn.classList.add('bg-acid-green');
btn.classList.remove('bg-white');
} else {
btn.classList.remove('bg-acid-green');
btn.classList.add('bg-white');
}
});
this.sortAndRender();
}
sortData() {
this.data.sort((a, b) => {
if (this.sortMode === 'risk') {
return b.risk - a.risk; // High risk first
} else {
return b.totalVotes - a.totalVotes; // High votes first
}
});
}
handleVote(id, delta) {
const pkg = this.data.find(d => d.id === id);
if (pkg) {
// Simulate impact: voting increases weight slightly, slightly increases risk (to stir pot)
pkg.totalVotes += 1;
// Slight risk modulation based on crowd noise:
pkg.risk = Math.min(100, Math.max(0, pkg.risk + (delta > 0 ? 1 : -1)));
// Update DOM directly for performance before re-sort?
// For this demo, re-rendering is fine. But we need to animate.
// Find card element
const card = document.getElementById(`card-${id}`);
if (card) {
// Glitch effect
gsap.to(card, {
x: 5, duration: 0.05, yoyo: true, repeat: 3,
backgroundColor: delta > 0 ? '#CCFF00' : '#FF3333',
onComplete: () => {
gsap.set(card, { backgroundColor: '#ffffff' });
}
});
// Update numbers in place first
card.querySelector('.votes-display').textContent = formatNumber(pkg.totalVotes);
const bar = card.querySelector('.risk-bar-fill');
card.querySelector('.risk-indicator-text').textContent = `Risk: ${pkg.risk}%`; // update text inside bar
bar.style.width = `${pkg.risk}%`;
// Add danger icon if risk > 80
const icon = card.querySelector('.risk-icon');
if (pkg.risk > 80) icon.classList.remove('hidden');
else icon.classList.add('hidden');
}
// Re-sort after delay for dramatic effect
setTimeout(() => {
this.sortAndRender();
}, 500);
}
}
sortAndRender() {
this.sortData();
this.render();
}
toggleFilters() {
alert("FILTER MODULE WOULD APPEAR HERE (WINDOWS 95 STYLE DIALOG)");
}
simulateUpdate() {
// Just a console log for demo
console.log("Update triggered");
}
render() {
// Clear current
this.container.innerHTML = '';
// Batch create
const fragment = document.createDocumentFragment();
this.data.forEach((item, index) => {
const card = this.createCard(item, index);
fragment.appendChild(card);
});
this.container.appendChild(fragment);
// Entrance Animation (GSAP Stagger)
gsap.from('.card-hover', {
y: 100,
opacity: 0,
duration: 0.6,
stagger: 0.08,
ease: 'power2.out'
});
}
createCard(item, index) {
const template = document.getElementById('card-template');
const clone = template.content.cloneNode(true);
const article = clone.querySelector('article');
article.id = `card-${item.id}`;
// Populate fields
clone.querySelector('h3').textContent = item.name;
clone.querySelector('span[data-version]') ? clone.querySelector('span[data-version]').textContent = item.version : null;
// Better to just query raw text nodes or close spans
const versionSpan = clone.querySelector('h3').nextElementSibling;
if(versionSpan) versionSpan.textContent = item.version;
const licenseBadge = clone.querySelector('span.bg-black');
if(licenseBadge) licenseBadge.textContent = item.license;
const cveBadge = clone.querySelector('.cve-badge');
// Adjust CVE badge color based on severity
if (item.cveCount > 10) {
cveBadge.style.backgroundColor = '#FF3333';
cveBadge.style.color = '#ffffff';
cveBadge.style.borderColor = '#000';
}
// Stats
clone.querySelector('.cve-badge').innerHTML = `
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z" clip-rule="evenodd"></path></svg>
${item.cveCount} CVEs
`;
clone.querySelector('.bg-acid-cyan').innerHTML = `DW: ${item.downloads}`;
clone.querySelector('.bg-gray-200').textContent = `Trend: ${item.trend}`;
// Bar
const bar = clone.querySelector('.risk-bar-fill');
bar.style.width = `${item.risk}%`;
// Text inside bar
const barText = clone.createElement('span');
barText.className = 'absolute inset-0 flex items-center justify-center text-[10px] font-mono font-bold mix-blend-difference text-white pointer-events-none risk-indicator-text';
barText.id = `risk-text-${item.id}`;
barText.textContent = `Risk: ${item.risk}%`;
bar.parentElement.appendChild(barText);
// Hide danger icon if low risk
if (item.risk <= 80) {
clone.querySelector('.risk-icon').classList.add('hidden');
}
// Votes
const votesDisplay = clone.querySelector('.votes-display');
votesDisplay.textContent = formatNumber(item.totalVotes);
// Buttons
const btnUp = clone.querySelector('.vote-up');
const btnDown = clone.querySelector('.vote-down');
btnUp.onclick = () => this.handleVote(item.id, 1);
btnDown.onclick = () => this.handleVote(item.id, -1);
// Add some random offset color to card tops based on risk to make it chaotic
if (item.risk > 80) {
article.classList.add('bg-yellow-100');
} else if (item.risk < 20) {
article.classList.add('bg-acid-green', 'bg-opacity-20');
}
return article;
}
setupListeners() {
const search = (e) => {
const term = e.target.value.toLowerCase();
const cards = document.querySelectorAll('.card-hover');
cards.forEach(card => {
const name = card.querySelector('h3').textContent.toLowerCase();
if (name.includes(term)) {
card.style.display = 'flex';
} else {
card.style.display = 'none';
}
});
};
this.searchInput.addEventListener('input', search);
}
// Canvas Background: Digital Noise / Matrix Rain effect
startBackgroundCanvas() {
const canvas = document.createElement('canvas');
canvas.style.position = 'fixed';
canvas.style.top = '0';
canvas.style.left = '0';
canvas.style.width = '100%';
canvas.style.height = '100%';
canvas.style.zIndex = '-1'; // Behind everything
canvas.style.opacity = '0.05';
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
let width = canvas.width = window.innerWidth;
let height = canvas.height = window.innerHeight;
window.addEventListener('resize', () => {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
});
const letters = '010101ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const fontSize = 14;
const cols = width / fontSize;
const ypos = Array(Math.floor(cols)).fill(0);
function loop() {
ctx.fillStyle = '#000000'; // Black bg on transparent
// Subtle clear
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = '#CCFF00'; // Acid green text
ctx.font = fontSize + 'px monospace';
ypos.forEach((y, i) => {
const text = letters[Math.floor(Math.random() * letters.length)];
ctx.fillText(text, i * fontSize, y);
if (y > height && Math.random() > 0.975) {
ypos[i] = 0;
} else {
ypos[i] += fontSize;
}
});
requestAnimationFrame(loop);
}
loop();
}
}
// Initialize App when DOM ready
const app = new App();
</script>
</body>
</html>