Queria hacer mi primer programa en PyQT4 y quise empezar con este simple cliente whois.
Una imagen de como quedo
(http://doddyhackman.webcindario.com/images/whoispy.jpg)
El codigo
#!usr/bin/python
#Whois Online 0.2
#Coded By Doddy H
import sys,urllib2,re
from PyQt4 import QtCore,QtGui
nave = urllib2.build_opener()
nave.add_header = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5')]
def tomar(web,vars) :
return nave.open(web,vars).read()
def whois(domain):
try:
code = tomar("http://networking.ringofsaturn.com/Tools/whois.php","domain="+domain+"&"+"submit=submit")
if (re.findall("<PRE>(.*?)<\/PRE>",code,re.S)):
found = re.findall("<PRE>(.*?)<\/PRE>",code,re.S)
resul = found[0]
resul = re.sub(""","",resul)
resul = re.sub(">>>","",resul)
resul = re.sub("<<<","",resul)
return resul
else:
return "Not Found"
except:
print "[-] Page offline\n"
def comando():
new.console.clear()
new.console.appendPlainText(whois(str(new.dom.text())))
app = QtGui.QApplication(sys.argv)
new = QtGui.QWidget()
new.setWindowTitle("Whois Online 0.2 || Coded By Doddy H")
new.resize(450,420)
new.setStyleSheet("QWidget {background-color: #000000;color: #00FF00}")
new.label1 = QtGui.QLabel("Domain : ",new)
new.label1.setStyleSheet("QWidget {background-color: #000000;color: #00FF00;font: normal 17px Verdana}")
new.label1.setGeometry(20,23,80,20)
new.dom = QtGui.QLineEdit(new)
new.dom.setStyleSheet("QWidget {background-color: #000000; color: #00FF00;border: 2px solid #00FF00}")
new.dom.setGeometry(95,23,200,25)
new.search = QtGui.QPushButton("Search",new)
new.search.setGeometry(310,22,110,28)
new.search.setStyleSheet("QWidget {background-color: #000000; color: #00FF00;border: 2px solid #00FF00}")
new.label2 = QtGui.QLabel("Console",new)
new.label2.setStyleSheet("QWidget {background-color: #000000;color: #00FF00;font: normal 17px Verdana}")
new.label2.setGeometry(200,70,70,20)
new.console = QtGui.QPlainTextEdit(new)
new.console.setGeometry(50,100,350,300)
new.console.setStyleSheet("QWidget {background-color: #000000; color: #00FF00;border: 2px solid #00FF00}")
new.connect(new.search,QtCore.SIGNAL("clicked()"),comando)
new.show()
sys.exit(app.exec_())
# The End ?
para que sirv4e
Petardas XD
es un cliente whois , sip , debi ponerle supertangas en vez de petardas , pero que desgracia xDD.