#-*-coding:utf8;-*-
#qpy:2
#qpy:console
import threading
import time, re
import androidhelper
import urllib2
print "\033[94m'QPYTHON.NET' Proxy Tarama & Hız Testi\x1b[m"
### BURAYA HOSTU YAZIN ###
CUSTOM_HOST ="wos.turkcell.com.tr"
##########################
d=androidhelper.Android()
islem=["SSLProxies.org","GatherProxy.com","Spys.ru","Pano Tarama"]
########## PROXY TARAMA FONKSIYONLARI ############
def wtf(yaz, boy):
dosya=open("/sdcard/proxylist.txt","ab")
dosya.write(yaz+" "+boy+"\n")
dosya.close()
def speed(ip):
try:
proxy_handler = urllib2.ProxyHandler({'http': ip})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
a=urllib2.Request(test_url)
a.add_header("Host", CUSTOM_HOST)
a=urllib2.urlopen(a, timeout=4)
t=time.time()
sayi=0
try:
print "bekleyin.."
while True:
c=a.read(1024*32)
if not c: break
sayi+=1024*32
if time.time()-t>5: break
son=time.time()-t
if sayi/float(son)/1000000 > 1:
mb = str(sayi/float(son)/1000000)[:4]+" MByte/Sn"
print ip, mb
wtf(ip, mb)
else:
kb = str(sayi/float(son)/1000).split(".")[0]+" KByte/Sn"
print ip, kb
wtf(ip, kb)
except:
pass
except:
pass
test_url="http://nfhost.net/~qpython/test.rar"
test_proxy = []
zaman=time.ctime()
tbl = []
ValidIPRegex = '(\d+\.\d+\.\d+\.\d+).*?(\d{2,5})'
tekrarsayisi = 1
maxthreads = 100
LOADURL = 'http://ip.jsontest.com'
time_out = 3
network = True
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)
req.add_header("Host",CUSTOM_HOST)
t = time.time()
res = urllib2.urlopen(req, timeout=time_out)
t2 = time.time() - t
if res.read().find('{"ip":') > -1:
print ip, 'çalışıyor', t2, 'saniye'
test_proxy.append(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 "\033[94m"+str(sayac + 1) + '. Tarama başlatıldı\x1b[m'
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 webproxy(url):
a=urllib2.Request("http://"+CUSTOM_HOST+"/surf/printer.php?u="+urllib2.quote(url)+"&b=20")
a.add_header("User-Agent","")
a.set_proxy("webproxy.at:80","http")
a.add_header("Host",CUSTOM_HOST)
a.add_header("Referer","http://"+CUSTOM_HOST+"/surf/")
return urllib2.urlopen(a).read()
def ssl():
try:
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
print "\033[92mTarama yapılacak...\x1b[m"
oku = webproxy("http://www.sslproxies.org/")
clp = oku.replace(' ', ':')
clp2 = re.findall(ValidIPRegex, clp)
for x in clp2:
a = x[0] + ':' + x[1]
if not a in tbl:
tbl.append(a)
baslat()
time.sleep(4)
except:
print "\ninternet baglantisi yok!\n"
d.makeToast("internet bağlantısı yok")
def gather():
def tara():
gport = ["3128","8080","80"]
d.dialogCreateAlert("port seçin")
d.dialogSetMultiChoiceItems(gport)
d.dialogSetPositiveButtonText("Tamam")
d.dialogShow()
sonuc=d.dialogGetResponse().result
rp = d.dialogGetSelectedItems().result
if rp == []:
d.makeToast("En az bir port seçmelisiniz!")
tara()
else:
try:
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
oku = webproxy("http://gatherproxy.com/proxylist/country/?c="+country[rc])
clp = oku.replace(' ', ':')
clp2 = re.findall(ValidIPRegex, clp)
for x in clp2:
for i in rp:
a = x[0] + ':' + gport[i]
if not a in tbl:
tbl.append(a)
baslat()
time.sleep(4)
except:
print "\nbağlantı yok."
d.makeToast("internet yok.")
country = ["Turkey","Germany","France","Netherlands"]
d.dialogCreateAlert("ülke seçin")
d.dialogSetSingleChoiceItems(country)
d.dialogSetPositiveButtonText("Tamam")
d.dialogShow()
sonuc=d.dialogGetResponse().result
rc = d.dialogGetSelectedItems().result[0]
print "\033[92m"+country[rc]+" seçildi.\x1b[m"
dosya=open("/sdcard/proxylist.txt","ab")
dosya.write("-"+country[rc]+"-"+"\n")
dosya.close()
tara()
def spysru():
def tara():
gport = ["3128","8080","80"]
d.dialogCreateAlert("port seçin")
d.dialogSetMultiChoiceItems(gport)
d.dialogSetPositiveButtonText("Tamam")
d.dialogShow()
sonuc=d.dialogGetResponse().result
rp = d.dialogGetSelectedItems().result
if rp == []:
d.makeToast("En az bir port seçmelisiniz!")
tara()
else:
try:
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler({})))
oku = webproxy("http://spys.ru/free-proxy-list/"+country[rc]+"/")
clp = re.findall('>(\d+\.\d+\.\d+\.\d+)<', oku)
for x in clp:
for i in rp:
a = x + ':' + gport[i]
if not a in tbl:
tbl.append(a)
baslat()
time.sleep(4)
except:
print "\nbağlantı yok."
d.makeToast("internet yok.")
ulke = ["Turkey","Germany","France","Netherlands"]
country = ["TR","DE","FR","NL"]
d.dialogCreateAlert("ülke seçin")
d.dialogSetSingleChoiceItems(ulke)
d.dialogSetPositiveButtonText("Tamam")
d.dialogShow()
d.dialogGetResponse().result
rc = d.dialogGetSelectedItems().result[0]
print "\033[92m"+ulke[rc]+" seçildi.\x1b[m"
dosya=open("/sdcard/proxylist.txt","ab")
dosya.write("-"+ulke[rc]+"-"+"\n")
dosya.close()
tara()
def manuel():
dosya=open("/sdcard/proxylist.txt","ab")
dosya.write("-Pano-\n")
dosya.close()
try:
print "\033[92mPanoya için tarama yapılacak...\x1b[m"
p = d.getClipboard().result
ara = re.findall(ValidIPRegex, p)
for i in ara:
a = i[0]+':'+i[1]
if not a in tbl:
tbl.append(a)
baslat()
time.sleep(4)
d.makeToast("Proxyler, /sdcard/proxylist.txt dosyasına kaydedildi.")
except:
print "\nbağlantı yok."
d.makeToast("internet yok.")
d.dialogCreateAlert("işlem seçin")
d.dialogSetSingleChoiceItems(islem)
d.dialogSetPositiveButtonText("Tamam")
d.dialogShow()
sonuc=d.dialogGetResponse().result
r = d.dialogGetSelectedItems().result[0]
print islem[r]
dosya=open("/sdcard/proxylist.txt","ab")
dosya.write("\n#######"+zaman+"#######\n"+islem[r]+"\n")
dosya.close()
if islem[r] == islem[0]:
ssl()
if islem[r] == islem[1]:
gather()
if islem[r] == islem[2]:
spysru()
if islem[r] == islem[3]:
manuel()
time.sleep(2)
print "\nHiz Testi Baslatiliyor, lutfen bekleyiniz...\n"
for i in test_proxy:
speed(i)
Bu speedtest proxy tarama kodu internet baglantisi yok hatasi veriyor bunu düzeltecek kimse varmidir acaba çok gerekli benim için , şimdiden teşekkürler