Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
// ©AngelaMos | 2026
// instances.rs
use lisdex_monitor::snapshot::InstanceView;
use ratatui::Frame;
use ratatui::layout::{Constraint, Layout, Rect};
use ratatui::style::Style;
use ratatui::text::{Line, Span};
use ratatui::widgets::{Bar, BarChart, BarGroup, Row, Table};
use crate::app::App;
use crate::format;
use crate::overview::{panel, placeholder};
use crate::theme;
const BAR_WIDTH: u16 = 11;
const BAR_GAP: u16 = 1;
const CHART_HEIGHT: u16 = 12;
const ROLE_MAIN: &str = "main";
const ROLE_SECONDARY: &str = "secondary";
pub fn render(frame: &mut Frame, area: Rect, app: &App) {
let snapshot = app.snapshot();
if snapshot.instances().is_empty() {
placeholder(
frame,
area,
"INSTANCES",
theme::ACID_GREEN,
"no fuzzer instance has written stats under this findings directory",
);
return;
}
let [table_area, chart_area] =
Layout::vertical([Constraint::Min(5), Constraint::Length(CHART_HEIGHT)]).areas(area);
table(frame, table_area, snapshot.instances());
bars(frame, chart_area, snapshot.instances());
}
fn table(frame: &mut Frame, area: Rect, instances: &[InstanceView]) {
let rows: Vec<Row<'static>> = instances
.iter()
.enumerate()
.map(|(i, v)| row(i, v))
.collect();
let widget = Table::new(
rows,
[
Constraint::Length(14),
Constraint::Length(10),
Constraint::Length(11),
Constraint::Length(14),
Constraint::Length(10),
Constraint::Length(9),
Constraint::Min(8),
],
)
.header(
Row::new(vec![
"INSTANCE",
"ROLE",
"EXEC RATE",
"EXECS",
"EDGES",
"MAP",
"CRASHES",
])
.style(theme::title(theme::SLATE))
.height(1),
)
.block(panel(
&format!("INSTANCES {}", instances.len()),
theme::ACID_GREEN,
))
.column_spacing(1);
frame.render_widget(widget, area);
}
fn row(index: usize, instance: &InstanceView) -> Row<'static> {
let accent = theme::ramp_at(index);
let (role, role_style) = if instance.is_main {
(ROLE_MAIN, theme::value(theme::ACID_GREEN))
} else {
(ROLE_SECONDARY, theme::label())
};
Row::new(vec![
Span::styled(instance.name.clone(), theme::value(accent)),
Span::styled(role, role_style),
Span::styled(
format::rate(instance.execs_per_sec),
theme::value(theme::NEON_MAGENTA),
),
Span::styled(format::count(instance.execs_done), theme::value(theme::INK)),
Span::styled(
format::count(instance.edges_found),
theme::value(theme::NEON_CYAN),
),
Span::styled(
format::density(instance.map_density_pct),
theme::value(theme::NEON_BLUE),
),
Span::styled(
format::count(instance.saved_crashes),
theme::value(theme::AMBER),
),
])
}
fn bars(frame: &mut Frame, area: Rect, instances: &[InstanceView]) {
let bars: Vec<Bar<'static>> = instances
.iter()
.enumerate()
.map(|(index, instance)| {
Bar::default()
.value(format::bar_value(instance.execs_per_sec))
.label(Line::from(Span::styled(
instance.name.clone(),
theme::label(),
)))
.text_value(format::rate(instance.execs_per_sec))
.style(Style::default().fg(theme::ramp_at(index)))
.value_style(Style::default().fg(theme::PANEL).bg(theme::ramp_at(index)))
})
.collect();
let widget = BarChart::default()
.block(panel("EXEC RATE BY INSTANCE", theme::NEON_MAGENTA))
.data(BarGroup::default().bars(&bars))
.bar_width(BAR_WIDTH)
.bar_gap(BAR_GAP);
frame.render_widget(widget, area);
}