Esword618
This commit is contained in:
parent
cdd522f029
commit
30d5dd08e5
65
main.go
65
main.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dt_automate/method"
|
||||
"dt_automate/tool"
|
||||
"dt_automate/wps"
|
||||
"flag"
|
||||
@ -52,28 +53,28 @@ func main() {
|
||||
log.Println("没有授权")
|
||||
}
|
||||
}
|
||||
if urls != "" {
|
||||
key := tool.Keyprin(tool.Auth_main()["key"])
|
||||
if key.End_time != "" {
|
||||
a, _ := strconv.ParseInt(key.End_time, 10, 64)
|
||||
// b, _ := strconv.ParseInt(key.Initial_time, 10, 64)
|
||||
duration := time.Unix(a, 0).Sub(time.Unix(tool.Timestamp("second"), 0))
|
||||
days := int(duration / (24 * time.Hour)) //天
|
||||
hours := int(duration % (24 * time.Hour) / time.Hour) //小时
|
||||
minutes := int(duration / time.Minute % 60) //分钟
|
||||
secod := int(duration / time.Second % 60) //秒
|
||||
if days <= 0 && hours <= 0 && minutes <= 0 {
|
||||
log.Printf("授权已到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
} else {
|
||||
log.Printf("授权未到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
//可执行程序位置
|
||||
// if urls != "" {
|
||||
// key := tool.Keyprin(tool.Auth_main()["key"])
|
||||
// if key.End_time != "" {
|
||||
// a, _ := strconv.ParseInt(key.End_time, 10, 64)
|
||||
// // b, _ := strconv.ParseInt(key.Initial_time, 10, 64)
|
||||
// duration := time.Unix(a, 0).Sub(time.Unix(tool.Timestamp("second"), 0))
|
||||
// days := int(duration / (24 * time.Hour)) //天
|
||||
// hours := int(duration % (24 * time.Hour) / time.Hour) //小时
|
||||
// minutes := int(duration / time.Minute % 60) //分钟
|
||||
// secod := int(duration / time.Second % 60) //秒
|
||||
// if days <= 0 && hours <= 0 && minutes <= 0 {
|
||||
// log.Printf("授权已到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
// } else {
|
||||
// log.Printf("授权未到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
// //可执行程序位置
|
||||
|
||||
}
|
||||
// log.Println(days, hours, minutes, secod) //剩余时间
|
||||
} else {
|
||||
log.Println("没有授权,请联系管理员")
|
||||
}
|
||||
}
|
||||
// }
|
||||
// // log.Println(days, hours, minutes, secod) //剩余时间
|
||||
// } else {
|
||||
// log.Println("没有授权,请联系管理员")
|
||||
// }
|
||||
// }
|
||||
if runs {
|
||||
key := tool.Keyprin(tool.Auth_main()["key"])
|
||||
if key.End_time != "" {
|
||||
@ -90,20 +91,18 @@ func main() {
|
||||
log.Printf("授权未到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
//可执行程序位置
|
||||
// 互联网区
|
||||
// method.HW_FAC1() //截取流量清洗的图片
|
||||
// method.HW_FW1() //截取防火墙的图片
|
||||
// method.HW_TSGZ() //截取态势感知的图片
|
||||
// method.HW_DTCLOUD() //截取运维中心的图片
|
||||
wps.HW_SYS_Word() //运维平台word文档生成
|
||||
method.HW_FAC1() //截取流量清洗的图片
|
||||
method.HW_FW1() //截取防火墙的图片
|
||||
method.HW_TSGZ() //截取态势感知的图片
|
||||
method.HW_DTCLOUD() //截取运维中心的图片
|
||||
wps.HW_SYS_Word() //运维平台word文档生成
|
||||
//政务网区
|
||||
// // method.ZWW_FW1() //截取防火墙的图片
|
||||
// // method.ZWW_TSGZ() //截取态势感知的图片
|
||||
wps.ZWW_SYS_Word() //运维平台word文档生成
|
||||
method.ZWW_FW1() //截取防火墙的图片
|
||||
method.ZWW_TSGZ() //截取态势感知的图片
|
||||
method.ZWW_DTCLOUD() //截取运维中心的图片
|
||||
wps.ZWW_SYS_Word() //运维平台word文档生成
|
||||
//安全巡检文档生成
|
||||
wps.SAFET_Word() //安全巡检文档生成
|
||||
// wps.Damo()
|
||||
// method.ZWW_DTCLOUD() //截取运维中心的图片
|
||||
// attackevent.FW_Job()
|
||||
}
|
||||
} else {
|
||||
log.Println("没有授权")
|
||||
@ -120,7 +119,7 @@ func main() {
|
||||
func init() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
|
||||
fmt.Println(" -url https://www.douyin.com 指定URL地址")
|
||||
// fmt.Println(" -url https://www.douyin.com 指定URL地址")
|
||||
fmt.Println(" -v 查看授权状态")
|
||||
fmt.Println(" -run 开始截取图片")
|
||||
// fmt.Println(" -h, 帮助信息")
|
||||
|
@ -2,7 +2,7 @@ package method
|
||||
|
||||
import (
|
||||
"dt_automate/tool"
|
||||
"dt_automate/wtch_ocr"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/playwright-community/playwright-go"
|
||||
@ -50,14 +50,14 @@ func HW_TSGZ() {
|
||||
Path: playwright.String("img/capt.png"),
|
||||
})
|
||||
a := page.Locator(`.el-input__inner`)
|
||||
result := wtch_ocr.OcrDefault("img/capt.png")
|
||||
if len(result.OcrResponse[0].Text) == 4 {
|
||||
log.Println("读取验证码:", result.OcrResponse[0].Text)
|
||||
a.Nth(2).Fill(result.OcrResponse[0].Text)
|
||||
} else {
|
||||
page.WaitForTimeout(500)
|
||||
page.Locator(".verification-item .el-image .el-image__inner").Click()
|
||||
}
|
||||
// result := wtch_ocr.OcrDefault("img/capt.png")
|
||||
// if len(result.OcrResponse[0].Text) == 4 {
|
||||
// log.Println("读取验证码:", result.OcrResponse[0].Text)
|
||||
// a.Nth(2).Fill(result.OcrResponse[0].Text)
|
||||
// } else {
|
||||
// page.WaitForTimeout(500)
|
||||
// page.Locator(".verification-item .el-image .el-image__inner").Click()
|
||||
// }
|
||||
|
||||
// Screenshot(playwright.PageScreenshotOptions{})
|
||||
// (playwright.PageScreenshotOptions{
|
||||
@ -68,6 +68,10 @@ func HW_TSGZ() {
|
||||
a.Nth(0).Fill("admin")
|
||||
page.WaitForTimeout(500)
|
||||
a.Nth(1).Fill("BWySN~QjrlwFsA)@#h")
|
||||
var name string
|
||||
fmt.Print("请输入验证码:")
|
||||
fmt.Scanf("%s", &name)
|
||||
a.Nth(2).Fill(name)
|
||||
page.WaitForTimeout(500)
|
||||
//点击同意
|
||||
if err := page.Locator(`.el-checkbox__inner`).Click(); err != nil {
|
||||
|
@ -2,7 +2,7 @@ package method
|
||||
|
||||
import (
|
||||
"dt_automate/tool"
|
||||
"dt_automate/wtch_ocr"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/playwright-community/playwright-go"
|
||||
@ -45,19 +45,21 @@ func ZWW_TSGZ() {
|
||||
log.Fatalf("could not go to the page: %v", err)
|
||||
}
|
||||
|
||||
page.WaitForTimeout(2000)
|
||||
page.Locator(`.verification-item .el-image`).Screenshot(playwright.LocatorScreenshotOptions{
|
||||
Path: playwright.String("img/capt.png"),
|
||||
})
|
||||
// page.WaitForTimeout(2000)
|
||||
// page.Locator(`.verification-item .el-image`).Screenshot(playwright.LocatorScreenshotOptions{
|
||||
// Path: playwright.String("img/capt.png"),
|
||||
// })
|
||||
|
||||
a := page.Locator(`.el-input__inner`)
|
||||
result := wtch_ocr.OcrDefault("img/capt.png")
|
||||
if len(result.OcrResponse[0].Text) == 4 {
|
||||
log.Println("读取验证码:", result.OcrResponse[0].Text)
|
||||
a.Nth(2).Fill(result.OcrResponse[0].Text)
|
||||
} else {
|
||||
page.WaitForTimeout(500)
|
||||
page.Locator(".verification-item .el-image .el-image__inner").Click()
|
||||
}
|
||||
|
||||
// result := wtch_ocr.OcrDefault("img/capt.png")
|
||||
// if len(result.OcrResponse[0].Text) == 4 {
|
||||
// log.Println("读取验证码:", result.OcrResponse[0].Text)
|
||||
// a.Nth(2).Fill(result.OcrResponse[0].Text)
|
||||
// } else {
|
||||
// page.WaitForTimeout(500)
|
||||
// page.Locator(".verification-item .el-image .el-image__inner").Click()
|
||||
// }
|
||||
|
||||
// Screenshot(playwright.PageScreenshotOptions{})
|
||||
// (playwright.PageScreenshotOptions{
|
||||
@ -68,6 +70,10 @@ func ZWW_TSGZ() {
|
||||
a.Nth(0).Fill("admin")
|
||||
page.WaitForTimeout(500)
|
||||
a.Nth(1).Fill("tov6LeR*R6Or_jiUC")
|
||||
var name string
|
||||
fmt.Print("请输入验证码:")
|
||||
fmt.Scanf("%s", &name)
|
||||
a.Nth(2).Fill(name)
|
||||
page.WaitForTimeout(500)
|
||||
//点击同意
|
||||
if err := page.Locator(`.el-checkbox__inner`).Click(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user