Code Monkey home page Code Monkey logo

cf-server-side-ip-picker's Introduction

CF-Server-side-IP-picker

This is a tool designed for only Iranian users, this tool will help you get best IPs for your config from ircf

Sadly I could not find main repo so if you have any link to it please inform me.

this site picks best Cloudflare IPs based on your ISP, it's obvious to all that this domain will be banned real soon which will cause issues.

A solution to this is adding a CNAME record in your dashboard however I heard multiple times that some user can not open Cloudflare dashboard however some of IPs may work. So, it triggered my mind into developing a new script which you must run it into your server.

How to use

This code will generate index.html which is basically a HTML file to preview contents on your site, this HTML file contains all IPs for specific ISP and all you need is domain so you can read it through your link.

First of all, you need to install nginx so you can run index file in your specific destination. After installing nginx execute python code in same folder and let it run, this code will update IPs each 5 minutes, all you need is visiting your domain with that specific address and get the IP from your browser.

Here's the main code:

import time
import socket
import json
import time
#Open json file create name values
f = open('domains.json')
data = json.load(f)
array = []
prefix = ["mci","mtn","mkh","rtl","ast","hwb","sht","prs","mbt","ask","rsp","afn","ztl","psm"]
Name = ["HamrahAval","Irancell","Mokhaberat","Rightel","AssiTech","HighWeb","Shatel","ParsOnline","MobinNet","AndisheSabz","Respina","Afranet","Zitel","Pishgaman"]
#Make an infinite loop to run code each 5 minutes
while(True):
    #Display tip and create name value for html file
    #Since this is for website I disable print command
    for n in range(0,13):
        Output = (prefix[n] + " = " + Name[n])
        #print(Output)
    print(" ")
    #Exctract links and ping them for IP
    for i in data['addresses']:
        response=socket.gethostbyname(i)
        print(i + " = " + response)
        array.append(i)
        
    #store data in html file to show it on website    
    r_path = (r"index.html")    
    with open (r_path , 'w') as c:
        for n in range(0,13):
            Output = ("<br>" + prefix[n] + " = " + Name[n])
            c.write(Output)
        for i in data['addresses']:
            response=socket.gethostbyname(i)
            j = (i + " = " + response)
            c.write("<br>" + j)

    #store data in text file so I can recall it if needed
    t_path = (r"fixedIPs.txt")        
    with open (t_path , 'w') as d:
        for i in data['addresses']:
            response=socket.gethostbyname(i)
            j = (i + " = " + response)
            d.write("{}\n".format(j))

    time.sleep(300)        

cf-server-side-ip-picker's People

Contributors

hoseinnikkhah avatar

Stargazers

Ali Irani avatar farhad avatar  avatar Evgeny Istratov avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.