Skip to content

Commit

Permalink
Update 5-check_poc.sh
Browse files Browse the repository at this point in the history
优化代码
  • Loading branch information
adysec authored Jan 22, 2025
1 parent 26c356e commit f445010
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions 5-check_poc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ if [ ! -d "$TMP_DIR" ]; then
fi

# 查找 YAML 文件
find "$TMP_DIR" -type f \( -name "*.yml" -o -name "*.yaml" \) | while IFS= read -r file; do
yaml_files=$(find "$TMP_DIR" -type f \( -name "*.yml" -o -name "*.yaml" \))
if [ -z "$yaml_files" ]; then
echo "未找到 YAML 文件,退出。"
exit 0
fi

# 遍历每个 YAML 文件
while IFS= read -r -d '' file; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))

# 检查是否超时
if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
echo "运行时间已超过 5 小时 30 分钟,强制退出。"
Expand All @@ -49,6 +56,6 @@ find "$TMP_DIR" -type f \( -name "*.yml" -o -name "*.yaml" \) | while IFS= read
# 移动文件
mv "$file" "$dest_file" && echo "已将文件 $file 移动至 $dest_file"
fi
done
done < <(find "$TMP_DIR" -type f \( -name "*.yml" -o -name "*.yaml" \) -print0)

echo "POC 检查完成。"

0 comments on commit f445010

Please sign in to comment.