spidey121 commited on
Commit
dc8ac8e
·
1 Parent(s): 93b1bab

fix round 1

Browse files
Files changed (1) hide show
  1. env/deception.py +24 -1
env/deception.py CHANGED
@@ -1,5 +1,15 @@
 
 
 
 
 
1
  def deploy_honeypot():
2
 
 
 
 
 
 
3
  return {
4
  "action": "honeypot",
5
  "status": "deployed"
@@ -8,6 +18,11 @@ def deploy_honeypot():
8
 
9
  def fake_database():
10
 
 
 
 
 
 
11
  return {
12
  "action": "fake_db",
13
  "status": "active"
@@ -16,7 +31,15 @@ def fake_database():
16
 
17
  def block_attacker(ip):
18
 
 
 
 
 
 
 
 
 
19
  return {
20
  "action": "block",
21
  "ip": ip
22
- }
 
1
+ import requests
2
+
3
+ SERVER = "http://127.0.0.1:7860"
4
+
5
+
6
  def deploy_honeypot():
7
 
8
+ try:
9
+ requests.post(f"{SERVER}/deploy_honeypot")
10
+ except Exception:
11
+ pass
12
+
13
  return {
14
  "action": "honeypot",
15
  "status": "deployed"
 
18
 
19
  def fake_database():
20
 
21
+ try:
22
+ requests.post(f"{SERVER}/fake_database")
23
+ except Exception:
24
+ pass
25
+
26
  return {
27
  "action": "fake_db",
28
  "status": "active"
 
31
 
32
  def block_attacker(ip):
33
 
34
+ try:
35
+ requests.post(
36
+ f"{SERVER}/block",
37
+ json={"ip": ip}
38
+ )
39
+ except Exception:
40
+ pass
41
+
42
  return {
43
  "action": "block",
44
  "ip": ip
45
+ }