elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Código-PyQT4] Escaner de Puertos - JaAViEr | 0x5d
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Código-PyQT4] Escaner de Puertos - JaAViEr | 0x5d  (Leído 2,136 veces)
0x5d

Desconectado Desconectado

Mensajes: 241



Ver Perfil WWW
[Código-PyQT4] Escaner de Puertos - JaAViEr | 0x5d
« en: 31 Octubre 2013, 04:59 am »

Hola !

Luego de meses o quizás año sin tocar la librería QT4 de Python, hoy me quise re-encantar con dicha lib. Ya se me olvidó todo, a tal punto que tuve que re-leer el mismo tutorial que hice hace un tiempo, pero viendo algunos códigos viejos que hice, ya recordé algo :P...

(...) Sin embargo no traigo un graaaaaan código, solo es un Escaner de puertos, con algo de CSS :
Código
  1. # -*- coding: utf-8 -*-
  2. # self.setGeometry(X, Y, Width, Height)
  3.  
  4. from PyQt4 import QtGui, QtCore
  5. import sys
  6. import httplib
  7.  
  8. class programa(QtGui.QWidget):
  9.  
  10. def __init__(self, parent=None):
  11.  
  12. QtGui.QWidget.__init__(self, parent)
  13. self.setFixedSize(230, 110)
  14. self.setWindowTitle("Escaner de Puertos")
  15. self.setStyleSheet("background: #000;")
  16. # URL , LABEL URL
  17. self.url = QtGui.QLineEdit(self)
  18. self.url.setGeometry(27, 10, 200, 20)
  19. self.url.setStyleSheet("color: #fff; background: #000;")
  20. self.url_label = QtGui.QLabel("URL:", self)
  21. self.url_label.setStyleSheet("color: #fff;")
  22. self.url_label.setGeometry(3, 10, 25, 20)
  23. # PUERTO, LABEL PUERTO
  24. self.puerto = QtGui.QLineEdit(self)
  25. self.puerto.setGeometry(41, 35, 40, 20)
  26. self.puerto.setStyleSheet("color: #fff; font-weight: bold; background: #000;")
  27. self.puerto_label = QtGui.QLabel("Puerto:", self)
  28. self.puerto_label.setStyleSheet("color: #fff;")
  29. self.puerto_label.setGeometry(3, 36, 35, 20)
  30. # STATUS, LABEL STATUS
  31. self.status_label = QtGui.QLabel("Estado:", self)
  32. self.status_label.setStyleSheet("color: #fff;")
  33. self.status_label.setGeometry(3, 60, 50, 20)
  34. self.esperando = QtGui.QLabel("Esperando", self)
  35. self.esperando.setStyleSheet("color: red; font-weight: bold; background: #000;");
  36. self.esperando.setGeometry(44, 60, 100, 20)
  37. # BOTON
  38. self.boton = QtGui.QPushButton("Scan!", self)
  39. self.boton.setStyleSheet("color: #fff; background: #000; border: 2px solid #fff;")
  40. self.boton.setGeometry(3, 85, 225, 20)
  41. self.connect(self.boton, QtCore.SIGNAL("clicked()"), self.scan)
  42.  
  43. def scan(self):
  44. url = str(self.url.text())
  45. puerto = int(self.puerto.text())
  46. try:
  47. conn = httplib.HTTPConnection(url, puerto, timeout=2)
  48. BODY = "***filecontents***"
  49. conn.request("GET", "/", BODY)
  50. resp = conn.getresponse()
  51. if resp.status == 200:
  52. self.esperando.setStyleSheet("color: green; font-weight: bold")
  53. self.esperando.setText("%s Abierto" % puerto)
  54. conn.close()
  55. except:
  56. self.esperando.setStyleSheet("color: red; font-weight: bold")
  57. self.esperando.setText("%s Cerrado" % puerto)
  58. app = QtGui.QApplication(sys.argv)
  59. form = programa()
  60. form.show()
  61. app.exec_()
  62.  

Saludos !


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Código-PyQT4]Extractor de imágenes - JaAViEr(0x5d)
Scripting
0x5d 0 2,060 Último mensaje 24 Diciembre 2011, 23:22 pm
por 0x5d
[Código-PyQT4]Calculadora por secuencias - JaAViEr(0x5d)
Scripting
0x5d 2 2,847 Último mensaje 27 Diciembre 2011, 02:19 am
por 0x5d
[Código-PyQT4]All in one - JaAViEr(0x5d)
Scripting
0x5d 0 2,006 Último mensaje 11 Febrero 2012, 05:11 am
por 0x5d
[Código-PyQT4]Detectar campos de un formulario web - JaAViEr|0x5d
Scripting
0x5d 5 3,461 Último mensaje 9 Abril 2012, 19:39 pm
por Runex
[Código-PyQT4] IconFinder - JaAViEr | 0x5d
Scripting
0x5d 0 3,467 Último mensaje 31 Octubre 2013, 12:01 pm
por 0x5d
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines