diff --git a/.gitignore b/.gitignore index 6ad22e3..651bcc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /indexxx.json /PassGo.exe /PassGo.exe~ -/Financial.pdf +/Finance.pdf /timetable.pdf /cs.html gopher.png diff --git a/go.mod b/go.mod index c154aec..b15c261 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,12 @@ module PassGo go 1.19 -require golang.org/x/term v0.0.0-20220919170432-7a66f970e087 +require ( + github.com/sqweek/dialog v0.0.0-20220809060634-e981b270ebbf + golang.org/x/term v0.0.0-20220919170432-7a66f970e087 +) require ( github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect - github.com/sqweek/dialog v0.0.0-20220809060634-e981b270ebbf // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect ) diff --git a/imaalum/imaalum.go b/imaalum/imaalum.go index 2fe27d8..6d13cac 100644 --- a/imaalum/imaalum.go +++ b/imaalum/imaalum.go @@ -88,8 +88,7 @@ func GetGeneralExamTimeTable(ws *sync.WaitGroup, client *ImaalumClient) { } _ = os.WriteFile("timetable.pdf", bodyBytes, 0644) - dialog.XPlatMessageBox("Done", "course_timetable Downloaded") - ws.Done() + dialog.XPlatMessageBox("Done", "Exam Timetable Downloaded") } @@ -119,7 +118,7 @@ func GetConfimationSlip(ws *sync.WaitGroup, client *ImaalumClient) { _ = os.WriteFile("cs.html", bodyBytes, 0644) - dialog.XPlatMessageBox("Done", "Download Complete") + dialog.XPlatMessageBox("Done", "Confirmation Slip download complete") } client.client.Get("https://cas.iium.edu.my:8448/cas/logout?service=http://imaluum.iium.edu.my/") diff --git a/libs/imaalum.go b/libs/imaalum.go new file mode 100644 index 0000000..4b30e61 --- /dev/null +++ b/libs/imaalum.go @@ -0,0 +1 @@ +package libs \ No newline at end of file diff --git a/libs/wifi.go b/libs/wifi.go new file mode 100644 index 0000000..f90dd21 --- /dev/null +++ b/libs/wifi.go @@ -0,0 +1,77 @@ +package libs + +import ( + "PassGo/dialog" + userstruct "PassGo/model/user" + "crypto/tls" + "encoding/base64" + "encoding/json" + "fmt" + "io/fs" + "log" + "net/http" + "net/url" + "os" +) + +func store_pass(username string, password string) { + userVal := username + passwordVal := password + encodeUser := base64.StdEncoding.EncodeToString([]byte(userVal)) + encodePass := base64.StdEncoding.EncodeToString([]byte(passwordVal)) + data := userstruct.User{ + User: encodeUser, + Password: encodePass, + } + // fmt.Println(data) + file, _ := json.MarshalIndent(data, "", " ") + err2 := os.WriteFile("indexxx.json", file, fs.ModePerm) + if err2 != nil { + log.Fatal(err2) + } +} +func logout_network() { + transCfg := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // ignore expired SSL certificates + } + client := &http.Client{Transport: transCfg} + _, err := client.Get("https://captiveportalmahallahgombak.iium.edu.my/auth/logout.html") + if err != nil { + dialog.XPlatMessageBox("ERROR", "UNABLE TO LOGOUT (I GUESS)") + } + dialog.XPlatMessageBox("SUCCESS", "YOU ARE LOGGED OUT OF IIUM-STUDENT") + +} +func connect_network() { + file, err := os.ReadFile("indexxx.json") + if err != nil { + log.Fatal(err) + } + var UserStruct userstruct.User + json.Unmarshal(file, &UserStruct) + decodeUser, _ := base64.StdEncoding.DecodeString(UserStruct.User) + decodePass, _ := base64.StdEncoding.DecodeString(UserStruct.Password) + formVal := url.Values{ + "user": {string(decodeUser)}, + "password": {string(decodePass)}, + "url": {"http://www.iium.edu.my/"}, + "cmd": {"authenticate"}, + "Login": {"Log In"}, + } + transCfg := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // ignore expired SSL certificates + } + client := &http.Client{Transport: transCfg} + resp, err := client.PostForm("https://captiveportalmahallahgombak.iium.edu.my/cgi-bin/login", formVal) + + if err != nil { + dialog.XPlatMessageBox("ERROR", err.Error()) + log.Fatal(err) + } + var res map[string]interface{} + + json.NewDecoder(resp.Body).Decode(&res) + dialog.XPlatMessageBox("SUCCESS", "You are now connected to IIUM-Student") + fmt.Println(res) + +} diff --git a/main.dll b/main.dll new file mode 100644 index 0000000..33c75e8 Binary files /dev/null and b/main.dll differ diff --git a/main.go b/main.go index d94280e..586c867 100644 --- a/main.go +++ b/main.go @@ -187,4 +187,7 @@ func connect_network() { } +<<<<<<< HEAD // MessageBox of Win32 API. +======= +>>>>>>> 9e3846fd639fc98ebf62c38d0215ee126184cc39