Spaces:
Runtime error
Runtime error
Run attacks continuously
Browse files- inference.py +12 -10
inference.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import threading
|
| 2 |
import time
|
|
|
|
| 3 |
|
| 4 |
from env.fake_server import run_server
|
| 5 |
from tasks.easy import run as easy
|
|
@@ -13,35 +14,36 @@ server_thread.start()
|
|
| 13 |
|
| 14 |
time.sleep(2) # wait for server to start
|
| 15 |
|
|
|
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
# Run continuously for Hugging Face
|
| 21 |
while True:
|
| 22 |
|
| 23 |
# Easy Task
|
| 24 |
easy_score = easy()
|
| 25 |
print(
|
| 26 |
-
f"[STEP] step=1 action=easy reward={easy_score:.2f} done=false error=null"
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
# Medium Task
|
| 30 |
medium_score = medium()
|
| 31 |
print(
|
| 32 |
-
f"[STEP] step=2 action=medium reward={medium_score:.2f} done=false error=null"
|
|
|
|
| 33 |
)
|
| 34 |
|
| 35 |
# Hard Task
|
| 36 |
hard_score = hard()
|
| 37 |
print(
|
| 38 |
-
f"[STEP] step=3 action=hard reward={hard_score:.2f} done=true error=null"
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
print(
|
| 42 |
-
f"[END] success=true steps=3 rewards={easy_score:.2f},{medium_score:.2f},{hard_score:.2f}"
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
-
#
|
| 46 |
time.sleep(60)
|
| 47 |
-
|
|
|
|
| 1 |
import threading
|
| 2 |
import time
|
| 3 |
+
import sys
|
| 4 |
|
| 5 |
from env.fake_server import run_server
|
| 6 |
from tasks.easy import run as easy
|
|
|
|
| 14 |
|
| 15 |
time.sleep(2) # wait for server to start
|
| 16 |
|
| 17 |
+
print("[START] task=ai-deception env=cyber-security model=baseline", flush=True)
|
| 18 |
|
| 19 |
+
# Run continuously
|
|
|
|
|
|
|
|
|
|
| 20 |
while True:
|
| 21 |
|
| 22 |
# Easy Task
|
| 23 |
easy_score = easy()
|
| 24 |
print(
|
| 25 |
+
f"[STEP] step=1 action=easy reward={easy_score:.2f} done=false error=null",
|
| 26 |
+
flush=True
|
| 27 |
)
|
| 28 |
|
| 29 |
# Medium Task
|
| 30 |
medium_score = medium()
|
| 31 |
print(
|
| 32 |
+
f"[STEP] step=2 action=medium reward={medium_score:.2f} done=false error=null",
|
| 33 |
+
flush=True
|
| 34 |
)
|
| 35 |
|
| 36 |
# Hard Task
|
| 37 |
hard_score = hard()
|
| 38 |
print(
|
| 39 |
+
f"[STEP] step=3 action=hard reward={hard_score:.2f} done=true error=null",
|
| 40 |
+
flush=True
|
| 41 |
)
|
| 42 |
|
| 43 |
print(
|
| 44 |
+
f"[END] success=true steps=3 rewards={easy_score:.2f},{medium_score:.2f},{hard_score:.2f}",
|
| 45 |
+
flush=True
|
| 46 |
)
|
| 47 |
|
| 48 |
+
# wait before next attack cycle
|
| 49 |
time.sleep(60)
|
|
|