Bu Kez Oldu Gibi :)
Bu Kez Oldu Gibi :)
Posted in Python, on December 9, 2011 at 20:05
Posted in Python, on December 9, 2011 at 20:05
# -*- coding: utf-8 -*-
from urllib2 import Request, urlopen, URLError
from PyQt4 import QtCore, QtGui
import sys,os
class AlintiWidget(QtGui.QListWidget):
def __init__(self, parent=None):
super(AlintiWidget, self).__init__(parent)
self.setAcceptDrops(True)
self.setIconSize(QtCore.QSize(72, 72))
def dragEnterEvent(self, event):
if event.mimeData().hasUrls:
event.accept()
else:
event.ignore()
def dragMoveEvent(self, event):
if event.mimeData().hasUrls:
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()
else:
event.ignore()
def dropEvent(self, event):
if event.mimeData().hasUrls:
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()
links = []
for url in event.mimeData().urls():
links.append(url.toLocalFile())
self.emit(QtCore.SIGNAL(\"dropped\"), links)
else:
event.ignore()
class Thr(QtCore.QThread):
def __init__(self,fonk):
QtCore.QThread.__init__(self)
self.fonk = fonk
def __del__(self):
self.wait()
def run(self):
self.fonk()
class PanelBul(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.arayuz()
def arayuz(self):
self.setMinimumSize(QtCore.QSize(450, 158))
self.setMaximumSize(QtCore.QSize(450, 158))
self.setWindowTitle(QtGui.QApplication.translate(\"MainWindow\",
\"Admin Panel Bulucu\", None, QtGui.QApplication.UnicodeUTF8))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(\"ikon.ico\"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
self.centralwidget = QtGui.QWidget(self)
self.horizontalLayout_4 = QtGui.QHBoxLayout(self.centralwidget)
self.verticalLayout_2 = QtGui.QVBoxLayout()
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.label = QtGui.QLabel(self.centralwidget)
self.label.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Site Adresi :\", None, QtGui.QApplication.UnicodeUTF8))
self.horizontalLayout_2.addWidget(self.label)
self.lineEdit = QtGui.QLineEdit(self.centralwidget)
self.horizontalLayout_2.addWidget(self.lineEdit)
self.lineEdit.setText(\"localhost\")
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.line_3 = QtGui.QFrame(self.centralwidget)
self.line_3.setFrameShape(QtGui.QFrame.HLine)
self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
self.verticalLayout_2.addWidget(self.line_3)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.pushButton = QtGui.QPushButton(self.centralwidget)
self.pushButton.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Word List\\\'i Kaydet\", None, QtGui.QApplication.UnicodeUTF8))
self.pushButton.clicked.connect(self.wlistKaydet)
self.horizontalLayout_3.addWidget(self.pushButton)
self.pushButton_2 = QtGui.QPushButton(self.centralwidget)
self.pushButton_2.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Taramaya Başla\", None, QtGui.QApplication.UnicodeUTF8))
self.horizontalLayout_3.addWidget(self.pushButton_2)
self.pushButton_2.clicked.connect(self.taramaYap)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.line = QtGui.QFrame(self.centralwidget)
self.line.setFrameShape(QtGui.QFrame.HLine)
self.line.setFrameShadow(QtGui.QFrame.Sunken)
self.verticalLayout_2.addWidget(self.line)
self.verticalLayout = QtGui.QVBoxLayout()
self.label_2 = QtGui.QLabel(self.centralwidget)
self.label_2.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Kullanacağınız Word List(ler)i Sağdaki\", None, QtGui.QApplication.UnicodeUTF8))
self.verticalLayout.addWidget(self.label_2)
self.label_3 = QtGui.QLabel(self.centralwidget)
self.label_3.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Beyaz Alana Sürükleyip Bırakın..\", None, QtGui.QApplication.UnicodeUTF8))
self.verticalLayout.addWidget(self.label_3)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.line_2 = QtGui.QFrame(self.centralwidget)
self.line_2.setFrameShape(QtGui.QFrame.HLine)
self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
self.verticalLayout_2.addWidget(self.line_2)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem)
self.progressBar = QtGui.QProgressBar(self.centralwidget)
self.progressBar.setValue(0)
self.verticalLayout_2.addWidget(self.progressBar)
self.horizontalLayout_4.addLayout(self.verticalLayout_2)
self.listWidget = AlintiWidget(self.centralwidget)
self.connect(self.listWidget, QtCore.SIGNAL(\"dropped\"), self.dosyaBirak)
self.horizontalLayout_4.addWidget(self.listWidget)
self.setCentralWidget(self.centralwidget)
self.wordlist = []
def wlistKaydet(self):
txt = \"\"
for i in self.wordlist:
txt += i + \"\\n\"
txt = txt.replace(\"\\n\\n\",\"\\n\")
isim = QtGui.QFileDialog.getSaveFileName(self, \"Kaydet\",\"admins.txt\",\"Metin Belgesi *.txt\")
try:
dos = open(isim,\"w\")
dos.write(txt)
dos.close()
except:
pass
def dosyaBirak(self, l):
for url in l:
y = QtCore.QFile(url)
if y.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text):
z = QtCore.QTextStream(y)
z = z.readAll()
txt = str(z).split(\"\\n\")
for i in txt:
if not i==\"\" and not i in self.wordlist:
self.wordlist.append(i)
QtGui.QListWidgetItem(i, self.listWidget)
self.listWidget.sortItems()
def taramaYap(self):
self.Th = Thr(self.taramaYap2)
self.Th.start()
def taramaYap2(self):
site = \"http://\"+str(self.lineEdit.text())+\"/\"
adim = x = 100/len(self.wordlist)
for i in self.wordlist:
if self.wordlist.index(i) == len(self.wordlist)-1:
self.progressBar.setValue(100)
self.label_3.setText(QtGui.QApplication.translate(\"MainWindow\",
\"Bulunamadı\", None, QtGui.QApplication.UnicodeUTF8))
else:
self.progressBar.setValue(adim)
adim += x
adres = site + i
self.label_2.setText(adres)
adresal = Request(adres)
try:
gelen_sonuc = urlopen(adresal)
except URLError, e:
pass
else:
self.label_3.setText(\"Bulundu : \"+adres)
break
if __name__ == \"__main__\":
app = QtGui.QApplication(sys.argv)
ui = PanelBul()
ui.show()
app.connect(app, QtCore.SIGNAL(\"lastWindowClosed()\"),
app, QtCore.SLOT(\"quit()\"))
app.exec_()
Share this code
Use the link below to share the code:
http://www.codesend.com/view/0dab2aa2287f3697aebac2ebe6faf81c/
HTML
<a href="http://www.codesend.com/view/0dab2aa2287f3697aebac2ebe6faf81c/">Bu Kez Oldu Gibi :)</a>
BBCode
[url=http://www.codesend.com/view/0dab2aa2287f3697aebac2ebe6faf81c/]Bu Kez Oldu Gibi :)[/url]
© 2010 CodeSend.com - send code quick and easy
Syntax highlighting by Alex Gorbatchev
Syntax highlighting by Alex Gorbatchev
