dt_automate/main.go
2025-03-21 18:01:53 +08:00

108 lines
4.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
_ "dt_automate/attackevent"
"dt_automate/auth"
_ "dt_automate/method"
_ "dt_automate/wps"
"flag"
"fmt"
"log"
"os"
)
var (
// urls string // 存储 -t 参数值
keyss bool // 存储值
runs bool //存储值
// helpFlag bool
)
func main() {
//SetFlags函数用来设置标准logger的输出配置
log.SetPrefix("[DT_AUTOMATE]: ")
log.SetFlags(log.Llongfile | log.Lmicroseconds | log.Ldate)
// 定义标志 -url 并设置其默认值为空字符串
flag.BoolVar(&keyss, "v", false, "查看授权状态")
flag.BoolVar(&runs, "run", false, "开始执行")
// flag.BoolVar(&helpFlag, "h", false, "Show help message")
//解析命令行参数
flag.Parse()
// log.Println(os.Args[1])
if len(os.Args) > 1 {
if keyss {
if auth.Auth() {
// log.Println("授权状态:", true)
} else {
log.Println("没有授权,请联系管理员")
}
}
if runs {
if auth.Auth() {
//可执行程序位置
// 互联网区截图
// method.HW_FAC1() //截取流量清洗的图片
// method.HW_FW1() //截取防火墙的图片
// method.HW_TSGZ() //截取态势感知的图片
// method.HW_BAOLJ() //截取堡垒机的图片
// method.HW_DTCLOUD() //截取运维中心的图片
// // 政务网区截图
// method.ZWW_FW1() //截取防火墙的图片
// method.ZWW_TSGZ() //截取态势感知的图片
// method.ZWWW_BAOLJ() //截取堡垒机的图片
// method.ZWW_DTCLOUD() //截取运维中心的图片
// // 互联网区运维巡检文档生成
// wps.HW_SYS_Word() //运维平台word文档生成
// // 政务网区运维巡检文档生成
// wps.ZWW_SYS_Word() //运维平台word文档生成
// // 安全巡检文档生成
// wps.SAFET_Word() //安全巡检文档生成
// //互联网防火墙ips事件获取 安全事件表格生成
// attackevent.Fw_event(attackevent.HW_fw1_cookie(), "2025-03-20") //将防火墙安全事件存放到xlsx文件中
// //政务网防火墙ips事件获取 安全事件表格生成
// attackevent.Zww_event(attackevent.HW_zww1_cookie(), "2025-03-20") //将防火墙安全事件存放到xlsx文件中
//nessus的csv文件生成docx报告
// nessus.CSV_damo()
//翻译模块调用腾讯xt翻译月500万字限制
// log.Println(wps.Translate("hello"))
// wps.Weekly_word()
//调用云平台接口
// dtcloud.EcsList() //获取ecs列表及其详情(完成)
// dtcloud.Process() //获取单ecs进程使用情况
// dtcloud.Memory() //获取单个ecs的memory使用情况
// dtcloud.Cpu() ///获取单个ecs的cpu使用情况
// dtcloud.TenantList() //获取租户列表(完成)
//获取docx文档中所有的图片
// wps.Weekly_get_img("")
//生成条形图
// wps.DrawHorizontalBarChart([]float64{486, 158, 91, 76, 52}, []string{"11.2.144.8", "11.2.144.18", "11.2.144.129", "11.2.144.139", "11.2.144.121"})
//生成环形图
// wps.Weekly_chart([]wps.Data{
// {Angle: 246, Label: "1、扫描探测246", Color: "#FF6384"}, // 红色
// {Angle: 240, Label: "2、敏感信息泄露240", Color: "#36A2EB"}, // 蓝色
// {Angle: 148, Label: "3、弱密码148", Color: "#FFCE56"}, // 黄色
// {Angle: 66, Label: "4、可疑访问66", Color: "#4bc0c0"}, // 绿色
// {Angle: 61, Label: "5、SQL注入61", Color: "#c12c1f"}, // 红色
// })
} else {
log.Println("没有授权,请联系管理员")
}
}
} else {
// log.Println("\n使用说明\n请在主程序后面带上参数↓↓↓\n# # # # # # # # # # # # # # # # # # # # # # # # #\n\n实例: main -url https://www.douyin.com/follow/live/923670558441\n\n# # # # # # # # # # # # # # # # # # # # # # # # #")
flag.Usage()
os.Exit(0)
}
}
func init() {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Println(" -v 查看授权状态")
fmt.Println(" -run 开始截取图片和生成文档")
// fmt.Println(" -h, 帮助信息")
}
}