调整nessus报告生成模块

This commit is contained in:
李超 2025-03-05 23:03:51 +08:00
parent 5c9e0f4dd8
commit 10910035ed
4 changed files with 112 additions and 25 deletions

View File

@ -88,9 +88,9 @@ func main() {
// //安全事件表格生成(需要先执行互联网区防火墙截图)
// attackevent.Fw_event(attackevent.HW_fw1_cookie()) //将防火墙安全事件存放到xlsx文件中
//nessus的csv文件生成docx报告
// wps.CSV_damo()
wps.CSV_damo()
// log.Println(wps.Translate("hello"))
wps.Weekly_word()
// wps.Weekly_word()
}
} else {
log.Println("没有授权")

Binary file not shown.

Binary file not shown.

View File

@ -41,32 +41,119 @@ func CSV_damo() {
return
}
log.Println("开始将数据填入报告模板")
table := doc.Tables()[3]
var host string
var con int
var tables []document.Table
// for _, csvstr := range people {
// if csvstr.Host == host {
// row := table.AddRow()
// row.Properties().SetHeight(22, wml.ST_HeightRuleExact)
// // text_s(row.AddCell(), csvstr.Host) //主机IP
// text_s(row.AddCell(), Translate(csvstr.Name)) //风险项
// if csvstr.Risk == "None" {
// text_s(row.AddCell(), "无") //危险程度
// } else {
// text_s(row.AddCell(), Translate(csvstr.Risk)) //危险程度
// }
// if csvstr.Risk_Factor == "None" {
// text_s(row.AddCell(), "无") //危险因素
// } else {
// text_s(row.AddCell(), Translate(csvstr.Risk_Factor)) //危险因素
// }
// text_s(row.AddCell(), Translate(csvstr.Synopsisk)) //摘要
// text_s(row.AddCell(), Translate(csvstr.Description)) //描述
// if csvstr.Solution == "n/a" {
// text_s(row.AddCell(), "无") //解决方案
// } else {
// text_s(row.AddCell(), Translate(csvstr.Solution)) //解决方案
// }
// } else {
// con++
// doc.Tables()[con] = doc.Tables()[3]
// table = doc.Tables()[con]
// row := table.AddRow()
// row.Properties().SetHeight(22, wml.ST_HeightRuleExact)
// // text_s(row.AddCell(), csvstr.Host) //主机IP
// text_s(row.AddCell(), Translate(csvstr.Name)) //风险项
// if csvstr.Risk == "None" {
// text_s(row.AddCell(), "无") //危险程度
// } else {
// text_s(row.AddCell(), Translate(csvstr.Risk)) //危险程度
// }
// if csvstr.Risk_Factor == "None" {
// text_s(row.AddCell(), "无") //危险因素
// } else {
// text_s(row.AddCell(), Translate(csvstr.Risk_Factor)) //危险因素
// }
// text_s(row.AddCell(), Translate(csvstr.Synopsisk)) //摘要
// text_s(row.AddCell(), Translate(csvstr.Description)) //描述
// if csvstr.Solution == "n/a" {
// text_s(row.AddCell(), "无") //解决方案
// } else {
// text_s(row.AddCell(), Translate(csvstr.Solution)) //解决方案
// }
// }
// host = csvstr.Host
// }
for _, csvstr := range people {
table := doc.Tables()[3]
row := table.AddRow()
row.Properties().SetHeight(22, wml.ST_HeightRuleExact)
// :=conn.
text_s(row.AddCell(), csvstr.Host) //主机IP
if csvstr.Risk == "None" {
text_s(row.AddCell(), "无") //危险程度
} else {
text_s(row.AddCell(), Translate(csvstr.Risk)) //危险程度
}
text_s(row.AddCell(), Translate(csvstr.Name)) //脆弱点
if csvstr.Risk_Factor == "None" {
text_s(row.AddCell(), "无") //危险因素
} else {
text_s(row.AddCell(), Translate(csvstr.Risk_Factor)) //危险因素
}
text_s(row.AddCell(), Translate(csvstr.Synopsisk)) //摘要
text_s(row.AddCell(), Translate(csvstr.Description)) //描述
if csvstr.Solution == "n/a" {
text_s(row.AddCell(), "无") //解决方案
} else {
text_s(row.AddCell(), Translate(csvstr.Solution)) //解决方案
}
if csvstr.Host == host {
row := table.AddRow()
row.Properties().SetHeight(22, wml.ST_HeightRuleExact)
// text_s(row.AddCell(), csvstr.Host) //主机IP
text_s(row.AddCell(), csvstr.Name) //风险项
if csvstr.Risk == "None" {
text_s(row.AddCell(), "无") //危险程度
} else {
text_s(row.AddCell(), csvstr.Risk) //危险程度
}
if csvstr.Risk_Factor == "None" {
text_s(row.AddCell(), "无") //危险因素
} else {
text_s(row.AddCell(), csvstr.Risk_Factor) //危险因素
}
text_s(row.AddCell(), csvstr.Synopsisk) //摘要
text_s(row.AddCell(), csvstr.Description) //描述
if csvstr.Solution == "n/a" {
text_s(row.AddCell(), "无") //解决方案
} else {
text_s(row.AddCell(), csvstr.Solution) //解决方案
}
} else {
con++
tables[con] = doc.Tables()[3]
table = tables[con]
row := table.AddRow()
row.Properties().SetHeight(22, wml.ST_HeightRuleExact)
// text_s(row.AddCell(), csvstr.Host) //主机IP
text_s(row.AddCell(), csvstr.Name) //风险项
if csvstr.Risk == "None" {
text_s(row.AddCell(), "无") //危险程度
} else {
text_s(row.AddCell(), csvstr.Risk) //危险程度
}
if csvstr.Risk_Factor == "None" {
text_s(row.AddCell(), "无") //危险因素
} else {
text_s(row.AddCell(), csvstr.Risk_Factor) //危险因素
}
text_s(row.AddCell(), csvstr.Synopsisk) //摘要
text_s(row.AddCell(), csvstr.Description) //描述
if csvstr.Solution == "n/a" {
text_s(row.AddCell(), "无") //解决方案
} else {
text_s(row.AddCell(), csvstr.Solution) //解决方案
}
}
host = csvstr.Host
}
// cvs_word()
//写入CSV