import requests
def check_account(username, password, proxy=None):
# Create a session object to maintain the proxy settings
session = requests.Session()
# Set up proxy if provided
if proxy:
session.proxies = {'http': proxy, 'https': proxy}
# Make a request to the authentication endpoint with the provided credentials
response = session.post('https://example.com/login', data={'username': username, 'password': password})
# Check the response status code to determine the result
if response.status_code == 200:
return True # Account is valid
else:
return False # Account is invalid
# Example usage
proxy_address = 'http://proxy.example.com:8080'
input_file = 'accounts.txt'
# Read usernames and passwords from file
with open(input_file, 'r') as file:
for line in file:
username, password = line.strip().split(':')
# Check account with proxy
result = check_account(username, password, proxy=proxy_address)
if result:
print(f"Account {username} is valid!")
else:
print(f"Account {username} is invalid!")