Konuyu Oyla:
  • Toplam: 0 Oy - Ortalama: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Python Tkinter ile Proxy tarama kodu
#1
Pc bölümündeki ProxyChecker.exe uygulamasının kodudur. Programı geliştirmek isteyenler editleyip pyinstaller ile tekrar derleme yapabilirler. Örnek Tkinter ile ilgili örnek bir konu olsun diye vermek istedim. Ama pc'den python ile çalıştırmak isteyenler içerisindeki bazı Tkinter ek modülleri yüklemelidir. Zaten çalıştırılınca eksik modüller konsolda karşınıza çıkacaktır. Tabiki de bu geliştirme aşamasına gelenler için bir örnektir.

PHP Kod:
# -*- coding: utf-8 -*-


from Tkinter import *
from tkMessageBox import *
from tkFileDialog import askopenfilename
import ImageTk
import wckToolTips
import tkMessageBox
import os
import sys
import httplib
import urllib2
import time
from contextlib import closing
from random import shuffle
import re
threading
import win32clipboard


pencere4
=Tk()
pencere4.title("Python Proxy Tarama")
#pencere4.transient(pencere)
pencere4.resizable(width=FALSEheight=FALSE)
pgen 400
pyuks 
400
ekrangen 
pencere4.winfo_screenwidth()
= (ekrangen pgen) / 2
pencere4
.geometry("%dx%d+%d+%d"%(pgenpyuksx70))    
liste Listbox(pencere4font="DejaVuSans 12")
liste.pack(side=LEFT,fil=BOTHexpand=1)
    
try:
    for 
i in open("ProxyListe.txt").read().split("\n"):
        
liste.insert(ENDi)
except:
    
open("ProxyListe.txt","w").close()
liste.delete(END0)
###################### PROXY TARAMA FONKSIYONLARI (sabit) ################################
tbl = []                                                                                ##
ValidIPRegex '(\d+\.\d+\.\d+\.\d+).*?(\d{2,5})'                                        ##
tekrarsayisi 1                                                                        ##
maxthreads 200                                                                        ##                                                                
LOADURL 'http://plai.de'                                                                ##                                                            
time_out 3                                                                            ##
network True                                                                            ##
                                                                                        ##                                                                                
def wtf(yaz):                                                                            ##    
    
liste.insert(ENDyaz)                                                                ##
def is_OK(ip):                                                                            ##    
    
global network                                                                        ##        
    
try:                                                                                ##    
        
proxy_handler urllib2.ProxyHandler({'http'ip})                                ##
        
opener urllib2.build_opener(proxy_handler)                                    ##
        
urllib2.install_opener(opener)                                                    ##        
        
req urllib2.Request(LOADURL)                                                    ##
        
time.time()                                                                    ##
        
res urllib2.urlopen(reqtimeout=time_out)                                    ##
        
t2 time.time() - t                                                            ##
        
if res.read() == 'NOthing\n':                                                    ##
            
print ip'çalışıyor't2'saniye'                                            ##
            
wtf(ip)                                                                        ##
        
else:                                                                            ##
            
print ip'proxy gereken cevabı yollamadı, atlanıyor.'                        ##
        
network True                                                                    ##        
    
except Exception as e:                                                                ##
        
if str(e) == '<urlopen error [Errno 101] Network is unreachable>':                ##                            
            
print 'Ağ hatası, 1 saniye sonra tekrar denenecek'                            ##
            
network False                                                                ##
            
time.sleep(1)                                                                ##
            
is_OK(ip)                                                                    ##
        
else:                                                                            ##
            
network True                                                                ##
                                                                                        ##
def baslat():                                                                            ##        
    
sayac 0                                                                            ##    
    
while sayac tekrarsayisi:                                                            ##
        
print str(sayac 1) + '. deneme başlatıldı'                                    ##        
        
for x in tbl:                                                                    ##
            
while not network:                                                            ##
                
time.sleep(1)                                                            ##
            
while threading.activeCount() >= maxthreads:                                ##            
                
time.sleep(0.1)                                                            ##
            
threading.Thread(target=is_OK,args=(x,)).start()                            ##
        
sayac sayac 1                                                                 ##
                                                                                        ##        
##########################################################################################        
def proxyrox():
    try:
        
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
        
oku urllib2.urlopen("http://www.sslproxies.org/").read()
        
