HavocFramework / Havoc

The Havoc Framework.
https://havocframework.com
GNU General Public License v3.0
6.72k stars 950 forks source link

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

Closed p4p1 closed 11 months ago

p4p1 commented 11 months ago

Changed

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)