powermolegui.lib package¶
Submodules¶
powermolegui.lib.animation module¶
Main code for transforming tkinter canvas items.
powermolegui.lib.application module¶
Main code for creating tkinter frames.
The frames are used as a container for other widgets.
powermolegui.lib.frames module¶
Main code for creating tkinter frames.
The frames are used as a container for other widgets.
- class powermolegui.lib.frames.CanvasFrame(parent)[source]¶
Bases:
FrameConstructs a frame for the canvas widget.
- class powermolegui.lib.frames.CommandEntry(parent)[source]¶
Bases:
FrameConstructs a frame for the text widget.
- class powermolegui.lib.frames.CommandFrame(parent, *args, **kwargs)[source]¶
Bases:
FrameConstructs an outer frame that contains two log frames.
- class powermolegui.lib.frames.CommandResponse(parent)[source]¶
Bases:
FrameConstructs a frame for the text widget.
powermolegui.lib.helpers module¶
Import all parts from helpers here.
- class powermolegui.lib.helpers.AgentAdapter(item)[source]¶
Bases:
objectAdapts an agent object to a representational state for the GUI.
- class powermolegui.lib.helpers.ClientAdapter(item)[source]¶
Bases:
objectAdapts a client object to a representational state for the GUI.
- class powermolegui.lib.helpers.HostAdapter(items)[source]¶
Bases:
objectAdapts a host object to a representational state for the GUI.
- class powermolegui.lib.helpers.ItemsGenerator(main_window, configuration)[source]¶
Bases:
LoggerMixinCreates items for the components Client, Connection(s), Host(s) and Agent.
- create_canvas_items()[source]¶
Create all items and hide.
The number of host items are derived on the total amount of hosts. The ConnectionCanvasItem needs not-hidden items to create a connection_canvas_item as it uses bbox. Bbox cannot work with hidden items. Once all canvas items are created, they are hidden.
- Returns:
element 0: client - the Client is given an unique position on the X-axis.
element 1: [hosts] - each Host is given an unique position on the X-axis.
element 2: [connection] - each Connection is given its from and to destination.
element 3: agent - an Agent is a ‘child’ of the target destination host.
- Return type:
A list containing items. Each type of item has its own position
- class powermolegui.lib.helpers.SetupLink(state, transfer_agent, tunnel, bootstrap_agent, instructor, client_item, host_items, agent_item, connection_items)[source]¶
Bases:
LoggerMixinEstablishes a connection to target destination host via intermediaries by starting various objects.
This function also passes the instantiated objects to the StateManager, which will stop the Tunnel and Instructor after a KeyboardInterrupt.
- start_bootstrap_agent()[source]¶
Starts bootstrapping the agent by executing agent module on destination host.
- class powermolegui.lib.helpers.StateVisualiser(heartbeat, animated_packet, status_item)[source]¶
Bases:
objectShows the state of the encrypted tunnel by a banner and by visualising the packet flow.
powermolegui.lib.items module¶
Main code for various tkinter canvas items.
- class powermolegui.lib.items.AgentCanvasItem(main_window, client_canvas_item, host_canvas_items)[source]¶
Bases:
CanvasItemCreates a canvas item representing an Agent.
- class powermolegui.lib.items.CanvasItem(main_window)[source]¶
Bases:
ABCEnforces methods to be implemented for the subclassed objects.
- class powermolegui.lib.items.ClientCanvasItem(main_window, start_pos_x, start_pos_y)[source]¶
Bases:
CanvasItemCreates a canvas item representing a client.
- class powermolegui.lib.items.ConnectionCalculator(main_window, canvas_item_1, canvas_item_2)[source]¶
Bases:
objectCalculates all properties that is needed to render a connection between two canvas items.
- get_connection_height()[source]¶
Returns the height of a connection based on the height of the item.
- get_connection_length_inner()[source]¶
Returns the distance between two items starting from right side first item to left side second item.
- get_connection_length_outer()[source]¶
Returns the distance between two items starting from right side first item to left side second item.
- get_x_pos_connection_left_side()[source]¶
Returns the starting position on the X-axis of the connection item.
- class powermolegui.lib.items.ConnectionCanvasItem(main_window, canvas_item_1, canvas_item_2)[source]¶
Bases:
CanvasItemCreates a canvas item representing a connection.
- class powermolegui.lib.items.Effect(main_window, canvas_item, filling_type)[source]¶
Bases:
objectApplies effects to the canvas item.
This class provides methods to colour the canvas item in accordance with the operational state and provide a method to make the canvas item flicker.
- dim()[source]¶
Colours the canvas item to a non-operational state (white).
To colour the outline of ‘rectangles’, the outline has to be configured. To colour the items made of ‘lines’, the fill has to be configured.
- class powermolegui.lib.items.HostCanvasItem(main_window, start_pos_x, start_pos_y, host_ip)[source]¶
Bases:
CanvasItemCreates a canvas item representing a host.
- class powermolegui.lib.items.PacketCanvasItem(main_window, connection_canvas_items)[source]¶
Bases:
CanvasItemCreates a visualised TCP packet.
- class powermolegui.lib.items.StatusBannerCanvasItem(main_window)[source]¶
Bases:
CanvasItemCreates a status banner.
powermolegui.lib.logging module¶
Main code for logging.
- class powermolegui.lib.logging.LoggerMixin[source]¶
Bases:
objectContains a logger method for use by other classes.
- class powermolegui.lib.logging.LoggingHandler(main_window)[source]¶
Bases:
HandlerA handler for sending logging events to LoggingWindow.
Handlers send the log records (created by loggers) to the appropriate destination. In this case, it invokes the insert_log_line() of LoggingWindow and passes the filtered message (for log level INFO) to be rendered on screen in the GUI.
powermolegui.lib.windows module¶
Main code for tkinter windows.
- class powermolegui.lib.windows.CollectionMenuBars(file_menu: Menu, execution_menu: Menu, send_menu: Menu, logging_menu: Menu, quit_menu: Menu)[source]¶
Bases:
objectHolds the menu bars.
- class powermolegui.lib.windows.CommandWindow(parent, *args, **kwargs)[source]¶
Bases:
ToplevelRepresents an interface for the user to send commands to destination host and show output.
- class powermolegui.lib.windows.MainWindow(*args, **kwargs)[source]¶
Bases:
Tk,LoggerMixinRepresents the main window of an application.
In an Tkinter application, the instance of the Tk class represents the main window.
Changes the state of the menu bar.
- open_command_window()[source]¶
Opens interface for the user to send commands to last host and show output.
- retrieve_recently_opened()[source]¶
Retrieves the recently opened configuration file stored in /settings.
- stop_application()[source]¶
Sets the should_terminate var to True.
The application is running indefinitely until the user hits ctrl + c in the window. The window widget will capture the event, and sets the var should_terminate to True. The application, polling this var, will break the loop, and dismantles the tunnel.
Module contents¶
Import all parts from powermolegui.lib here.