liste.insert(END,"Top Proxies")
        
sayi len(liste.get(0END))
        
clp oku.replace(' '':')
        
clp2 re.findall(ValidIPRegexclp)
        for 
x in clp2:
            
x[0] + ':' x[1]
            if 
not a in tbl:
                
tbl.append(a)    
        
baslat()
        
time.sleep(4)
        
tbl[0:] = []
        if 
len(liste.get(0END)) == sayi:
            
showinfo("hata","Çalışan proxy bulunamadı.")
        else:
            print 
"Tamamdir moruk."
    
except:
        
showerror("hata","internet bağlantısı yok!")
    
def gather():
    
pencere6 Toplevel()
    
pencere6.title("GatherProxy Menu")
    
pencere6.transient(pencere4)
    
pencere6.resizable(width=FALSEheight=FALSE)
    
pgen 300
    pyuks 
200
    ekrangen 
pencere4.winfo_screenwidth()
    
= (ekrangen pgen) / 2
    pencere6
.geometry("%dx%d+%d+%d"%(pgenpyuksx70))
    
gport = ["3128","8080","80"]
    
country = []        
    
def tara():
        try:
            if 
v.get() == and y.get() == and z.get() == 0:
                
showwarning("Uyari","En Az Bir Port Secmelisiniz!")
            else:
                
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
                
oku urllib2.urlopen("http://gatherproxy.com/proxylist/country/?c="+country[0]).read()
                
liste.insert(END,country[0])
                
country[0:] = []
                
sayi len(liste.get(0END))
                
clp oku.replace(' '':')
                
clp2 re.findall(ValidIPRegexclp)    
                for 
x in clp2:
                    for 
i in gport:
                        
x[0] + ':' i
                        
if not a in tbl:
                            
tbl.append(a)    
                
baslat()
                
time.sleep(4)
                
tbl[0:] = []
                if 
len(liste.get(0END)) == sayi:
                    
showinfo("hata","Çalışan proxy bulunamadı.")
                    
liste.delete(END,0)
                else:
                    print 
"Tamamdir moruk."
                
pencere6.destroy()
        
except:
            
showerror("hata","internet bağlantısı yok!")
            
pencere6.destroy()
    
def turkey():
        
country.append("Turkey")
        
tara()
    
def germany():
        
country.append("Germany")
        
tara()
    
def france():
        
country.append("France")
        
tara()
    
def netherlands():
        
country.append("Netherlands")
        
tara()
    
def vport():
        if 
v.get() == 1:
            
gport.append("3128")
        else:
            
gport.remove("3128")
    
def yport():
        if 
y.get() == 1:
            
gport.append("8080")
        else:
            
gport.remove("8080")
    
def zport():
        if 
z.get() == 1:
            
gport.append("80")
        else:
            
gport.remove("80")            
    
v=IntVar()
    
v.set(1)
    
y=IntVar()
    
y.set(1)
    
z=IntVar()
    
z.set(1)
    
TR Button(pencere6text="Turkey"width=23,font="bold",command=turkey).pack(pady=5)
    
DE Button(pencere6text="Germany"width=23font="bold",command=germany).pack(pady=5)
    
FR Button(pencere6text="France"width=23font="bold",command=france).pack(pady=5)
    
NL Button(pencere6text="Netherlands"width=23font="bold",command=netherlands).pack(pady=5)
    
port1 Checkbutton(pencere6,text="3128",variable=v,command=vport).pack(side=LEFT,padx=40)
    
port2 Checkbutton(pencere6,text="8080",variable=y,command=yport).pack(side=LEFT)
    
port3 Checkbutton(pencere6,text="80",variable=z,command=zport).pack(side=LEFT,padx=40)

def pnova():
    
pencere7 Toplevel()
    
pencere7.title("ProxyNova Menu")
    
pencere7.transient(pencere4)
    
pencere7.resizable(width=FALSEheight=FALSE)
    
pgen 300
    pyuks 
200
    ekrangen 
pencere4.winfo_screenwidth()
    
= (ekrangen pgen) / 2
    pencere7
.geometry("%dx%d+%d+%d"%(pgenpyuksx70))
    
gport = ["3128","8080","80"]
    
country = []        
    
def tara():
        try:
            if 
v.get() == and y.get() == and z.get() == 0:
                
