To avoid the corrupted/missing output, you should call p.wait()
before trying to read the file. You don't need to use a file in this case:
from subprocess import check_output, STDOUT
network_info = check_output('ifconfig', stderr=STDOUT)
If you want to interrupt ifconfig
before it is done and read its output; see Stop reading process output in Python without hang?