-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
36 lines (29 loc) · 860 Bytes
/
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
package main
import "flag"
func main() {
var (
username string
password string
host string
)
flag.StringVar(&username, "username", "username", "The username used to login your HN8145V")
flag.StringVar(&password, "password", "password", "The password used to login your HN8145V")
flag.StringVar(&host, "host", "localhost", "The host address without port number, such as '192.168.1.1' or 'm.example.com'")
flag.Parse()
initRandCount, err := GetRandCount(getRandCountUrl(host))
if err != nil {
panic(err)
}
cookie, err := LoginAndGetCookie(getLoginUrl(host), username, password, initRandCount)
if err != nil {
panic(err)
}
patchRandCount, err := GetDevicePageRandCount(getDevicePageUrl(host), cookie)
if err != nil {
panic(err)
}
err = Patch(getPatchPageUrl(host), patchRandCount, cookie)
if err != nil {
panic(err)
}
}