showwarning("Uyari","En Az Bir Port Secmelisiniz!")
            else:
                
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
                
oku urllib2.urlopen("http://www.proxynova.com/proxy-server-list/country-"+country[0]).read()
                
liste.insert(END,country[0])
                
country[0:] = []
                
sayi len(liste.get(0END))
                
clp re.findall('>(\d+\.\d+\.\d+\.\d+)<'oku)
                for 
x in clp:
                    for 
i in gport:
                        
':' i
                        
if not a in tbl:
                            
tbl.append(a)    
                
baslat()
                
time.sleep(4)
                
tbl[0:] = []
                if 
len(liste.get(0END)) == sayi:
                    
showinfo("hata","Çalışan proxy bulunamadı.")
                    
liste.delete(END,0)
                else:
                    print 
"Tamamdir moruk."
                
pencere7.destroy()
        
except:
            
showerror("hata","internet bağlantısı yok!")
            
pencere7.destroy()
    
def turkey():
        
country.append("tr")
        
tara()
    
def germany():
        
country.append("de")
        
tara()
    
def france():
        
country.append("fr")
        
tara()
    
def netherlands():
        
country.append("nl")
        
tara()
    
def vport():
        if 
v.get() == 1:
            
gport.append("3128")
        else:
            
gport.remove("3128")
    
def yport():
        if 
y.get() == 1:
            
gport.append("8080")
        else:
            
gport.remove("8080")
    
def zport():
        if 
z.get() == 1:
            
gport.append("80")
        else:
            
gport.remove("80")            
    
v=IntVar()
    
v.set(1)
    
y=IntVar()
    
y.set(1)
    
z=IntVar()
    
z.set(1)
    
TR Button(pencere7text="Turkey"width=23,font="bold",command=turkey).pack(pady=5)
    
DE Button(pencere7text="Germany"width=23font="bold",command=germany).pack(pady=5)
    
FR Button(pencere7text="France"width=23font="bold",command=france).pack(pady=5)
    
NL Button(pencere7text="Netherlands"width=23font="bold",command=netherlands).pack(pady=5)
    
port1 Checkbutton(pencere7,text="3128",variable=v,command=vport).pack(side=LEFT,padx=40)
    
port2 Checkbutton(pencere7,text="8080",variable=y,command=yport).pack(side=LEFT)
    
port3 Checkbutton(pencere7,text="80",variable=z,command=zport).pack(side=LEFT,padx=40)
    
def manuel():
    
pencere5 Toplevel()
    
pencere5.title("Manuel Tarama")
    
pencere5.transient(pencere4)
    
pencere5.resizable(width=FALSEheight=FALSE)
    
pgen 400
    pyuks 
400
    ekrangen 
pencere4.winfo_screenwidth()
    
= (ekrangen pgen) / 2
    pencere5
.geometry("%dx%d+%d+%d"%(pgenpyuksx70))
    
def ypstr():
        
win32clipboard.OpenClipboard()
        List.
insert(ENDwin32clipboard.GetClipboardData())
        
win32clipboard.CloseClipboard()
    
def mtara():
        
sayi len(liste.get(0END))
        
= List.get(0.0END)
        
L2 re.findall(ValidIPRegexL)
        for 
i in L2:
            
i[0]+':'+i[1]
            if 
not a in tbl:
                
tbl.append(a)
        
baslat()
        
time.sleep(4)
        
tbl[0:] = []
        if 
len(liste.get(0END)) == sayi:
            
showerror("hata","calisan proxy bulunamadi veya baglanti kurulamadi.")
        else:
            
showinfo("Bilgi","Calisan proxy'ler listeye eklenmistir.")
        
pencere5.destroy()
    
def sil():
        List.
delete(0.0END)
    
def bilgi():
        
showinfo("Bilgi""Kopyaladiginiz proxy iceren text sayfasini 'Yapistir' butonu ile yapistirin "
                 "ve ardindan 'Listeyi Tara' butonuna basin. Ayrica bu islemi yaparken listedeki proxylerin "
                 "düzgün yerlestirilmesine gerek yoktur."
)

    
kaydirma Scrollbar(pencere5)
    
kaydirma.pack(side=LEFTfill=Y)        
    List = 
Text(pencere5yscrollcommand=kaydirma.setwidth=20)
    List.
pack(side=LEFTfil=BOTHexpand=1)
    
