Python Program Correction
<p>I need help I am trying to open the terminal and type ifconfig and enter then read the output on a mac then il transition this later to kali but I am getting a error with the file path to terminal and I cant start it, here is my code. </p>

<pre><code>import os,sys

#opens terminal

terminal = os.open('/Applications/Utilities/Terminal.app', os.O_RDWR|os.O_APPEND)

#writes ifconfig

os.write(terminal, 'ifconfig')

os.close(terminal)
</code></pre>

<p>I suggest you use <code>subprocess</code></p>

<pre><code>import subprocess

def popen(executable):
    sb = subprocess.Popen(
        '%s' % executable,
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        universal_newlines=True,
    )
    stdout, stderr = sb.communicate()
    return stdout, stderr, sb.returncode
</code></pre>

<p>you can pass <code>ifconfig</code> to this method and it will execute the command and return the output for you.</p>

python osx terminal filepath