Skip to content

Commit

Permalink
Add Tooltips for all sub-components
Browse files Browse the repository at this point in the history
  • Loading branch information
dslrsiddesh committed Dec 19, 2023
1 parent 2b0ec6f commit ec69f6b
Show file tree
Hide file tree
Showing 19 changed files with 103 additions and 40 deletions.
10 changes: 5 additions & 5 deletions tooltips.toml → config/tooltip.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[physical-ports]
enable = "defines a point of entry for communication "
device-rules = "dynamically creates and removes nodes for hardware devices."
device-rules = "dynamically creates and removes nodes for hardware devices."

port-rules ="lets administrators manage network services on Ubuntu systems by opening and closing ports."

Expand All @@ -21,7 +21,7 @@ disable_error_reporting = "counts, analyzes, and aggregates the crashes in your
restrict_core_dumps = "he system provides the ability to set a soft limit for core dumps, but this can be overridden by the user."

[apparmor] # Mandatory Access Control
enable = "a Linux Security Module implementation of name-based mandatory access controls"
enable = "a Linux Security Module implementation of name-based mandatory access controls"
mode = "enforces the SELinux policy and denies access based on SELinux policy rules"

[gdm] # GNOME Display Manager
Expand All @@ -30,7 +30,7 @@ disable_user_list = "controls if a list of users is displayed on the login scree
lock_on_idle = "screen inactivity idle time interval"
no_override_lockscreen = "override the static lock screen image with a snapshot of your current live wallpaper."
disable_automount = "prevents Windows from automatically mounting or assigning drive letters to any new basic volumes that are visible to the system"
lock_automonut = "Installs autofs mount points and associates the information in the automaster"
lock_automount = "Installs autofs mount points and associates the information in the automaster"
disable_autorun = "Windows will no longer open these devices automatically."
no_override_autorun = "The NoDriveAutoRun value disables AutoRun for specified drive letters"

Expand Down Expand Up @@ -76,12 +76,12 @@ ignore_bogus_icmp_errors = "prevents the kernel from logging bogus responses (RF
enable_rp_filter = "protects against spoofed source addresses by causing the system to discard packets"
enable_syn_cookies = " a technique used to resist SYN flood attacks"
reject_ipv6_router_adv = "allows devices to use a much larger number of unique IP addresses"
disable_protocols ="a standardized set of rules for formatting and processing data."
disable_protocols = {dccp = "true", sctp = "true", rds = "true", tipc = "true"}


[firewall] # Firewall
enable = "a way to protect machines from any unwanted traffic from outside."
configure_loopback = "a virtual network interface that doesn't represent any physical or hardware device."
configure_loopback_traffic = "a virtual network interface that doesn't represent any physical or hardware device."
enable_default_deny = " Deny all traffic by default "

[ssh]
Expand Down
8 changes: 8 additions & 0 deletions harden/tooltip_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import tomlkit
import os

FILE_PATH = os.path.join(os.path.dirname(__file__), "../config/tooltip.toml")

def read():
with open(FILE_PATH, "r") as f:
return tomlkit.load(f)
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
from ui.sidebar import Sidebar
from ui.page import Pages
from ui.toolbar import ToolBar
from harden import config_file
from harden import config_file, tooltip_file
import sys

class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.config = config_file.init()
self.tooltip = tooltip_file.read()
self.init_ui()

def init_ui(self):
Expand All @@ -20,7 +21,7 @@ def init_ui(self):
self.toolbar = ToolBar(self.config)
self.addToolBar(self.toolbar)

self.pages = Pages(self.config)
self.pages = Pages(self.config, self.tooltip)
self.pages.setObjectName("page")
self.toolbar.import_signal.connect(self.pages.refresh_config)

Expand All @@ -41,7 +42,7 @@ def init_ui(self):

def main():
app = QApplication(sys.argv)
app.setStyleSheet(open("ui/qss/style.qss", "r").read())
app.setStyleSheet(open("ui/qss/dark.qss", "r").read())
window = MainWindow()
window.show()
app.exec()
Expand Down
9 changes: 8 additions & 1 deletion ui/components/hardware/file_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
from harden import config_file

