File size: 1,344 Bytes
7371080 31c8c9e 7371080 | 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 | import requests
# Replace with your Hugging Face Space URL
API_URL = "https://valent-p-qecho.hf.space"
def send_activity(group, password, message):
payload = {
"group_name": group,
"password": password,
"data": message
}
r = requests.post(f"{API_URL}/store", json=payload)
print(f"Send Status: {r.status_code} - {r.json()}")
def get_activity(group, password):
payload = {
"group_name": group,
"password": password
}
r = requests.post(f"{API_URL}/retrieve", json=payload)
if r.status_code == 200:
msgs = r.json()['messages']
print(f"\n--- Messages for {group} ---")
for m in msgs:
print(f"[{m['timestamp']}] {m['content']}")
else:
print("Error:", r.text)
# --- SCENARIO: COLLISION AVOIDANCE ---
print("1. Alice sending to 'ProjectX' with pass 'alice123'...")
send_activity("ProjectX", "alice123", "Alice's Secret Report")
print("\n2. Bob sending to 'ProjectX' with pass 'bob456'...")
send_activity("ProjectX", "bob456", "Bob's Malware Logs")
print("\n3. Alice retrieves 'ProjectX' with 'alice123'...")
# She should ONLY see "Alice's Secret Report"
get_activity("ProjectX", "alice123")
print("\n4. Bob retrieves 'ProjectX' with 'bob456'...")
# He should ONLY see "Bob's Malware Logs"
get_activity("ProjectX", "bob456") |