Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 7 Octubre 2011, 01:32 am



Título: [Python] Console By Doddy H
Publicado por: BigBear en 7 Octubre 2011, 01:32 am
Bueno este es un simple ejecutor de comandos hecho en tk

Código
  1.  
  2. #!usr/bin/python
  3. #Console (C) Doddy Hackman 2011
  4.  
  5. from Tkinter import *
  6. import subprocess
  7.  
  8. global x
  9.  
  10. def execa() :
  11.  re = subprocess.Popen(cmd.get(),shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
  12.  if re:
  13.   panel.insert(END,re.stdout.read())
  14.  else:
  15.   panel.insert(END,re.stderr.read())
  16.  
  17.  
  18. window = Tk()
  19. window.title("Console (C) Doddy Hackman 2011")
  20.  
  21. window.maxsize(width="400",height="320")
  22. window.minsize(width="400",height="320")
  23.  
  24. window.configure(background="black")
  25. window.configure(cursor="tcross")
  26.  
  27. cmd = StringVar()
  28. panel = Text(window,width=30,height=15,bg="black",fg="green")
  29.  
  30. Label(window,bg="black").grid(row=1)
  31. Label(window,text="Command : ",bg="black",fg="green").grid(row=3,column=4)
  32.  
  33. entry = Entry(window,width=35,textvariable=cmd,bg="black",fg="green").grid(row=3,column=5)
  34.  
  35. Button(text="Cargar",bg="black",fg="green",activebackground="green",command=execa).grid(row=3,column=9)
  36.  
  37.  
  38. Label(window,bg="black").grid(row=4)
  39. panel.grid(row=10,column=5)
  40.  
  41.  
  42. window.mainloop()
  43.