Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworked widget code structure added progress dialog, colorpicker dialog, Logs Widget #412

Merged
merged 11 commits into from
Oct 17, 2023

Conversation

p4p1
Copy link
Contributor

@p4p1 p4p1 commented Oct 17, 2023

Changed

  • Moved Havocui code to /UI/ folder to prevent to many files inside of Python API

Added

  • havocui.progressdialog -> function to have a progress bar dialog
  • havocui.colordialog -> Choose colors and get hex output with color dialog
  • havoui.Widget()
    • Widget.clear() -> remove all of the buttons labels present in a widget
    • Widget.addImage('path/to/img') -> Displays an image in the widget
    • Widget.replaceLabel("to find", "replace with") -> Provided the text of a label it will find the label and replace the text
  • havoui.Dialog()
    • Dialog.clear() -> remove all of the buttons labels present in a dialog
    • Dialog.addImage('path/to/img') -> Added image to dialogs
    • Dialog.replaceLabel("to find", "replace with") -> Provided the text of a label it will find the label and replace the text
  • havocui.Logger("title") -> A widget to store logs
    • Logger.setSmallTab() -> set the log output as a small tab
    • Logger.setBottomTab() -> set the logger as bottomtab
    • Logger.addText("teext HTML") -> Will add text to the logger tab
    • Logger.clear() -> Will clear the logger tab

screenshots

new logger with HTML support

image

color picker

image

progress dialog

image

added image support to dialogs

image

added image support to widgets

image

sample code to test with

import havocui

a = 0

logs = havocui.Logger("output will be here")
abc = havocui.Widget("mdrrr")
img_text = havocui.Dialog("test-img")

img_text.addImage("/path/to/image.png")
def open_dialog():
    img_text.exec()

def nuke():
    abc.clear()
def replace():
    abc.replaceLabel("I will delete myself!", "Oh what is this dynamic stuff")
def add_to_logs():
    print("here")
    logs.addText("abcdef\nghijklmn\nopqrstuv\nwxyz")
    logs.addText("<h1><span style=\"color:#8be0fd\">fjklafdjaslk</span></h1>")
abc.addImage("/path/to/image.png")
abc.addLabel("I will delete myself!")
abc.addButton("new logs", add_to_logs)
abc.addButton("replace the text...", replace)
abc.addButton("delete widget...", nuke)
abc.setSmallTab()

def callback():
    global a
    a += 1
    print("hello", a)
    if a > 100:
        print("now should close")
        a = -1
    return a

def call_logger():
    logs.setBottomTab()

def call_progress_dialog():
    havocui.progressdialog("Title", "close me", callback, 100)

def call_colorpicker():
    print(havocui.colordialog())

havocui.createtab("new stuff", "progress dialog", call_progress_dialog, "color picker", call_colorpicker, "logger", call_logger, "dialog img", open_dialog)

@S4ntiagoP S4ntiagoP merged commit f9261c6 into HavocFramework:dev Oct 17, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants