chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


How to Make a Cloudflare Resolver filter_list
Author
Message
How to Make a Cloudflare Resolver #1
Basically, we have a list of subdomains that our resolver checks, then returns their IP.



There's only a single import, the socket module. This allows us to resolve the IPs. We'll need to define our subdomain list, and be able to request the site from the user.

Code:
import socket
site = raw_input("URL: ") #Request a site to resolve from the user
main = socket.gethostbyname(site) #Find the main website's IP.
subdomains = ['mail.','direct.','cpanel.','ftp.','email.','server.','status.','forum.','portal.','beta.','admin.','webmail.','imap.','pop.','ssl.','blog.','m.'] #List of subdomains to check.

Now, all we have to do left is check each subdomain. We can do so by using a for statement, you know, for x in y: return z? Something like that. We'll have an exception catcher just in-case this fails, but not just one. We want to pass our second exception because we would get an error while looking at the (sub)domain.

Code:
try: #Try to find the IPs
    for sub in subdomains: #Grab each subdomain within our list.
        try: #Try to parse our site IP
            x = socket.gethostbyname(sub+site) #Check the subdomain on the site.
            print(sub.upper()+site+': '+x) #Return the subdomain, site, and IP address IF found.
        except: pass #Ignore all subdomains that aren't found.
except Exception as e: print e #Catch the error if it fails.

Simple enough right?



Code:
import socket
site = raw_input("URL: ") #Request a site to resolve from the user
main = socket.gethostbyname(site) #Find the main website's IP.
subdomains = ['mail.','direct.','cpanel.','ftp.','email.','server.','status.','forum.','portal.','beta.','admin.','webmail.','imap.','pop.','ssl.','blog.','m.'] #List of subdomains to check.
try: #Try to find the IPs
    for sub in subdomains: #Grab each subdomain within our list.
        try: #Try to parse our site IP
            x = socket.gethostbyname(sub+site) #Check the subdomain on the site.
            print(sub.upper()+site+': '+x) #Return the subdomain, site, and IP address IF found.
        except: pass #Ignore all subdomains that aren't found.
except Exception as e: print e #Catch the error if it fails.



Hope I was of any use. (Note; this was tested against SL and my personal website. It should work perfectly fine, PM me if you need help)

~ Duubz

Reply






Users browsing this thread: 1 Guest(s)