MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / draw_vulnerabilities

Method draw_vulnerabilities

pager/pager_display.py:688–731  ·  view source on GitHub ↗

Vulnerabilities list for 480x222 landscape.

(self)

Source from the content-addressed store, hash-verified

686 # ------------------------------------------------------------------
687
688 def draw_vulnerabilities(self):
689 """Vulnerabilities list for 480x222 landscape."""
690 self.pager.clear(self.DARK_BG)
691 self.refresh_list_data()
692
693 count = len(self._vulns_data)
694 self._draw_screen_header(f"VULNS ({count})")
695
696 y = 26
697 max_y = self.height - 2
698 row_h = 24
699 visible = (max_y - y) // row_h
700
701 vulns = self._vulns_data
702 total = len(vulns)
703 self.scroll_offset = min(self.scroll_offset, max(0, total - visible))
704
705 if not vulns:
706 self.pager.draw_ttf_centered(100, "No vulnerabilities found", self.GRAY, self.font_arial, 16)
707 else:
708 # Column headers
709 self.pager.draw_ttf(8, y, "HOST:PORT", self.GRAY, self.font_arial, 10)
710 self.pager.draw_ttf(180, y, "HOSTNAME", self.GRAY, self.font_arial, 10)
711 self.pager.draw_ttf(310, y, "CVEs", self.GRAY, self.font_arial, 10)
712 y += 16
713
714 for i in range(self.scroll_offset, min(self.scroll_offset + visible - 1, total)):
715 v = vulns[i]
716 cy = y + (i - self.scroll_offset) * row_h
717
718 if (i - self.scroll_offset) % 2 == 0:
719 self.pager.fill_rect(2, cy, self.width - 4, row_h - 2, self.CARD_BG)
720
721 host_text = f"{v['ip']}:{v['port']}"[:22]
722 self.pager.draw_ttf(8, cy + 3, host_text, self.RED, self.font_arial, 12)
723 if v['hostname']:
724 self.pager.draw_ttf(180, cy + 3, v['hostname'][:16], self.GRAY, self.font_arial, 11)
725 vuln_list = v['vulns'][:24]
726 self.pager.draw_ttf(310, cy + 3, vuln_list, self.ORANGE, self.font_arial, 11)
727
728 if total > visible:
729 sb_h = max(8, int((max_y - 42) * visible / total))
730 sb_y = 42 + int((max_y - 42 - sb_h) * self.scroll_offset / max(1, total - visible))
731 self.pager.fill_rect(self.width - 3, sb_y, 2, sb_h, self.GRAY)
732
733 # ------------------------------------------------------------------
734 # Settings screens (4-7) - interactive configuration

Callers 1

render_frameMethod · 0.95

Calls 7

refresh_list_dataMethod · 0.95
_draw_screen_headerMethod · 0.95
rangeFunction · 0.85
clearMethod · 0.45
draw_ttf_centeredMethod · 0.45
draw_ttfMethod · 0.45
fill_rectMethod · 0.45

Tested by

no test coverage detected