Havoc Widget and Dialog Update

go back / p4p1


Created on Fri. 20 Oct 2023



After more discussions around havoc I had a few more ideas on what I could implement inside of the GUI python API. I've been having a lot of fun around implementing things inside of this project even thow I don't really like c++ this project has been fun to see how far I could push things.

It was discovered that I could add colors inside of labels through HTML syntax so I wanted to do the same with buttons. Changing out the style does let you make more personal widgets. With my mate Jak0b also porting Shhhloader over we discovered that Dialogs where a bit of a pain to work with if you add a lot of features so having them scroll would be nice. I also wanted to improve my little script where you could search for files.

If you didn't know that I worked on the Havoc C2 framework I recommend reading my previous three posts, I have them pinned on the right (desktop), bottom (mobile) for you. This time I added a few cute things like Image Widgets and the ability to update set Labels!

Documentation

havocui.Dialog("Title", True, 100, 100)

The Dialog class can now have predefined with and height with the last two arguments respectively. You also can set the behavior of the Dialog to allow scroll functionality through the second argument:

havocui.Widget("Title", True)

The widgets did not change much I mainly just ported from the dialog the scroll behaviour as a second argument.

havocui.Widget().addDial(dial_callback)

The main objective was to have a little dial that you can turn to get a integer value back. This was also added to the Dialog class.

          
            def dial_callback(num):
              print(num)
          
        

havocui.Widget().addSlider(dial_callback, True)

The main objective was to have a little slider that you can turn to get a integer value back you can also define if you want a vertical or horizontal one by setting true the horizontal optional argument. This was also added to the Dialog class.

          
            def dial_callback(num):
              print(num)
          
        

havoc.getlisteners()

Based on the getdemons function this will return an array of listeners so that you can pick listeners in the future for specific tasks.

How I built it

Now Implementing the scroll was a right pain for me since you can't just set QDialogs with a scroll effect on them. What you need to do is actually create a master widget inside of the dialog and then have a child widget where you will be adding your content too so that you can have that scroll functionality:

I honestly spent an entire day trying to implement that functionality it was such a pain since I had no idea what I was doing :P. The other part that tripped me up was how python classes where originally initialized I had a double call to tp_init() which would make it so that I couldn't send in more than one argument to the classes this bit was very confusing since during compile everything was fine and I thought that tp_init() needed to be there. After looking more into it I found where it was double called.


I hope you enjoyed this quick blog post do follow me on github and linkedIn to see my latest advancements in penetration testing and red team stuff. I'm actually thinking of making a email list or something of the sorts to update people on my posts more frequently. I forget to post on linkedin sometimes about my posts and I thought if I could have it synced with my RSS feed it would be quite nice.

p3ng0s
arch linux iso

A linux distribution with my entire config pre-installed. Great for learning linux and pentesting with a steep learning curve.

wiki | repo
Questions / Feedback
For any questions or feedback you can contact me on LinkedIn or twitter / X. I also use twitter as a platform to update on new posts!
Donate
sponsor me image

If you like the content of my website you can help me out by donating through my github sponsors page.