Module p4lantir.widgets.app_ui

Module content

class p4lantir.widgets.app_ui.PacketScreen(data: bytes)[source]

Bases: ModalScreen

Showed modal to display the hexdump of a data

BINDINGS: ClassVar[list[BindingType]] = [('escape', 'app.pop_screen', 'Exit')]

A list of key bindings.

compose() → Iterable[Widget][source]

Called by Textual to create child widgets.

This method is called when a widget is mounted or by setting recompose=True when calling [refresh()][textual.widget.Widget.refresh].

Note that you don’t typically need to explicitly call this method.

Example:

```python def compose(self) -> ComposeResult:

yield Header() yield Label(“Press the button below:”) yield Button() yield Footer()

```

on_mount() → None[source]
can_focus: bool = False

Widget may receive focus.

can_focus_children: bool = True

Widget’s children may receive focus.

class p4lantir.widgets.app_ui.MitmApp(driver_class: Type[Driver] | None = None, css_path: str | PurePath | List[str | PurePath] | None = None, watch_css: bool = False, ansi_color: bool = False)[source]

Bases: App

Main UI of the app

BINDINGS: ClassVar[list[BindingType]] = [('ctrl+e', 'clear_action', 'Clear Screen'), ('b', 'block_mode', 'Block packets'), ('d', 'drop_mode', 'Drop packet'), ('s', 'see_mode', 'See packet'), ('f', 'forward_mode', 'Forward packet'), ('c', 'close_mode', 'Close connections'), ('b', 'unblock_mode', 'Unblock packets')]

The default key bindings.

logger = None
rich_log_handler = None
block_event = None
drop_event = None
forward_event = None
close_event = None
message_queue

Create a reactive attribute.

Args:

default: A default value or callable that returns a default. layout: Perform a layout on change. repaint: Perform a repaint on change. init: Call watchers on initialize (post mount). always_update: Call watchers even when the new value equals the old value. recompose: Compose the widget again when the attribute changes. bindings: Refresh bindings when the reactive changes. toggle_class: An optional TCSS classname(s) to toggle based on the truthiness of the value.

block_mode = False
compose() → Iterable[Widget][source]

Yield child widgets for a container.

This method should be implemented in a subclass.

on_mount() → None[source]
action_block_mode() → None[source]

When ‘b’ is toggled, invert the state of the thread shared block event and update the available bindings

action_unblock_mode() → None[source]

Just an alias to easily change the description of the bindings

action_drop_mode() → None[source]

Invert the state of the thread shared drop event

action_forward_mode() → None[source]

Invert the state of the thread shared forward event

action_close_mode() → None[source]

Invert the state of the thread shared close connections event

action_see_mode() → None[source]

Display the intercepted packet in a hexdump-like fashion

action_clear_action() → None[source]

Clear the screen

check_action(action: str, parameters: tuple[object, ...]) → bool | None[source]

Called automaticaly to check which binding is avaible for the user