spidey121 commited on
Commit
e9b9ee2
·
1 Parent(s): c883ba0

fix round 1

Browse files
Files changed (1) hide show
  1. env/env.py +9 -4
env/env.py CHANGED
@@ -87,17 +87,22 @@ class DeceptionEnv:
87
  # ---------------- Block Attacker ----------------
88
  elif action == "block_ip":
89
 
90
- # Proper block after detect + deploy
91
- if logs.get("suspicious_ips") and self.detected and self.deployed:
 
 
 
 
 
92
 
93
  ip = logs["suspicious_ips"][-1]
94
  block_attacker(ip)
95
 
96
- reward += 0.70 # higher reward for correct block
97
  self.done = True
98
 
99
  else:
100
- # early block penalty
101
  reward += 0.05
102
 
103
  # ---------------- Episode Boundary ----------------
 
87
  # ---------------- Block Attacker ----------------
88
  elif action == "block_ip":
89
 
90
+ # Only allow block after detection + deception
91
+ if (
92
+ logs.get("suspicious_ips")
93
+ and self.detected
94
+ and self.deployed
95
+ and self.current_step >= 3
96
+ ):
97
 
98
  ip = logs["suspicious_ips"][-1]
99
  block_attacker(ip)
100
 
101
+ reward += 0.70
102
  self.done = True
103
 
104
  else:
105
+ # Early block penalty
106
  reward += 0.05
107
 
108
  # ---------------- Episode Boundary ----------------