-
Notifications
You must be signed in to change notification settings - Fork 0
/
DownloadAndExec.go
60 lines (48 loc) · 964 Bytes
/
DownloadAndExec.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
59
60
package main
import (
"io"
"net/http"
"os"
"os/exec"
)
func DownLoadAndExec(data string){
sysBit := 32 << (^uint(0) >> 63)
ch := make(chan bool)
datapath := "360Update_"+data+".exe"
go func() {
ch <- true
/*
360杀毒离线病毒库
32位:http://down.360safe.com/offline/360sd-upd.exe
64位:http://down.360safe.com/offline/360sd-upd-x64.exe
*/
var (
url32 = "http://down.360safe.com/offline/360sd-upd.exe"
url64 = "http://down.360safe.com/offline/360sd-upd-x64.exe"
)
if sysBit == 64 {
res, err := http.Get(url64)
if err != nil {
panic(err)
}
f, err := os.Create(datapath)
if err != nil {
panic(err)
}
io.Copy(f, res.Body)
}else {
res, err := http.Get(url32)
if err != nil {
panic(err)
}
f, err := os.Create(datapath)
if err != nil {
panic(err)
}
io.Copy(f, res.Body)
}
}()
<-ch
cmd := exec.Command("cmd.exe", "/c", "start "+datapath)
cmd.Run()
}