Skip to content

Commit

Permalink
Create main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kasuganosoras authored Jan 20, 2019
1 parent 7c4ba49 commit 5441978
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,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)
}
}

0 comments on commit 5441978

Please sign in to comment.