Spaces:
Sleeping
Sleeping
Download schema.sql from rajesh9698/CYBER_OPS: direct link, hf CLI and curl.
- Browser
- Download file 6.26 kB
-
https://huggingface.co/spaces/rajesh9698/CYBER_OPS/resolve/main/schema.sql
- Command line
-
hf download hf://spaces/rajesh9698/CYBER_OPS/schema.sql
-
curl -L -o schema.sql https://huggingface.co/spaces/rajesh9698/CYBER_OPS/resolve/main/schema.sql
6.26 kB
| -- CyberShield AI Database Schema (PostgreSQL for Supabase) | |
| CREATE TABLE IF NOT EXISTS users ( | |
| id SERIAL PRIMARY KEY, | |
| username TEXT UNIQUE NOT NULL, | |
| password_hash TEXT NOT NULL, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| CREATE TABLE IF NOT EXISTS domains ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT NOT NULL, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | |
| UNIQUE(user_id, domain_name) | |
| ); | |
| CREATE TABLE IF NOT EXISTS scan_results ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT NOT NULL, | |
| scan_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | |
| ssl_status TEXT NOT NULL, | |
| ssl_issuer TEXT, | |
| ssl_cn TEXT, | |
| ssl_issue_date TEXT, | |
| ssl_expiry_date TEXT, | |
| ssl_days_remaining INTEGER, | |
| ssl_raw_info TEXT, | |
| headers_csp TEXT, | |
| headers_hsts TEXT, | |
| headers_xframe TEXT, | |
| headers_xcontent TEXT, | |
| headers_referrer TEXT, | |
| security_score INTEGER NOT NULL, | |
| risk_level TEXT NOT NULL, | |
| recommendations_json TEXT | |
| ); | |
| CREATE TABLE IF NOT EXISTS reports ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| scan_id INTEGER NOT NULL REFERENCES scan_results(id) ON DELETE CASCADE, | |
| report_name TEXT NOT NULL, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| CREATE TABLE IF NOT EXISTS threat_intel_results ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| scan_id INTEGER, | |
| domain_name TEXT NOT NULL, | |
| ip_address TEXT, | |
| country TEXT, | |
| isp TEXT, | |
| threat_level TEXT DEFAULT 'Low', | |
| reputation_score INTEGER DEFAULT 100, | |
| blacklist_status TEXT DEFAULT 'Safe', | |
| blacklisted_on TEXT, | |
| phishing_detected INTEGER DEFAULT 0, | |
| malware_detected INTEGER DEFAULT 0, | |
| suspicious_tld INTEGER DEFAULT 0, | |
| raw_data TEXT, | |
| scan_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| CREATE TABLE IF NOT EXISTS cve_cache ( | |
| id SERIAL PRIMARY KEY, | |
| cve_id TEXT UNIQUE NOT NULL, | |
| description TEXT, | |
| severity TEXT, | |
| cvss_score REAL, | |
| published_date TEXT, | |
| affected_tech TEXT, | |
| mitigation TEXT, | |
| cached_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| CREATE TABLE IF NOT EXISTS defacement_baselines ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT NOT NULL, | |
| content_hash TEXT NOT NULL, | |
| content_length INTEGER, | |
| captured_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | |
| UNIQUE(user_id, domain_name) | |
| ); | |
| CREATE TABLE IF NOT EXISTS alerts ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT, | |
| alert_type TEXT NOT NULL, | |
| severity TEXT DEFAULT 'Medium', | |
| title TEXT NOT NULL, | |
| message TEXT NOT NULL, | |
| is_dismissed INTEGER DEFAULT 0, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| CREATE TABLE IF NOT EXISTS email_settings ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL UNIQUE REFERENCES users(id) ON DELETE CASCADE, | |
| email_address TEXT, | |
| smtp_host TEXT DEFAULT 'smtp.gmail.com', | |
| smtp_port INTEGER DEFAULT 587, | |
| smtp_username TEXT, | |
| smtp_password TEXT, | |
| notify_ssl_expiry INTEGER DEFAULT 1, | |
| notify_defacement INTEGER DEFAULT 1, | |
| notify_high_risk INTEGER DEFAULT 1, | |
| notify_blacklist INTEGER DEFAULT 1 | |
| ); | |
| -- βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| -- CyberShield AI 3.1 Migration Schema | |
| -- βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| -- Attack Surface Monitoring Table | |
| CREATE TABLE IF NOT EXISTS attack_surface ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT NOT NULL, | |
| subdomains TEXT, -- JSON array of discovered subdomains | |
| open_ports TEXT, -- JSON array of discovered open ports | |
| dns_records TEXT, -- JSON object of DNS records (A, MX, CNAME, TXT, NS) | |
| ssl_status TEXT, | |
| attack_surface_score INTEGER DEFAULT 100, | |
| scan_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | |
| UNIQUE(user_id, domain_name) | |
| ); | |
| -- Audit Logging Table | |
| CREATE TABLE IF NOT EXISTS audit_logs ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| username TEXT, | |
| action TEXT NOT NULL, | |
| details TEXT, | |
| ip_address TEXT, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| -- Security Timeline Table | |
| CREATE TABLE IF NOT EXISTS security_timeline ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT, | |
| event_type TEXT NOT NULL, -- 'SSL_EXPIRY_ALERT', 'THREAT_INTEL_ALERT', 'DEFACEMENT_ALERT', 'NEW_CVE', 'USER_SCAN' | |
| severity TEXT DEFAULT 'Medium', | |
| title TEXT NOT NULL, | |
| message TEXT NOT NULL, | |
| event_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |
| -- Scheduled Automated Scans Table | |
| CREATE TABLE IF NOT EXISTS scheduled_scans ( | |
| id SERIAL PRIMARY KEY, | |
| user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | |
| domain_name TEXT NOT NULL, | |
| interval_hours INTEGER NOT NULL, -- 1, 6, 24, 168 | |
| last_run TIMESTAMP WITH TIME ZONE, | |
| next_run TIMESTAMP WITH TIME ZONE, | |
| is_active INTEGER DEFAULT 1, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | |
| UNIQUE(user_id, domain_name) | |
| ); | |
| -- Real-time Visitor Geolocation Table | |
| CREATE TABLE IF NOT EXISTS visitor_locations ( | |
| id SERIAL PRIMARY KEY, | |
| ip_address TEXT, | |
| country TEXT, | |
| country_code TEXT, | |
| city TEXT, | |
| suburb TEXT, | |
| road TEXT, | |
| postcode TEXT, | |
| lat REAL, | |
| lon REAL, | |
| accuracy_m REAL, | |
| location_mode TEXT, | |
| isp TEXT, | |
| org TEXT, | |
| asn TEXT, | |
| user_agent TEXT, | |
| created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | |
| ); | |