import requests

def check_login(host, username, password):
    try:
        url = "http://"+host+"/"
        r = requests.get(url, auth=(username, password))
        if r.status_code == 200:
            return True
        else:
            return False
    except:
        return False

def main():
    print("############# Default Password Checker ##############")
    print("############# I am not responsible for your use of this tool. ##############")
    print("############# Make sure that your hosts file is properly formatted; IP:port ##############")
    print("Enter the filename of the hosts to check:")
   
    filename = input()
    try:
        f = open(filename,"r")
        hosts = f.read().split("\n")
        print("Enter the username:")
        username = input()
        print("Enter the password:")
        password = input()
        for host in hosts:
            print("Checking host: "+host)
            if check_login(host, username, password):
                print("Successful login on: "+host)
            else:
                print("Failed login on: "+host)
    except:
        print("Could not open file.")

if __name__ == "__main__":
    main()

# Educational Purposes Only!
# Xao's a skid!