#!/bin/bash

执行cthsSecScan命令,过滤出结果中是否有“Great, no warnings”

result=$(/usr/bin/cthsSecScan | grep -A 50 "cthsSecScan 1.0.0-235 Results" | grep -ci "Great, no warnings")

判断是否有外网连接

ping -c 1 www.baidu.com >/dev/null 2>&1 if [ $? -eq 0 ]; then

有外网连接,向企业微信机器人发送消息

if [ $result -eq 0 ]; then curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY'
-H 'Content-Type: application/json'
-d '{"msgtype": "text","text": {"content": "cthsSecScan检测结果为:Great, no warnings"}}' fi else

没有外网连接,将结果写入文件

filename="/data/$(date +%s).txt" /usr/bin/cthsSecScan | grep -A 50 "cthsSecScan 1.0.0-235 Results" > $filename fi

帮我写个SHELL脚本命令:usrbincthsSecScan grep -A 50 cthsSecScan 100-235 Resultsgrep -ci Great no warnings 如果返回为0则向企业微信机器人发送一条信息并判断机器有没有外网如果有外网才发送企业微信没有则在目录data下以当前时间戳为文件名称命令: usrbincthsSecScan grep -A 50 cthsS

原文地址: https://www.cveoy.top/t/topic/bGf4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录