def killportprocess(self, port): a = os.popen(admin.getAdminExec("lsof -i :" + port + " -t", UserPasswd)).read() print(a) if a == None: return "Port is not in use" else: os.system("kill " + a)
def getstatus(self, service): rawdata = os.popen(admin.getAdminExec("service " + service + " status", UserPasswd)).read() print(rawdata) if "start" in str(rawdata): print("Service is running!") return "Started" else: print("Service is stopped!") return "Stopped"
def getportprocess(self, port): pid = os.popen(admin.getAdminExec("lsof -i :" + port + " -t", UserPasswd)).read() print(pid) if pid == "": return False else: p = pid.rstrip() b = os.popen("ps -p " + p + " -o comm=").read() print(b) return b
def getstatus(self, service): rawdata = os.popen( admin.getAdminExec("service " + service + " status", UserPasswd)).read() print(rawdata) if "start" in str(rawdata): print("Service is running!") return "Started" else: print("Service is stopped!") return "Stopped"
def getportprocess(self, port): pid = os.popen( admin.getAdminExec("lsof -i :" + port + " -t", UserPasswd)).read() print(pid) if pid == "": return False else: p = pid.rstrip() b = os.popen("ps -p " + p + " -o comm=").read() print(b) return b
def getStatus(self, rp): UserPassword = rp print('Getting Status') status = os.popen(admin.getAdminExec("ufw status", UserPassword)).read() return status