-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.go
48 lines (48 loc) · 1.33 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
package main
import (
"fmt"
"os"
"net/http"
"io/ioutil"
)
func main() {
fmt.Println(" ____ _ ____ ____ _ _ ____ ")
fmt.Println("/ ___| __ _| | ___ _ _ __ __ _| _ \\| _ \\| \\ | / ___| ")
fmt.Println("\\___ \\ / _` | |/ / | | | '__/ _` | | | | | | | \\| \\___ \\ ")
fmt.Println(" ___) | (_| | <| |_| | | | (_| | |_| | |_| | |\\ |___) |")
fmt.Println("|____/ \\__,_|_|\\_\\\\__,_|_| \\__,_|____/|____/|_| \\_|____/ ")
fmt.Println("")
if len(os.Args) < 3 {
fmt.Println("Invalid arguments")
fmt.Println("")
fmt.Println("Usage: command <username> <access_token>")
os.Exit(0)
} else {
username := os.Args[1]
token := os.Args[2]
fmt.Println("Login with username: " + username)
resp, err := http.Get("https://api.akkariin.com:24443/getip/")
if err != nil {
// handle error
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
// handle error
}
ip := string(body)
fmt.Println("IP: " + ip)
fmt.Println("Try to connect the server...")
data, err := http.Get("https://dmc-12.cn/?action=update&user=" + username + "&token=" + token + "&ip=" + ip)
if err != nil {
// handle error
}
defer data.Body.Close()
stream, err := ioutil.ReadAll(data.Body)
if err != nil {
// handle error
}
result := string(stream)
fmt.Println(result)
}
}