mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-17 16:37:18 +02:00
Add files via upload
This commit is contained in:
+41
-13
@@ -1,50 +1,78 @@
|
|||||||
name: "create-file"
|
name: "create-file"
|
||||||
command: "sh"
|
command: "python3"
|
||||||
|
args:
|
||||||
|
- "-c"
|
||||||
|
- |
|
||||||
|
import base64
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
sys.stderr.write("Usage: create-file <filename> <content> [binary]\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
content = sys.argv[2]
|
||||||
|
binary_arg = sys.argv[3].lower() if len(sys.argv) > 3 else "false"
|
||||||
|
binary = binary_arg in ("1", "true", "yes", "on")
|
||||||
|
|
||||||
|
path = Path(filename)
|
||||||
|
if not path.is_absolute():
|
||||||
|
path = Path.cwd() / path
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
if binary:
|
||||||
|
data = base64.b64decode(content)
|
||||||
|
path.write_bytes(data)
|
||||||
|
else:
|
||||||
|
path.write_text(content, encoding="utf-8")
|
||||||
|
|
||||||
|
print(f"文件已创建: {path}")
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
short_description: "创建文件工具"
|
short_description: "创建文件工具"
|
||||||
|
|
||||||
description: |
|
description: |
|
||||||
在服务器上创建指定内容的文件。
|
在服务器上创建指定内容的文件。
|
||||||
|
|
||||||
**主要功能:**
|
**主要功能:**
|
||||||
- 创建文件
|
- 创建文件
|
||||||
- 写入内容
|
- 写入内容
|
||||||
- 支持二进制文件
|
- 支持二进制文件
|
||||||
|
|
||||||
**使用场景:**
|
**使用场景:**
|
||||||
- 文件创建
|
- 文件创建
|
||||||
- 脚本生成
|
- 脚本生成
|
||||||
- 数据保存
|
- 数据保存
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
- name: "filename"
|
- name: "filename"
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "要创建的文件名"
|
description: "要创建的文件名"
|
||||||
required: true
|
required: true
|
||||||
|
position: 0
|
||||||
|
format: "positional"
|
||||||
- name: "content"
|
- name: "content"
|
||||||
type: "string"
|
type: "string"
|
||||||
description: "文件内容"
|
description: "文件内容"
|
||||||
required: true
|
required: true
|
||||||
|
position: 1
|
||||||
|
format: "positional"
|
||||||
- name: "binary"
|
- name: "binary"
|
||||||
type: "bool"
|
type: "bool"
|
||||||
description: "是否为二进制内容"
|
description: "内容是否为Base64编码的二进制"
|
||||||
required: false
|
required: false
|
||||||
|
position: 2
|
||||||
|
format: "positional"
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
- name: "additional_args"
|
- name: "additional_args"
|
||||||
type: "string"
|
type: "string"
|
||||||
description: |
|
description: |
|
||||||
额外的create-file参数。用于传递未在参数列表中定义的create-file选项。
|
额外的create-file参数。用于传递未在参数列表中定义的create-file选项。
|
||||||
|
|
||||||
**示例值:**
|
**示例值:**
|
||||||
- 根据工具特性添加常用参数示例
|
- 根据工具特性添加常用参数示例
|
||||||
|
|
||||||
**注意事项:**
|
**注意事项:**
|
||||||
- 多个参数用空格分隔
|
- 多个参数用空格分隔
|
||||||
- 确保参数格式正确,避免命令注入
|
- 确保参数格式正确,避免命令注入
|
||||||
- 此参数会直接追加到命令末尾
|
- 此参数会直接追加到命令末尾
|
||||||
required: false
|
required: false
|
||||||
format: "positional"
|
format: "positional"
|
||||||
|
|||||||
Reference in New Issue
Block a user