class FileSystems(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_file_systems = self.config['file-systems']
self.file_systems_tooltip = self.tooltip['file-systems']
self.init_ui()
self.refresh_config(config)

Expand Down Expand Up @@ -41,6 +43,7 @@ def init_ui(self):
self.block_checkboxes = {}
for name, state in self.toml_file_systems['block'].items():
checkbox = QCheckBox(f'Block {name}')
checkbox.setToolTip(self.file_systems_tooltip['block'][name])
checkbox.stateChanged.connect(lambda state, name=name: self.save_checkbox_state(state, 'block', name))
self.container_layout.addWidget(checkbox)
self.block_checkboxes[name] = checkbox
Expand All @@ -54,6 +57,7 @@ def init_ui(self):
self.configure_fs_checkboxes = {}
for name, state in self.toml_file_systems['configure_fs'].items():
checkbox = QCheckBox(f"Configure /{name.replace('_', '/')}")
checkbox.setToolTip(self.file_systems_tooltip['configure_fs'][name])
checkbox.stateChanged.connect(lambda state, name=name: self.save_checkbox_state(state, 'configure_fs', name))
self.container_layout.addWidget(checkbox)
self.configure_fs_checkboxes[name] = checkbox
Expand All @@ -64,6 +68,7 @@ def init_ui(self):
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.setAlignment(Qt.AlignmentFlag.AlignLeft)
self.configure_label = QLabel('Configure /tmp size (in GB):')
self.configure_label.setToolTip(self.file_systems_tooltip['tmp_size'])
self.size_input = QLineEdit()
# self.size_input.setFixedWidth(100)
validator = QIntValidator()
Expand All @@ -77,6 +82,7 @@ def init_ui(self):

# disable_automount
self.disable_auto_mount = QCheckBox('Disable Auto-Mount')
self.disable_auto_mount.setToolTip(self.file_systems_tooltip['disable_automount'])
self.disable_auto_mount.stateChanged.connect(lambda state: self.save_checkbox_state(state, 'disable_automount', None))
self.container_layout.addWidget(self.disable_auto_mount)

Expand All @@ -87,6 +93,7 @@ def init_ui(self):


self.enable_aide = QCheckBox('Enable AIDE (Advanced Intrusion Detection Environment)')
self.enable_aide.setToolTip(self.file_systems_tooltip['enable_aide'])
self.enable_aide.stateChanged.connect(lambda state: self.save_checkbox_state(state, 'enable_aide', None))
self.container_layout.addWidget(self.enable_aide)

Expand Down
7 changes: 6 additions & 1 deletion ui/components/hardware/physical_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from PyQt6.QtCore import Qt

class PhysicalPorts(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_physical_ports = self.config['physical-ports']
self.physical_ports_tooltip = self.tooltip['physical-ports']
self.init_ui()
self.refresh_config(config)

Expand Down Expand Up @@ -44,6 +46,7 @@ def init_ui(self):

# enable checkbox
self.main_checkbox = QCheckBox("Enable USB Blocking")
self.main_checkbox.setToolTip(self.physical_ports_tooltip['enable'])
self.container_layout.addWidget(self.main_checkbox)
self.main_checkbox.stateChanged.connect(self.enable_checkbox_clicked)

Expand All @@ -55,6 +58,7 @@ def init_ui(self):

def block_devices_table(self):
self.block_devices_label = QLabel("Block Devices")
self.block_devices_label.setToolTip(self.physical_ports_tooltip['device-rules'])
self.container_layout.addWidget(self.block_devices_label)
self.block_devices_label.setObjectName("sub-component-title")

Expand All @@ -81,6 +85,7 @@ def add_device_rows(self):

def block_ports_table(self):
self.block_ports_label = QLabel("Block Ports")
self.block_ports_label.setToolTip(self.physical_ports_tooltip['port-rules'])
self.container_layout.addWidget(self.block_ports_label)
self.block_ports_label.setObjectName("sub-component-title")

Expand Down
5 changes: 4 additions & 1 deletion ui/components/network/firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from harden import config_file

class Firewall(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_firewall = self.config['firewall']
self.firewall_tooltip = self.tooltip['firewall']
self.init_ui()
self.refresh_config(config)

Expand All @@ -31,6 +33,7 @@ def init_ui(self):
self.checkboxes = {}
for name, state in self.toml_firewall.items():
checkbox = QCheckBox(name.replace('_', ' ').title())
checkbox.setToolTip(self.firewall_tooltip[name])
checkbox.stateChanged.connect(lambda state, name=name: self.save_checkbox_state(state, name))
self.container_layout.addWidget(checkbox)
self.checkboxes[name] = checkbox
Expand Down
6 changes: 5 additions & 1 deletion ui/components/network/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from harden import config_file

class Net(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_net = self.config['network']
self.net_tooltip = self.tooltip['network']
self.init_ui()
self.refresh_config(config)

Expand Down Expand Up @@ -33,6 +35,7 @@ def init_ui(self):
if name == "disable_protocols":
continue
checkbox = QCheckBox(f"{name.replace('_',' ').title()}")
checkbox.setToolTip(self.net_tooltip[name])
checkbox.stateChanged.connect(lambda state, name = name: self.save_checkbox_state(name, state))
self.toml_net_checkboxes[name] = checkbox
self.container_layout.addWidget(checkbox)
Expand All @@ -44,6 +47,7 @@ def init_ui(self):
self.protocols_checkboxes = {}
for name, state in self.toml_net['disable_protocols'].items():
checkbox = QCheckBox(f"{name.replace('_',' ').title()}")
checkbox.setToolTip(self.net_tooltip['disable_protocols'][name])
checkbox.stateChanged.connect(lambda state, name=name: self.save_checkbox_state_protocols(state, 'disable_protocols', name))
checkbox.setProperty('class', 'in-checkbox')
self.container_layout.addWidget(checkbox)
Expand Down
6 changes: 5 additions & 1 deletion ui/components/software/apparmor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from harden import config_file

class AppArmor(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_apparmor = self.config['apparmor']
self.apparmor_tooltip = self.tooltip['apparmor']
self.init_ui()
self.refresh_config(config)

Expand All @@ -31,6 +33,7 @@ def init_ui(self):

# Enable Checkbox
self.enable_checkbox = QCheckBox('Enable')
self.enable_checkbox.setToolTip(self.apparmor_tooltip['enable'])
self.enable_checkbox.stateChanged.connect(self.save_checkbox_state)
self.container_layout.addWidget(self.enable_checkbox)

Expand All @@ -39,6 +42,7 @@ def init_ui(self):

# Select Mode Label
self.mode_label = QLabel('Select mode:')
self.mode_label.setToolTip(self.apparmor_tooltip['mode'])
self.mode_label.setProperty('class', 'normal-label-for')

# Mode Dropdown
Expand Down
15 changes: 10 additions & 5 deletions ui/components/software/gdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from harden import config_file

class GDM(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_gdm = self.config['gdm']
self.gdm_tooltip = self.tooltip['gdm']
self.init_ui()
self.refresh_config(config)

Expand All @@ -32,15 +34,17 @@ def init_ui(self):
self.container_widget.setObjectName("container-widget")

self.toml_gdm_checkboxes = {}
remove_checkbox = QCheckBox('Remove')
remove_checkbox.stateChanged.connect(lambda state, name = 'remove': self.save_checkbox_state(name, state))
self.toml_gdm_checkboxes['remove'] = remove_checkbox
self.container_layout.addWidget(remove_checkbox)
self.remove_checkbox = QCheckBox('Remove')
self.remove_checkbox.setToolTip(self.gdm_tooltip['remove'])
self.remove_checkbox.stateChanged.connect(lambda state, name = 'remove': self.save_checkbox_state(name, state))
self.toml_gdm_checkboxes['remove'] = self.remove_checkbox
self.container_layout.addWidget(self.remove_checkbox)

hlayout = QHBoxLayout()

# Lock on Idle Label
self.lockon_lable = QLabel('Lock on Idle(seconds)')
self.lockon_lable.setToolTip(self.gdm_tooltip['lock_on_idle'])
self.lockon_lable.setProperty('class', 'normal-label-for')

self.time_input = QLineEdit()
Expand All @@ -58,6 +62,7 @@ def init_ui(self):
continue
state = self.toml_gdm[name]
checkbox = QCheckBox(f"{name.replace('_',' ').title()}")
checkbox.setToolTip(self.gdm_tooltip[name])
checkbox.stateChanged.connect(lambda state, name = name: self.save_checkbox_state(name, state))
self.toml_gdm_checkboxes[name] = checkbox
self.container_layout.addWidget(checkbox)
Expand Down
5 changes: 4 additions & 1 deletion ui/components/software/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from harden import config_file

class Processes(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_processes = self.config['processes']
self.processes_tooltip = self.tooltip['processes']
self.init_ui()
self.refresh_config(config)

Expand All @@ -31,6 +33,7 @@ def init_ui(self):
self.checkboxes = {}
for name, state in self.toml_processes.items():
checkbox = QCheckBox(name.replace('_', ' ').title().replace('Aslr', 'ASLR'))
checkbox.setToolTip(self.processes_tooltip[name])
checkbox.stateChanged.connect(lambda state, name=name: self.save_checkbox_state(state, name))
self.container_layout.addWidget(checkbox)
self.checkboxes[name] = checkbox
Expand Down
5 changes: 4 additions & 1 deletion ui/components/software/service_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from harden import config_file

class ServiceClients(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_service_clients = self.config['service_clients']
self.service_clients_tooltip = self.tooltip['service_clients']
self.init_ui()
self.refresh_config(config)

Expand All @@ -32,6 +34,7 @@ def init_ui(self):
self.toml_service_clients_checkboxes = {}
for name, state in self.toml_service_clients.items():
checkbox = QCheckBox(f"{name.replace('_',' ').title()}")
checkbox.setToolTip(self.service_clients_tooltip[name])
checkbox.stateChanged.connect(lambda state, name = name: self.save_checkbox_state(name, state))
self.toml_service_clients_checkboxes[name] = checkbox
self.container_layout.addWidget(checkbox)
Expand Down
5 changes: 4 additions & 1 deletion ui/components/software/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from harden import config_file

class Services(QWidget):
def __init__(self, config):
def __init__(self, config, tooltip):
super().__init__()
self.config = config
self.tooltip = tooltip
self.toml_services = self.config['services']
self.services_tooltip = self.tooltip['services']
self.init_ui()
self.refresh_config(config)

Expand All @@ -32,6 +34,7 @@ def init_ui(self):
self.toml_services_checkboxes = {}
for name, state in self.toml_services.items():
checkbox = QCheckBox(f"{name.replace('_',' ').title()}")
checkbox.setToolTip(self.services_tooltip[name])
checkbox.stateChanged.connect(lambda state, name = name: self.save_checkbox_state(name, state))
self.toml_services_checkboxes[name] = checkbox
self.container_layout.addWidget(checkbox)
Expand Down
Loading

0 comments on commit ec69f6b

Please sign in to comment.