Opera8 commited on
Commit
d3c687c
·
verified ·
1 Parent(s): 2885c43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -8
app.py CHANGED
@@ -1,7 +1,35 @@
1
  import os
2
  import subprocess
 
 
3
 
4
- # کان
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  xray_config = """
6
  {
7
  "log": {
@@ -17,11 +45,16 @@ xray_config = """
17
  "clients": [
18
  {
19
  "id": "11111111-2222-3333-4444-555555555555",
20
- "level": 0,
21
- "email": "python_user@hf"
22
  }
23
  ],
24
- "decryption": "none"
 
 
 
 
 
 
25
  },
26
  "streamSettings": {
27
  "network": "ws",
@@ -39,12 +72,22 @@ xray_config = """
39
  }
40
  """
41
 
42
- # نوشتن کان
43
  with open("config.json", "w") as f:
44
  f.write(xray_config)
45
 
46
- print("Starting Python AI Engine... (Fake)")
47
- print("System loaded successfully.")
 
 
 
 
 
 
 
 
 
 
48
 
49
- # اجرای
 
50
  subprocess.run(["./xray", "-c", "config.json"])
 
1
  import os
2
  import subprocess
3
+ import threading
4
+ from http.server import SimpleHTTPRequestHandler, HTTPServer
5
 
6
+ # 1. ساخت یک صفحه HTML الکی برای رد گم کنی
7
+ # این صفحه وقتی کسی آدرس اسپیس را در مرورگر بزند نمایش داده می‌شود
8
+ html_content = """
9
+ <!DOCTYPE html>
10
+ <html>
11
+ <head>
12
+ <title>AI Model Status</title>
13
+ <style>
14
+ body { font-family: sans-serif; text-align: center; padding: 50px; background-color: #f0f0f0; }
15
+ h1 { color: #333; }
16
+ .status { color: green; font-weight: bold; }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <h1>AI Inference Engine</h1>
21
+ <p>Status: <span class="status">OPERATIONAL</span></p>
22
+ <p>Model loaded: GPT-Neo-1.3B</p>
23
+ <p>Waiting for API requests...</p>
24
+ </body>
25
+ </html>
26
+ """
27
+
28
+ with open("index.html", "w") as f:
29
+ f.write(html_content)
30
+
31
+ # 2. تنظیمات Xray (همراه با Fallback به سایت الکی)
32
+ # هر ترافیکی که VPN نباشد، به پورت 3000 (سایت الکی) فرستاده می‌شود
33
  xray_config = """
34
  {
35
  "log": {
 
45
  "clients": [
46
  {
47
  "id": "11111111-2222-3333-4444-555555555555",
48
+ "level": 0
 
49
  }
50
  ],
51
+ "decryption": "none",
52
+ "fallbacks": [
53
+ {
54
+ "dest": 3000,
55
+ "xver": 0
56
+ }
57
+ ]
58
  },
59
  "streamSettings": {
60
  "network": "ws",
 
72
  }
73
  """
74
 
 
75
  with open("config.json", "w") as f:
76
  f.write(xray_config)
77
 
78
+ # 3. تابعی برای اجرای وب‌سایت الکی روی پورت 3000
79
+ def run_fake_website():
80
+ port = 3000
81
+ server_address = ("", port)
82
+ httpd = HTTPServer(server_address, SimpleHTTPRequestHandler)
83
+ print(f"Fake AI Site running on port {port}")
84
+ httpd.serve_forever()
85
+
86
+ # 4. اجرای سایت الکی در پس‌زمینه
87
+ thread = threading.Thread(target=run_fake_website)
88
+ thread.daemon = True
89
+ thread.start()
90
 
91
+ # 5. اجرای Xray (فیلترشکن اصلی)
92
+ print("Starting Xray Core...")
93
  subprocess.run(["./xray", "-c", "config.json"])