Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3-bullseye, 3.10-bullseye, 3-buster, 3.10-buster, etc.
ARG VARIANT="3.10-bullseye"
ARG VARIANT="3.13-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- os: ubuntu-20.04
artifact_name: capa
asset_name: linux-py312
python_version: '3.12'
python_version: '3.13'
- os: windows-2019
artifact_name: capa.exe
asset_name: windows
Expand Down
39 changes: 37 additions & 2 deletions capa/ida/plugin/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ def get_values(self):
)


class CapaExplorerForm(idaapi.PluginForm):
"""form element for plugin interface"""
# Add this import at the top of the file
from PyQt5.QtGui import QFont


# Modify the __init__ method of the CapaExplorerForm class
class CapaExplorerForm(idaapi.PluginForm):
def __init__(self, name: str, option=Options.NO_ANALYSIS):
"""initialize form elements"""
super().__init__()
Expand Down Expand Up @@ -233,6 +236,10 @@ def __init__(self, name: str, option=Options.NO_ANALYSIS):
self.view_rulegen_limit_features_by_ea: QtWidgets.QCheckBox
self.view_rulegen_status_label: QtWidgets.QLabel

# Font settings
self.font_size = 10 # Default font size
self.font_family = "Courier" # Default font family

self.Show()

analyze = settings.user.get(CAPA_SETTINGS_ANALYZE)
Expand All @@ -254,6 +261,34 @@ def OnCreate(self, form):
self.load_interface()
self.load_ida_hooks()

# Add font menu
self.add_font_menu()

def add_font_menu(self):
"""Add a menu option to adjust font size."""
menu = idaapi.create_menu("Options")
idaapi.add_menu_item(menu, "Increase Font Size", "", 0, self.increase_font_size, ())
idaapi.add_menu_item(menu, "Decrease Font Size", "", 0, self.decrease_font_size, ())

def increase_font_size(self):
"""Increase the font size."""
self.font_size += 1
self.apply_font()

def decrease_font_size(self):
"""Decrease the font size."""
self.font_size -= 1
self.apply_font()

def apply_font(self):
"""Apply the font to all widgets."""
font = QFont(self.font_family, self.font_size)
self.parent.setFont(font)
self.view_tree.setFont(font)
self.view_rulegen_preview.setFont(font)
self.view_rulegen_editor.setFont(font)
self.view_rulegen_features.setFont(font)

def Show(self):
"""creates form if not already create, else brings plugin to front"""
return super().Show(
Expand Down
7 changes: 3 additions & 4 deletions capa/ida/plugin/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ class CapaExplorerRulegenPreview(QtWidgets.QTextEdit):
def __init__(self, parent=None):
""" """
super().__init__(parent)

self.setFont(QtGui.QFont("Courier", weight=QtGui.QFont.Bold))
self.setFont(QtGui.QFont("Courier", 10, weight=QtGui.QFont.Bold)) # Set default font size
self.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
self.setAcceptRichText(False)
Expand Down Expand Up @@ -327,7 +326,7 @@ def __init__(self, preview, parent=None):
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.setStyleSheet("QTreeView::item {padding-right: 15 px;padding-bottom: 2 px;}")

self.setFont(QtGui.QFont("Courier", 10))
# configure view columns to auto-resize
for idx in range(3):
self.header().setSectionResizeMode(idx, QtWidgets.QHeaderView.Interactive)
Expand Down Expand Up @@ -817,7 +816,7 @@ def __init__(self, editor, parent=None):

self.setHeaderLabels(["Feature", "Address"])
self.setStyleSheet("QTreeView::item {padding-right: 15 px;padding-bottom: 2 px;}")

self.setFont(QtGui.QFont("Courier", 10))
# configure view columns to auto-resize
for idx in range(2):
self.header().setSectionResizeMode(idx, QtWidgets.QHeaderView.Interactive)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ authors = [
description = "The FLARE team's open-source tool to identify capabilities in executable files."
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE.txt"}
requires-python = ">=3.10"
requires-python = ">=3.13"
keywords = ["malware analysis", "reverse engineering", "capability detection", "software behaviors", "capa", "FLARE"]
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down
Loading