I wrote a python program for Kali Linux GONE 64 (Debian 7) . I wrote it so it would run the metasploit database with the commands below. The problem is that i opens all of these commands in different shells. I want to run them all one by one in one shell. How do i do this in python?
import os
os.system("service postgresql start")
os.system("wait")
os.system("service metasploit start")
os.system("wait")
os.system("armitage")
Sukrit Kalra
34.7k7 gold badges73 silver badges71 bronze badges
2 Answers 2
import subprocess
subprocess.call("service postgresql start ; wait ; service metasploit start ; wait ; armitagedate", shell=True)
answered Jan 5, 2014 at 20:05
John1024
115k15 gold badges152 silver badges183 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
If you don't want putting this into a separate script file, open /bin/sh in a subprocess and feed these commands to its stdin, line by line. You can also pass any parameters this way, if properly quoted.
answered Jan 5, 2014 at 19:51
Netch
4,6221 gold badge23 silver badges37 bronze badges
Comments
lang-py
waitto do? (It probably isn't what you think it does.)