-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
64 lines (47 loc) · 1.27 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
"github.com/Unknwon/goconfig"
"golang.org/x/sys/windows/registry"
"time"
)
func main() {
var filePath string
//访问注册表查看360安装目录是否存在
k,err := registry.OpenKey(registry.LOCAL_MACHINE,`SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\360sd.exe`,registry.QUERY_VALUE)
if err != nil{
fmt.Println("未检测到安装360杀毒")
}else {
s,_,err := k.GetStringValue("Path")
filePath = s
if err != nil{
panic(err)
}
fmt.Println("检测到已安装360杀毒")
fmt.Printf("安装目录为:%s\n",s)
}
defer k.Close()
configFile,err := goconfig.LoadConfigFile(filePath+"\\setting.ini")
var currentDate string
if err!=nil {
panic(err)
}else {
value,err := configFile.GetValue("engupdate","1")
if err!=nil {
panic(err)
}else {
currentDate = string([]rune(value)[:10])
fmt.Println("本地病毒库日期:",currentDate)
}
}
newDate,_ := SpiderPage()
fmt.Println("最新的病毒库日期:",newDate)
currentTime, _ := time.Parse("2006-01-02 15:04:05",currentDate)
newTime,_ := time.Parse("2006-01-02 15:04:05",newDate)
if currentTime.Before(newTime) {
fmt.Println("执行下载更新...")
DownLoadAndExec(newDate)
}else {
fmt.Println("已是最新病毒库版本")
}
}