-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/indexxx.json | ||
/PassGo.exe | ||
/PassGo.exe~ | ||
/Financial.pdf | ||
/Finance.pdf | ||
/timetable.pdf | ||
/cs.html | ||
gopher.png | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters