Removed_Content

Malware-Scanner-UI.py

Feb 20th, 2026 (edited)
133
0
Never
12
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.88 KB | Source Code | 0 0
  1. """
  2. Malware-Scanner-UI.py
  3.  
  4. Terminal UI module for a YARA-rule-based malware scanner. Builds a rich
  5. console layout (title panel, settings panel, and a scrolling output/log
  6. panel) and exposes methods to update the settings and output panels as a
  7. scan runs.
  8.  
  9. Requires: rich, and a local `lib` module providing a `stylize` helper.
  10. This file only contains display/layout logic; it does not perform scanning
  11. itself.
  12. """
  13.  
  14. import rich
  15. from rich.prompt import Prompt, Confirm, IntPrompt
  16. from rich.align import Align
  17. from rich.console import Console, Group
  18. from rich.layout import Layout
  19. from rich.panel import Panel
  20. from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn
  21. from rich.syntax import Syntax
  22. from rich.table import Table
  23. from rich.text import Text
  24.  
  25. import lib
  26.  
  27.  
  28. class UI:
  29.     def __init__(self, console, settings):
  30.         self.console = console
  31.         self.settings = settings
  32.         self.cache = []
  33.         self.layout = self.make_layout(settings)
  34.  
  35.     # FOOTER
  36.     def make_output(self):
  37.         grid = Table.grid(expand=True)
  38.         grid.add_column(justify="left", no_wrap=True)
  39.         grid.add_row(lib.stylize("Starting run...", 'status'))
  40.         self.cache.append(lib.stylize("Starting run...", 'status'))
  41.         message_panel = Panel(
  42.             Align.left(
  43.                 Group(Align.center(grid)),
  44.                 vertical="top",
  45.             ),
  46.             padding=(1, 2),
  47.             border_style="#00afd7",
  48.             title="[#EA549F]Output[/#EA549F]",
  49.         )
  50.         return message_panel
  51.  
  52.     def make_settings(self, settings):
  53.         caption = f"""[#EA549F]General YARA Rules Enabled:[/#EA549F] [bold white]{settings['rule_count'][0]}[/bold white]
  54.        [#EA549F]Binary YARA Rules Enabled:[/#EA549F] [bold white]{settings['rule_count'][1]}[/bold white]"""
  55.  
  56.         settings_table = Table(
  57.             leading=1,
  58.             caption=caption,
  59.             caption_style="default",
  60.             caption_justify="center"
  61.         )
  62.  
  63.         if settings['workpath'] == 'Not Set':
  64.             settings_table.add_column("[bold #EA549F]Setting[/bold #EA549F]", width=25, justify="center")
  65.             settings_table.add_column("[bold #EA549F]Value[/bold #EA549F]", width=25, no_wrap=True, justify="center")
  66.         else:
  67.             settings_table.add_column("[bold #EA549F]Setting[/bold #EA549F]", max_width=25, justify="left")
  68.             settings_table.add_column("[bold #EA549F]Value[/bold #EA549F]", max_width=25, no_wrap=True, justify="center")
  69.  
  70.         for x in settings.keys():
  71.             if x not in ['search_rules', 'binary_rules', 'rule_count']:
  72.                 settings_table.add_row(
  73.                     f"[bold]{x}[/bold]",
  74.                     Syntax(f"{settings[x]}", 'python', background_color="default")
  75.                 )
  76.  
  77.         message_panel = Panel(
  78.             Align.center(
  79.                 Group(Align.center(settings_table), Align.center("\n")),
  80.                 vertical="middle",
  81.             ),
  82.             padding=(1, 2),
  83.             border_style="#00afd7",
  84.             title="Settings"
  85.         )
  86.         return message_panel
  87.  
  88.     def make_title(self) -> Panel:
  89.         intro_message = Text.from_markup(
  90.             """[#EA549F]Welcome![/#EA549F]"""
  91.         )
  92.  
  93.         message_panel = Panel(
  94.             Align.center(
  95.                 Group(Align.center(intro_message)),
  96.                 vertical="middle",
  97.             ),
  98.             padding=(1, 2),
  99.             border_style="#00afd7",
  100.         )
  101.         return message_panel
  102.  
  103.     def make_layout(self, settings) -> Layout:
  104.         layout = Layout(name="root")
  105.         layout.split(
  106.             Layout(name="main", ratio=1),
  107.         )
  108.  
  109.         layout["main"].split_row(
  110.             Layout(name="Sidebar"),
  111.             Layout(name="Output", ratio=2, minimum_size=60),
  112.         )
  113.  
  114.         layout["Sidebar"].split(Layout(name="Title"), Layout(name="Settings"))
  115.  
  116.         layout["Output"].update(self.make_output())
  117.         layout["Settings"].update(self.make_settings(settings))
  118.         layout["Title"].update(self.make_title())
  119.  
  120.         return layout
  121.  
  122.     def update_settings(self, settings):
  123.         self.layout["Settings"].update(self.make_settings(settings))
  124.  
  125.     def update_output(self, message):
  126.         grid = Table.grid(expand=True)
  127.         grid.add_column(justify="left", no_wrap=True)
  128.  
  129.         if len(self.cache) <= 44:
  130.             for cached_message in self.cache:
  131.                 grid.add_row(cached_message)
  132.         else:
  133.             self.cache = []
  134.  
  135.         grid.add_row(message)
  136.         self.cache.append(message)
  137.  
  138.         message_panel = Panel(
  139.             Align.left(
  140.                 Group(Align.center(grid)),
  141.                 vertical="top",
  142.             ),
  143.             padding=(1, 2),
  144.             border_style="#00afd7",
  145.             title="[#EA549F]Output[/#EA549F]",
  146.         )
  147.  
  148.         self.layout["Output"].update(message_panel)
Advertisement
Comments
  • Removed_Content
    265 days
    Comment was deleted
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Removed_Content
    131 days
    # text 0.16 KB | 0 0
    1. Terminal UI module (built with rich) for a YARA-based malware scanner - renders the settings/output panels only; it does not scan Pastebin or anything else itself.
  • User was banned
  • User was banned
  • Garbegug
    44 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment