Is it possible to extract the live output from a command running in a subprocess ?
I want to use the output of a program called wifite (https://github.com/derv82/wifite) in my Script. Wifite should be run in a subprocess in my script - at a specific time wifite will output it´s scan results and update them every second (or something near that). I want to have this line of output while it runs to display on my Raspberry Pi Adafruit LCD.
So I want to do something like this:
wifite_scan = subprocess.Popen('./wifite.py', shell=True, stdout =PIPE)
wfite_scanOut= wifite_scan.communicate()
lcd.message(wifite_scanOut)
But this won't work (correct me if I´m wrong) live.
...To get the last line of this Output live on my lcd:
1 Example1 7 WPA2 58db wps
2 Example2 6 WPA2 47db no
3 Example4 7 WPA2 47db no
4 Example5 1 WPA2 31db no
[0:00:11] scanning wireless networks. 4 targets and 0 clients found
This output updates every 5 seconds, and just posts the same output with new values in the console. So I need a way to get the last line every 5 seconds in an variable.
Whats the best way to achieve live output to the lcd ?