How to write mitmdump and kivy together

11 views
Skip to first unread message

yi tian

unread,
Sep 12, 2019, 6:05:05 AM9/12/19
to Kivy users support
I want to ask what should I do about this situation?

I use mitmdump
In the mitm.py file like this. I think this is also its main loop.

Def response(flow):
 
if flow.request.url.startswith(url):
   
pass



I run it like this, python -s mitm.py

I want to write a gui to it with kivy.
However, kivy also has its own main loop, I don't know how to write code in this case?
They all have a main loop of interest

Thank you.

Elliot Garbus

unread,
Sep 12, 2019, 1:48:29 PM9/12/19
to kivy-...@googlegroups.com

I’m not familiar with mitmdump, but I would look to create another process, launched from Kivy that runs mitmdump. 

Take a look at the concurrent programming libraries in the python standard library.  Especially, concurrent.futures or subprocesses, depending on how mitmdump operates.

I would write some code to wrap mitmdump to make it look like an iterator.  Assuming mitmdump prints out some data, I would put the data in a queue. 

From my kivy program I would have a schedule that called the wrapped mitmdump at a regular interval to get the output.  If there is no output the iterator does not return any data (just like any iterator).   If there is data present the next data element would be returned to be processed by your kivy code,

 

Hope that helps.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/9b6547c7-2143-45fb-9077-192cf3f26e53%40googlegroups.com.

 

Elliot Garbus

unread,
Sep 12, 2019, 1:57:38 PM9/12/19
to kivy-...@googlegroups.com

Took a quick look at mitmdump… looks like you could use the concept below, and simplify things have mitmdump write to a file, and have kivy read the file.

Reply all
Reply to author
Forward
0 new messages