def obtenerinterfaces(self): interf = dict() tjtdisponibles = ssh_cliente.comando('ifconfig |grep Link |grep -e ^[A-Za-z] |cut -d " " -f 1') for tjtred in tjtdisponibles: ip = ssh_cliente.comando( "ifconfig " + str(tjtred).rstrip("\n") + " | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" ) mascara = ssh_cliente.comando( "ifconfig " + str(tjtred).rstrip("\n") + " | grep -Eo 'Mask:?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" ) tipo = ssh_cliente.comando( "ifconfig " + str(tjtred).rstrip("\n") + " | grep -Eo 'encap:?([a-z]*\:[a-zA-Z]*)*'|grep -Eo '([A-Z][a-z]*)'" ) interf["" + str(tjtred).rstrip("\n") + ""] = ["" + str(ip).strip("\[]'n") + ""] interf["" + str(tjtred).rstrip("\n") + ""].append("" + str(mascara).strip("\[]'n") + "") interf["" + str(tjtred).rstrip("\n") + ""].append("" + str(tipo).strip("\[]'n") + "") print "----------**********************DEBUG********************************---------------" print interf print "----------***********************************************************---------------" return interf
def uptimestate(): #commands.getstatusoutput("uptime") #print "hola" status2 = self.builder.get_object('statusbar2') status2.push(1,""+ssh_cliente.comando("uptime")+"") threading.Timer(3,uptimestate).start() return
def uptimestate(self): # commands.getstatusoutput("uptime") # print "hola" status2 = self.builder.get_object("statusbar2") status2.push(1, "" + str(ssh_cliente.comando("uptime")).rstrip("\n") + "") threading.Timer(3, self.uptimestate).start()