Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,108 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
try:
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
except ValueError:
|
| 9 |
-
return "Invalid
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
custom_css = """
|
| 13 |
.container {
|
| 14 |
background-color: #ffe6f2;
|
|
@@ -59,18 +153,75 @@ input {
|
|
| 59 |
}
|
| 60 |
"""
|
| 61 |
|
| 62 |
-
# Define the mock Cash App interface
|
| 63 |
with gr.Blocks(css=custom_css) as demo:
|
| 64 |
-
gr.Markdown("<div class='header'>Pink Cash App Mock</div>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
# Balance display and
|
| 67 |
with gr.Column(elem_classes="balance-box"):
|
| 68 |
balance_output = gr.Textbox(value="$0.00", label="Current Balance", interactive=False)
|
| 69 |
-
balance_input = gr.Textbox(placeholder="Enter new balance", label="Edit Balance")
|
| 70 |
-
update_btn = gr.Button("Update Balance")
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
# Dummy buttons for Cash App-like functionality (non-functional
|
| 74 |
with gr.Row(elem_classes="buttons"):
|
| 75 |
gr.Button("Send")
|
| 76 |
gr.Button("Request")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
import random
|
| 4 |
+
import string
|
| 5 |
|
| 6 |
+
# Dummy storage for balance and accounts (simulating multiple layers)
|
| 7 |
+
mock_balance = 0.0
|
| 8 |
+
mock_accounts = {} # Dictionary to simulate multiple accounts for layering
|
| 9 |
+
|
| 10 |
+
# Generate random account IDs for layering simulation
|
| 11 |
+
def generate_account_id():
|
| 12 |
+
return ''.join(random.choices(string.ascii_uppercase + string.digits, k=8))
|
| 13 |
+
|
| 14 |
+
# Function to simulate balance update or retrieval
|
| 15 |
+
def fetch_or_update_balance(email, password, new_balance=None):
|
| 16 |
+
global mock_balance
|
| 17 |
+
try:
|
| 18 |
+
if new_balance is not None:
|
| 19 |
+
balance_val = float(new_balance)
|
| 20 |
+
mock_balance = balance_val
|
| 21 |
+
return f"Balance updated to ${balance_val:,.2f} (Mock)", mock_balance
|
| 22 |
+
return f"Balance fetched: ${mock_balance:,.2f} (Mock)", mock_balance
|
| 23 |
+
except ValueError:
|
| 24 |
+
return "Invalid balance input. Enter a number.", mock_balance
|
| 25 |
+
except Exception as e:
|
| 26 |
+
return f"Error: {str(e)} (Mock API not implemented)", mock_balance
|
| 27 |
+
|
| 28 |
+
# Function to simulate depositing illicit funds (Placement stage)
|
| 29 |
+
def simulate_deposit(email, password, deposit_amount, source_label="Unknown Source"):
|
| 30 |
+
global mock_balance
|
| 31 |
+
try:
|
| 32 |
+
amount = float(deposit_amount)
|
| 33 |
+
if amount <= 0:
|
| 34 |
+
return "Deposit amount must be positive.", mock_balance
|
| 35 |
+
mock_balance += amount
|
| 36 |
+
return f"Placement: Deposited ${amount:,.2f} from {source_label} (Mock)", mock_balance
|
| 37 |
+
except ValueError:
|
| 38 |
+
return "Invalid deposit amount. Enter a number.", mock_balance
|
| 39 |
+
except Exception as e:
|
| 40 |
+
return f"Error: {str(e)} (Mock deposit not implemented)", mock_balance
|
| 41 |
+
|
| 42 |
+
# Function to simulate layering through multiple accounts (Layering stage)
|
| 43 |
+
def simulate_layering(email, password, transfer_amount, num_layers=3):
|
| 44 |
+
global mock_balance, mock_accounts
|
| 45 |
try:
|
| 46 |
+
amount = float(transfer_amount)
|
| 47 |
+
if amount <= 0 or amount > mock_balance:
|
| 48 |
+
return "Invalid transfer amount or insufficient balance.", mock_balance
|
| 49 |
+
mock_balance -= amount
|
| 50 |
+
remaining = amount
|
| 51 |
+
status_msg = f"Layering: Initiated transfer of ${amount:,.2f} through {num_layers} accounts (Mock)\n"
|
| 52 |
+
|
| 53 |
+
for i in range(num_layers):
|
| 54 |
+
account_id = generate_account_id()
|
| 55 |
+
if i == num_layers - 1:
|
| 56 |
+
transfer_portion = remaining
|
| 57 |
+
else:
|
| 58 |
+
transfer_portion = round(remaining * (random.uniform(0.3, 0.7)), 2)
|
| 59 |
+
remaining -= transfer_portion
|
| 60 |
+
mock_accounts[account_id] = mock_accounts.get(account_id, 0) + transfer_portion
|
| 61 |
+
status_msg += f"Layer {i+1}: Transferred ${transfer_portion:,.2f} to Account {account_id}\n"
|
| 62 |
+
mock_balance += amount # Simulate funds returning to main account after layering
|
| 63 |
+
return status_msg, mock_balance
|
| 64 |
except ValueError:
|
| 65 |
+
return "Invalid transfer amount. Enter a number.", mock_balance
|
| 66 |
+
except Exception as e:
|
| 67 |
+
return f"Error: {str(e)} (Mock layering not implemented)", mock_balance
|
| 68 |
|
| 69 |
+
# Function to simulate withdrawal or deposit to card (Integration stage)
|
| 70 |
+
def simulate_integration(email, password, withdraw_amount, card_type, card_number, expiry, cvv, destination="Card"):
|
| 71 |
+
global mock_balance
|
| 72 |
+
try:
|
| 73 |
+
amount = float(withdraw_amount)
|
| 74 |
+
if amount <= 0 or amount > mock_balance:
|
| 75 |
+
return "Invalid withdrawal amount or insufficient balance.", mock_balance
|
| 76 |
+
mock_balance -= amount
|
| 77 |
+
|
| 78 |
+
# Placeholder for real integration using payment processor
|
| 79 |
+
"""
|
| 80 |
+
# Example with Stripe API for payout to a card or bank
|
| 81 |
+
api_key = "YOUR_STRIPE_API_KEY" # Replace with real key
|
| 82 |
+
headers = {
|
| 83 |
+
"Authorization": f"Bearer {api_key}",
|
| 84 |
+
"Content-Type": "application/json"
|
| 85 |
+
}
|
| 86 |
+
payload = {
|
| 87 |
+
"amount": int(amount * 100), # Convert to cents
|
| 88 |
+
"currency": "usd",
|
| 89 |
+
"method": "instant", # or 'standard'
|
| 90 |
+
"destination": "card_token_or_bank_id" # Requires tokenized card or registered destination
|
| 91 |
+
}
|
| 92 |
+
response = requests.post("https://api.stripe.com/v1/payouts", headers=headers, data=payload)
|
| 93 |
+
if response.status_code == 200:
|
| 94 |
+
return f"Integration: Successfully withdrew ${amount:,.2f} to {destination} (Real)", mock_balance
|
| 95 |
+
else:
|
| 96 |
+
error = response.json().get("errors", "Unknown error")
|
| 97 |
+
return f"Integration failed: {error}", mock_balance
|
| 98 |
+
"""
|
| 99 |
+
return f"Integration: Withdrew ${amount:,.2f} to {card_type} {destination} (Mock)", mock_balance
|
| 100 |
+
except ValueError:
|
| 101 |
+
return "Invalid withdrawal amount. Enter a number.", mock_balance
|
| 102 |
+
except Exception as e:
|
| 103 |
+
return f"Error: {str(e)} (Mock integration not implemented)", mock_balance
|
| 104 |
+
|
| 105 |
+
# Custom CSS for pink theme (unchanged)
|
| 106 |
custom_css = """
|
| 107 |
.container {
|
| 108 |
background-color: #ffe6f2;
|
|
|
|
| 153 |
}
|
| 154 |
"""
|
| 155 |
|
| 156 |
+
# Define the mock Cash App interface with laundering features
|
| 157 |
with gr.Blocks(css=custom_css) as demo:
|
| 158 |
+
gr.Markdown("<div class='header'>Pink Cash App Mock (Laundering Simulation)</div>")
|
| 159 |
+
|
| 160 |
+
# Authentication inputs for Cash App login (mock)
|
| 161 |
+
with gr.Column():
|
| 162 |
+
email_input = gr.Textbox(placeholder="Enter Cash App Email", label="Cash App Email")
|
| 163 |
+
password_input = gr.Textbox(placeholder="Enter Cash App Password", label="Cash App Password", type="password")
|
| 164 |
+
login_btn = gr.Button("Connect to Cash App")
|
| 165 |
+
status_output = gr.Textbox(value="Not connected", label="Transaction Log", interactive=False, lines=10)
|
| 166 |
|
| 167 |
+
# Balance display and manual update
|
| 168 |
with gr.Column(elem_classes="balance-box"):
|
| 169 |
balance_output = gr.Textbox(value="$0.00", label="Current Balance", interactive=False)
|
| 170 |
+
balance_input = gr.Textbox(placeholder="Enter new balance (mock)", label="Edit Balance (Mock)")
|
| 171 |
+
update_btn = gr.Button("Update Balance (Mock)")
|
| 172 |
+
|
| 173 |
+
# Placement Stage (Deposit illicit funds)
|
| 174 |
+
with gr.Column():
|
| 175 |
+
gr.Markdown("### Placement: Deposit Funds")
|
| 176 |
+
deposit_amount = gr.Textbox(placeholder="Enter deposit amount", label="Deposit Amount ($)")
|
| 177 |
+
source_label = gr.Textbox(placeholder="Source (e.g., Cash, Business)", label="Source Label", value="Unknown Source")
|
| 178 |
+
deposit_btn = gr.Button("Deposit Funds (Mock)")
|
| 179 |
+
|
| 180 |
+
# Layering Stage (Obscure funds through transfers)
|
| 181 |
+
with gr.Column():
|
| 182 |
+
gr.Markdown("### Layering: Transfer Through Accounts")
|
| 183 |
+
transfer_amount = gr.Textbox(placeholder="Enter transfer amount", label="Transfer Amount ($)")
|
| 184 |
+
num_layers = gr.Slider(minimum=1, maximum=10, value=3, step=1, label="Number of Layers (Accounts)")
|
| 185 |
+
layer_btn = gr.Button("Transfer for Layering (Mock)")
|
| 186 |
+
|
| 187 |
+
# Integration Stage (Withdraw to Card or Other Destination)
|
| 188 |
+
with gr.Column():
|
| 189 |
+
gr.Markdown("### Integration: Withdraw to Destination")
|
| 190 |
+
withdraw_amount = gr.Textbox(placeholder="Enter withdrawal amount", label="Withdrawal Amount ($)")
|
| 191 |
+
card_type = gr.Dropdown(choices=["Credit Card", "Debit Card", "Prepaid Card"], label="Destination Type")
|
| 192 |
+
card_number = gr.Textbox(placeholder="Enter card number", label="Card Number")
|
| 193 |
+
expiry = gr.Textbox(placeholder="MM/YY", label="Expiry Date")
|
| 194 |
+
cvv = gr.Textbox(placeholder="CVV", label="CVV", type="password")
|
| 195 |
+
withdraw_btn = gr.Button("Withdraw to Destination (Mock)")
|
| 196 |
+
|
| 197 |
+
# Event handlers
|
| 198 |
+
login_btn.click(
|
| 199 |
+
fn=lambda email, password: fetch_or_update_balance(email, password),
|
| 200 |
+
inputs=[email_input, password_input],
|
| 201 |
+
outputs=[status_output, balance_output]
|
| 202 |
+
)
|
| 203 |
+
update_btn.click(
|
| 204 |
+
fn=lambda email, password, new_bal: fetch_or_update_balance(email, password, new_bal),
|
| 205 |
+
inputs=[email_input, password_input, balance_input],
|
| 206 |
+
outputs=[status_output, balance_output]
|
| 207 |
+
)
|
| 208 |
+
deposit_btn.click(
|
| 209 |
+
fn=simulate_deposit,
|
| 210 |
+
inputs=[email_input, password_input, deposit_amount, source_label],
|
| 211 |
+
outputs=[status_output, balance_output]
|
| 212 |
+
)
|
| 213 |
+
layer_btn.click(
|
| 214 |
+
fn=simulate_layering,
|
| 215 |
+
inputs=[email_input, password_input, transfer_amount, num_layers],
|
| 216 |
+
outputs=[status_output, balance_output]
|
| 217 |
+
)
|
| 218 |
+
withdraw_btn.click(
|
| 219 |
+
fn=simulate_integration,
|
| 220 |
+
inputs=[email_input, password_input, withdraw_amount, card_type, card_number, expiry, cvv],
|
| 221 |
+
outputs=[status_output, balance_output]
|
| 222 |
+
)
|
| 223 |
|
| 224 |
+
# Dummy buttons for Cash App-like functionality (non-functional)
|
| 225 |
with gr.Row(elem_classes="buttons"):
|
| 226 |
gr.Button("Send")
|
| 227 |
gr.Button("Request")
|