Facebook
From sfdg, 3 Years ago, written in Plain Text.
This paste is a reply to sfdg from sfdg - go back
Embed
Viewing differences between sfdg and Re: sfdg
https://pastebin.com/raw/tt4si1H1import socket
import requests
from time import sleep
import traceback
from sshtunnel import SSHTunnelForwarder, create_logger
from _thread import start_new_thread
endpoint = "13.233.109.178"
endpoint2 = "13.127.237.215"
while True:
    try:
        limited = 0
        ok = []
        print ("Getting data from endpoint...") 
        req = requests.get(f"http://{endpoint}/dynuip.php?proxy_host=mybalancer.mywire.org",headers={'Cache-Control': 'no-cache'}, timeout=150).json()
        print ("resived. checking ipis...")
        ip_list = [] 
        for proxy in req:
            ip_list.append(proxy)
        ip_list = list(set(ip_list))
       # ip_list.remove('13.232.95.86')
        print(len(ip_list))
        for ip_addr in ip_list:
            if True:
                success = False
                server = SSHTunnelForwarder(
                    (ip_addr,2222),
                    ssh_username="centos",
                    ssh_password="Fatem100",
                    remote_bind_address=('127.0.0.1', 5820),
                    local_bind_address=('127.0.0.1', 5819),
                    logger=create_logger(loglevel=1)
                )
                z = 0
                while z <3:
                    z = z + 1
                    def run():
                        global success
                        server.start()
                        success = True
                        print(success)
                    start_new_thread(run, ())
                    x = 0
                    while x < 22:
                        if success:
                            print("Ip is ok ",ip_addr)
                            ok.append(ip_addr)
                            server.close()
                            break
                        else:
                            print(success)
                            sleep(0.25)
                            x += 1
                        if x == 22:
                            server.close()
                            break
                    if success:
                        break
                    elif z == 3:
                        requests.get(f"http://{endpoint}/blocked.php?proxy_host=mybalancer.mywire.org&filtered_ip={ip_addr}",headers={'Cache-Control': 'no-cache'}, timeout=150)
                        #requests.get(f"http://{endpoint2}/blocked.php?proxy_host={proxy['host']}&filtered_ip={ip_addr}",headers={'Cache-Control': 'no-cache'})
                        limited = limited + 1
                        print("limited ",ip_addr)
        requests.get(f"http://{endpoint}/all_{len(ip_list)}_ok_{len(ok)}_limited_{limited}_Asiatech",headers={'Cache-Control': 'no-cache'}, timeout=150)
        print("All : ",len(ip_list)," OK : ",len(ok)," Limited : ",limited)
        limited2 = 0
        ok2 = []
        req2 = requests.get(f"http://{endpoint2}/dynuip.php?proxy_host=mybalancer.mywire.org",headers={'Cache-Control': 'no-cache'}, timeout=150).json()
        ip_list2 = []
        for proxy2 in req2:
            ip_list2.append(proxy2)
        ip_list2 = list(set(ip_list2))
        print(len(ip_list2))
        for ip_addr in ip_list2:
            if True:
                server.close()
                success = False
                server = SSHTunnelForwarder(
                    (ip_addr,2222),
                    ssh_username="centos",
                    ssh_password="Fatem100",
                    remote_bind_address=('127.0.0.1', 8820),
                    local_bind_address=('127.0.0.1', 8821),
                    logger=create_logger(loglevel=1)
                )
                z = 0
                while z <3:
                    z = z + 1
                    def run():
                        global success
                        server.start()
                        success = True
                        print(success)
                    start_new_thread(run, ())
                    x = 0
                    while x < 12:
                        if success:
                            print("Ip is ok ",ip_addr)
                            ok2.append(ip_addr)
                            server.close()
                            break
                        else:
                            print(success)
                            sleep(0.25)
                            x += 1
                        if x == 12:
                            server.close()
                            break
                    if success:
                        break
                    elif z == 3:
                        requests.get(f"http://{endpoint2}/blocked.php?proxy_host=mybalancer.mywire.org&filtered_ip={ip_addr}",headers={'Cache-Control': 'no-cache'}, timeout=150)
                        #requests.get(f"http://{endpoint2}/blocked.php?proxy_host={proxy['host']}&filtered_ip={ip_addr}",headers={'Cache-Control': 'no-cache'})
                        limited2 = limited2 + 1
                        print("limited ",ip_addr)
               
        print("All : ",len(ip_list2)," OK : ",len(ok2)," Limited : ",limited2)
        requests.get(f"http://{endpoint2}/all_{len(ip_list2)}_ok_{len(ok2)}_limited_{limited2}_Asiatech",headers={'Cache-Control': 'no-cache'})
       # listf = json.dumps(ok)
        #requests.get(f"http://{endpoint}/ipdns.php?iplist={listf}",headers={'Cache-Control': 'no-cache'})
        #requests.get(f"http://{endpoint}/ipdns.php", data={'id_list': ['x', 'y', 'z']})
    except:
        traceback.print_exc()
        print("Retrying in 10 seconds...")
        sleep(3)
        continue
    if limited == 0:
        print("Check is done. Sleeping for 20 seconds")
        sleep(20)
    else:
        print("Check is done. Sleeping for 0 sec")
        sleep(0.2)