-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
executable file
·65 lines (44 loc) · 1.6 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
59
60
61
62
63
64
65
package main
import (
"nqc.cn/utils"
"encoding/json"
"fmt"
"strings"
"time"
)
var config map[string]interface{}
func main() {
data := utils.ReadFile("config.json")
err := json.Unmarshal([]byte(data), &config)
if err != nil {
panic(err)
}
data1 := utils.PostData("http://125.70.230.211:10010/GetCert","config=" + data)
var result map[string]interface{}
err = json.Unmarshal([]byte(data1), &result)
if err != nil {
panic(err)
}
fmt.Println("data1:",data1)
fmt.Println("result:",result)
list := result["list"].([]interface{})
for index,value := range list {
fmt.Println("list : ", strings.Split(value.(string),"?verification="))
fmt.Println("uri :",config["checkPath"].(string) + "/" + strings.Split(value.(string),"?verification=")[1])
data2 := GETS(value.(string),result["PHPSESSID"].(string))
fmt.Println(index," : 验证文件: ",value.(string) + " : " ,data2)
utils.WriteToFile(config["checkPath"].(string) + "/" + strings.Split(value.(string),"?verification=")[1],data2)
}
var times time.Duration = (time.Duration)(config["SleepTime"].(float64))
time.Sleep(time.Second * times)
data1 = utils.PostData("http://125.70.230.211:10010/CheckDomain","config=" + data)
fmt.Println("data2:",data1)
err = json.Unmarshal([]byte(data1), &result)
if err != nil {
panic(err)
}
Cert := result["Cert"].(map[string]interface{})
crt := Cert["certificate"].(string) + "\n\n" + Cert["certificate_bundle"].(string)
utils.WriteToFile(config["savePath"].(string) + "/server.crt",crt)
utils.WriteToFile(config["savePath"].(string) + "/server.key",Cert["certificate_private"].(string))
}