🐍 Python Share ko lang HTTP STATUS CHECKER

medyo nag balik ulit ako sa study ng cybersecurity and tada medyo may maliit akong project nag chi check ng status code pero basta kung programmer ka alam nyo na yang status code hahahaa

up to three input nga lang sya pwede nyo na rin kunin ang code at i improved ito hehee

basic code lang to at pang mini project sa cybersecurity...pwede nyo din yan dagdagan ng validation
Python:
import pycurl
from io import BytesIO

first_website = input("Please input First Website: ")
second_website = input("Pleases input Second Website: ")
third_website = input("Please input Third Website: ")
domain_list = domains = [
    ".net",
    ".org",
    ".com",
    ".app",
    ".dev",
    ".ai",
    ".io",
    ".co",
    ".xyz",
    ".online",
    ".store",
    ".shop",
    ".site",
    ".tech",
    ".cloud",
    ".blog",
    ".news",
    ".media",
    ".live",
    ".space",
    ".world",
    ".digital",
    ".design",
    ".email",
    ".finance",
    ".fund",
    ".group",
    ".company",
    ".solutions",
    ".services",
    ".support",
    ".systems",
    ".team",
    ".tools",
    ".training",
    ".academy",
    ".school",
    ".education",
    ".events",
    ".gallery",
    ".photos",
    ".photography",
    ".video",
    ".watch",
    ".stream",
    ".games",
    ".game",
    ".music",
    ".audio",
    ".chat",
    ".social",
    ".network",
    ".community",
    ".club",
    ".center",
    ".city",
    ".land",
    ".house",
    ".home",
    ".life",
    ".today",
    ".one",
    ".plus",
    ".vip",
    ".top",
    ".win",
    ".fun",
    ".cool",
    ".zone",
    ".expert",
    ".global",
    ".green",
    ".energy",
    ".engineering",
    ".software",
    ".codes",
    ".law",
    ".legal",
    ".doctor",
    ".dental",
    ".clinic",
    ".health",
    ".care",
    ".fitness",
    ".restaurant",
    ".cafe",
    ".coffee",
    ".bar",
    ".pizza",
    ".tax",
    ".accountant",
    ".insurance",
    ".loan",
    ".bank",
    ".credit"
]
run = {}



first_domain =  first_website[first_website.rfind("."):]

if first_domain in domain_list:
    run[0] = "T"
else:
    run[0] = "F"

second_domain = second_website[second_website.rfind("."):]

if second_domain in domain_list:
    run[1] = "T"
else:
    run[1] = "F"

third_domain = third_website[third_website.rfind("."):]

if third_domain in domain_list:
    run[2] = "T"
else:
    run[2] = "F"

print()
print()

for x in range (0,len(run)):
        letter = run[x]
        buffer = BytesIO()

        website = None
        if x == 0:
            website = first_website
        elif x == 1:
            website = second_website
        else:
            website = third_website

        if letter == "T":
            checksite = None
            if x == 0:
                checksite = first_website
            elif x == 1:
                checksite = second_website
            else:
                checksite = third_website
            try:
                message = None
                c = pycurl.Curl()
                c.setopt(c.URL,checksite)
                c.setopt(c.WRITEDATA, buffer)
                c.setopt(c.FOLLOWLOCATION, True)
                c.perform()
                status = c.getinfo(pycurl.RESPONSE_CODE)

                if status >= 200  and status < 300:
                    message = "Success"

                elif status >= 300 and status < 400:
                    message = "Redirect"

                elif status >= 400 and status < 500:
                    message = "Client Error"

                elif status >= 500 and status < 600:
                    message = "Server Error"

                else:
                    print("Unknown Status")
                print(f"Website: {checksite} : {status} : {message}")
            except pycurl.error:
                print(f"Failed to connect to {checksite}")

            c.close()

        else:
            print(f"Website: {website} : Invalid Website")
1783877030008.webp
 

About this Thread

  • 2
    Replies
  • 30
    Views
  • 2
    Participants
Last reply from:
elbawonknu

Trending Topics

Online now

Members online
359
Guests online
1,330
Total visitors
1,689

Forum statistics

Threads
2,287,449
Posts
29,044,728
Members
1,216,542
Latest member
zutr3k17
Back
Top