summaryrefslogtreecommitdiff
path: root/agent/apps
diff options
context:
space:
mode:
Diffstat (limited to 'agent/apps')
-rw-r--r--agent/apps/code/test/README.md5
-rw-r--r--agent/apps/code/test/hello.py1
-rw-r--r--agent/apps/script.py2
-rw-r--r--agent/apps/util.py10
4 files changed, 17 insertions, 1 deletions
diff --git a/agent/apps/code/test/README.md b/agent/apps/code/test/README.md
new file mode 100644
index 0000000..2dda2f9
--- /dev/null
+++ b/agent/apps/code/test/README.md
@@ -0,0 +1,5 @@
+# 简介
+
+hello.py 是一个测试文件,用于验证主控端任务下发到代理执行的可行性
+
+hello.py接收一个字符串,并返回对应的执行输出 \ No newline at end of file
diff --git a/agent/apps/code/test/hello.py b/agent/apps/code/test/hello.py
index e8b6f5e..8271b56 100644
--- a/agent/apps/code/test/hello.py
+++ b/agent/apps/code/test/hello.py
@@ -3,4 +3,5 @@ import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--string', type=str, help="输出到控制台的字符串", required=True)
args = parser.parse_args()
+print("hello.py开始执行,执行参数为" + args.string)
print("hello" + str(args.string))
diff --git a/agent/apps/script.py b/agent/apps/script.py
index f9886b4..1e2a5f3 100644
--- a/agent/apps/script.py
+++ b/agent/apps/script.py
@@ -14,7 +14,7 @@ executor = ThreadPoolExecutor(5)
@bp.post('/')
@bp.doc("渗透任务参数接收接口", "返回任务执行状态")
@bp.input({
- 'name': String(required=True),
+ 'policy': String(required=True),
'param': String(required=True)
})
def start_script(query_data):
diff --git a/agent/apps/util.py b/agent/apps/util.py
new file mode 100644
index 0000000..8cadf4d
--- /dev/null
+++ b/agent/apps/util.py
@@ -0,0 +1,10 @@
+# 工具函数集合
+import requests
+
+
+# 代理输出回传
+def agent_echo(proto, server, level, info):
+ data = {"level": level, "info": info}
+ r = requests.post(proto + "://" + server, json=data)
+ if r.status_code == 200:
+ print("ok")