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

Method draw_credentials

pager/pager_display.py:641–682  ·  view source on GitHub ↗

Credentials list for 480x222 landscape.

(self)

Source from the content-addressed store, hash-verified

639 # ------------------------------------------------------------------
640
641 def draw_credentials(self):
642 """Credentials list for 480x222 landscape."""
643 self.pager.clear(self.DARK_BG)
644 self.refresh_list_data()
645
646 count = len(self._creds_data)
647 self._draw_screen_header(f"CREDENTIALS ({count})")
648
649 y = 26
650 max_y = self.height - 2
651 row_h = 24
652 visible = (max_y - y) // row_h
653
654 creds = self._creds_data
655 total = len(creds)
656 self.scroll_offset = min(self.scroll_offset, max(0, total - visible))
657
658 if not creds:
659 self.pager.draw_ttf_centered(100, "No credentials yet", self.GRAY, self.font_arial, 16)
660 else:
661 # Column headers
662 self.pager.draw_ttf(8, y, "SERVICE", self.GRAY, self.font_arial, 10)
663 self.pager.draw_ttf(100, y, "HOST", self.GRAY, self.font_arial, 10)
664 self.pager.draw_ttf(260, y, "USER:PASS", self.GRAY, self.font_arial, 10)
665 y += 16
666
667 for i in range(self.scroll_offset, min(self.scroll_offset + visible - 1, total)):
668 c = creds[i]
669 cy = y + (i - self.scroll_offset) * row_h
670
671 if (i - self.scroll_offset) % 2 == 0:
672 self.pager.fill_rect(2, cy, self.width - 4, row_h - 2, self.CARD_BG)
673
674 self.pager.draw_ttf(8, cy + 3, c['service'][:12], self.YELLOW, self.font_arial, 12)
675 self.pager.draw_ttf(100, cy + 3, c['host'][:18], self.WHITE, self.font_arial, 12)
676 cred = f"{c['user']}:{c['password']}"[:28]
677 self.pager.draw_ttf(260, cy + 3, cred, self.GREEN, self.font_arial, 12)
678
679 if total > visible:
680 sb_h = max(8, int((max_y - 42) * visible / total))
681 sb_y = 42 + int((max_y - 42 - sb_h) * self.scroll_offset / max(1, total - visible))
682 self.pager.fill_rect(self.width - 3, sb_y, 2, sb_h, self.GRAY)
683
684 # ------------------------------------------------------------------
685 # Screen 3: Vulnerabilities

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