kaydirma.config(command=List.yview)
    
Paste Button(pencere5text="Yapistir"command=ypstrwidth=15).pack()
    
ListeTara Button(pencere5text="Listeyi Tara"command=mtarawidth=15)
    
ListeTara.pack(pady=1)
    
ListeSil Button(pencere5text="Listeyi Sil",command=silwidth=15)
    
ListeSil.pack()
    
bilgi Button(pencere5,text="Kullanim?"command=bilgiwidth=15).pack(side=BOTTOM)
def kopyall():    
    
pencere4.clipboard_clear()
    for 
i in liste.get(0,END):
        
pencere4.clipboard_append(i+"\n")
def temizle():
    
liste.delete(0END)
def kayit():
    
dosya open("ProxyListe.txt","w")
    
dosya.close()
    for 
i in liste.get(0END):
        
open("ProxyListe.txt","ab")
        
y.write(i+"\n")
        
y.close()
    
showinfo("Bilgi","'ProxyListe.txt' dosyasına kaydedildi.")
def gosterici(event):
    
pencere8 Toplevel()
    
pencere8.title("İşlem Seçıniniz")
    
pencere8.transient(pencere4)
    
pencere8.resizable(width=FALSEheight=FALSE)
    
pgen 250
    pyuks 
90
    ekrangen 
pencere4.winfo_screenwidth()
    
= (ekrangen pgen) / 2
    pencere8
.geometry("%dx%d+%d+%d"%(pgenpyuksx,100))
    
def sil():
        
liste.delete(ACTIVE)
        
pencere8.destroy()
    
def kopya():
        
pencere8.clipboard_clear()
        
pencere8.clipboard_append(liste.get(ACTIVE))
        
pencere8.destroy()

    
psil Button(pencere8text="Sil",command=sil,width=23,font="bold").pack(pady=6)
    
kopyala Button(pencere8text="Kopyala",command=kopya,width=23,font="bold").pack(pady=6)
liste["relief"] = "raised"
liste.bind("<Double-Button-1>"gosterici)        
tara Button(pencere4text="SSLproxies.org"command=proxyroxwidth=17height=2,font="dejaVuSans 12 bold").pack()
tara2 Button(pencere4text="GatherProxy.com"command=gatherwidth=17,height=2font="dejaVuSans 12 bold").pack()
tara3 Button(pencere4text="ProxyNova.com"command=pnovawidth=17,height=2font="dejaVuSans 12 bold").pack()
ManuelTara Button(pencere4text="Manuel Tarama"command=manuelwidth=19,height=2font="bold").pack()
info Label(pencere4text="\n\nDeveloped by\n gecemor",font="Arial 7 italic").pack()
kaydet Button(pencere4text="Kaydet"command=kayitwidth=19height=2,font="bold"fg="white",bg="green").pack(side=BOTTOM)
ListeTemizle Button(pencere4text="Listeyi Temizle"command=temizlewidth=19,height=1font="bold",fg="red").pack(side=BOTTOM)
kopyalafull Button(pencere4text="Listeyi Kopyala",command=kopyall,width=19,height=1,font="bold",fg="blue").pack(side=BOTTOM,padx=4)

mainloop() 
Turbobit Premium Link Çeviri | Turbobit Link Generator | http://turbobit.qpython.club
Cevapla
#2
Eyvallah
Ara
Cevapla

{lang: 'en'}


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  YENİ Python Browser v1.0 [Sertifika Uyarısı Yok, Youtube Video Izleme] Ethnic 30 23,223 24-06-2018, Saat: 22:42
Son Yorum: Ethnic
  YENİ Proxy Kivy gecemor 150 102,898 03-03-2017, Saat: 13:15
Son Yorum: Ethnic
  GÜNCEL Python tkinter ile proxy tarama gecemor 73 58,567 12-02-2017, Saat: 16:42
Son Yorum: gecemor
  GÜNCEL Forum Python v5.1 [Final] Ethnic 94 71,216 14-11-2016, Saat: 16:48
Son Yorum: Sheytan
  GÜNCEL Forum Python Kodları v2.0 Ethnic 69 53,187 12-11-2016, Saat: 23:40
Son Yorum: iLLeGaLTeam1

Hızlı Menü:


Konuyu Okuyanlar: 1 Ziyaretçi
Change Theme