forked from IsMio/haxcilent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
113 lines (105 loc) · 4.07 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
telegram "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"io"
"net/http"
"strings"
"time"
)
// Telegrambot配置//
var chatID = int64(123432) //chatid
var bottoken = "<bottoken>" //bottoken
// 网站配置//
var host = "hax.co.id" //网址host
var cookie = "lla1b35phucnme8" //PHPsessid(仅vps.vc)
// END//
func main() {
//网页配置//
whichurl := host //或者 <hax.co>
phpsessid := cookie //从浏览器中获取<仅vps.vc>
//END//
url := "https://" + whichurl + "/create-vps"
var lastOptions []string
noOptions := false
for {
resp, err := http.Get(url)
resp.Header.Add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Haxclient")
resp.Header.Add("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7")
resp.Header.Add("Host", whichurl)
resp.Header.Add("Cookie", "PHPSESSID="+phpsessid+"; _ga=GA1.3.793762279.1679893292; __cf_bm=n1O7yJJxTW9hu.qhe6QRsCcE_kAZmAH1JHs6tEvmS.U-1680529193-0-Aemg00EIOnWChqBCRsyVnwuWHdxRP+evClmW8EKRQJQgiAb+BHppJXgtZc3FOuxR655TQ1GfpXRoYi62SQbA/5fTF3uyKoWeCOxr2tUojSIQVF8JcHQQAQcRo+HMqoOY8A; FCCDCF=%5Bnull%2Cnull%2Cnull%2C%5B%22CPpSJ0APpSJ0AEsABBENC9CoAP_AAG_AABAYINJB7D7FbSFCyP57aLsAMAhXRkCAQqQCAASBAmABQAKQIAQCkkAYFESgBAACAAAgIAJBIQIMCAgACUABQAAAAAEEAAAABAAIIAAAgAEAAAAIAAACAIAAEAAIAAAAEAAAmQhAAIIACAAAhAAAIAAAAAAAAAAAAgCAAAAAAAAAAAAAAAAAAQQaQD2F2K2kKEkfjWUWYAQBCujIEAhUAEAAECBIAAAAUgQAgFIIAwAIlACAAAAABAQAQCQgAQABAAAoACgAAAAAAAAAAAAAAQQAABAAIAAAAAAAAEAQAAIAAQAAAAAAABEhCAAQQAEAAAAAAAQAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAgAA%22%2C%221~2072.70.89.93.108.122.149.196.2253.2299.259.2357.311.317.323.2373.338.358.2415.415.2506.2526.482.486.494.495.2568.2571.2575.540.574.2624.624.2677.827.864.981.1048.1051.1095.1097.1171.1201.1205.1276.1301.1365.1415.1449.1570.1577.1651.1716.1753.1765.1870.1878.1889.1958.2012%22%2C%22ED667BE9-C3D9-464E-AE09-66952825F61F%22%5D%2Cnull%2Cnull%2C%5B%5D%5D; FCNEC=%5B%5B%22AKsRol8G5fkNHyoHbXzmXFTlKM7KH0iPAJbKDS4iyZ0XLicl7tvXtuH4sNjs4RPCJC30SL7NwBJC_E11HzjQmvk5cFN7VXN5qp94lNdxbHqZn86SmCcA1PlrgOgBm-1nKp4VBR9_8qwTZf8i3Q8BXnpdn-k3ZNSu0g%3D%3D%22%5D%2Cnull%2C%5B%5D%5D; PHPSESSID=c82418d070a8c8e767e0ce303a71159a")
resp.Header.Add("Connection", "keep-alive")
if err != nil {
panic(err)
}
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
}
}(resp.Body)
if resp.StatusCode != 200 {
panic(fmt.Sprintf("status code error: %d %s", resp.StatusCode, resp.Status))
}
doc, err := goquery.NewDocumentFromReader(resp.Body)
if err != nil {
panic(err)
}
var options []string
doc.Find("#datacenter option").Each(func(i int, s *goquery.Selection) {
val, exists := s.Attr("value")
if exists && val != "" && val != "-select-" {
options = append(options, strings.TrimSpace(s.Text()))
}
})
if len(options) > 0 {
if len(lastOptions) == 0 {
fmt.Println(strings.Join(options, "\n"))
sendmsg(strings.Join(options, "\n"))
} else {
var newOptions []string
for _, opt := range options {
if !contains(lastOptions, opt) {
newOptions = append(newOptions, opt)
}
}
if len(newOptions) > 0 {
fmt.Println(strings.Join(newOptions, "\n"))
sendmsg(strings.Join(newOptions, "\n"))
}
}
lastOptions = options
} else {
if !noOptions {
fmt.Println("no options")
sendmsg("no options")
noOptions = true
}
lastOptions = nil
}
time.Sleep(1 * time.Second)
}
}
func contains(options []string, opt string) bool {
for _, o := range options {
if o == opt {
return true
}
}
fmt.Println("none")
return false
}
func sendmsg(msg string) { //chatid
bot, err := telegram.NewBotAPI(bottoken) //bottoken
if err != nil {
panic(err)
}
currentTime := time.Now().Format("2006-01-02 15:04:05.00000")
msgText := host + " machine available:\n\n" + msg + "\n\n" + "time: " + currentTime //botsend
msgconfig := telegram.NewMessage(chatID, msgText)
_, err = bot.Send(msgconfig)
if err != nil {
return
}
fmt.Println(msgText)
}