diff --git a/BlackBoardHVCCAutoLogin.plist b/BlackBoardHVCCAutoLogin.plist new file mode 100644 index 0000000..0fb5f8b --- /dev/null +++ b/BlackBoardHVCCAutoLogin.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.blackboard.student" ); }; } diff --git a/License.md b/License.md new file mode 100644 index 0000000..06b767a --- /dev/null +++ b/License.md @@ -0,0 +1,43 @@ +Copyright (c) 2018 Gh0stByte + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, or distribute copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +In addition to the above terms, you are prohibited from charging money for the +Software. You may not accept donations, purchases, or any other form of monetary +transactions for your work on or hosting Melody. + +You may not modify the included list of developers and other people who have +contributed to the software or any donation links in the compiled tweak +or source code without the express approval of Gh0stByte beforehand. + +You may not submit a compiled version of this Software or any other software using +its source code to any repository included upon the initial installation of Cydia +("default repositories") or commercial Cydia repository without the consent of +Gh0stByte. What is defined as a "commercial Cydia repository" in this license is +up to the descretion of Gh0stByte. + +By using any of the source code of the Software in any other pieces of software, +you agree to the terms of this license. You must also include the original Credits +from the Software in that piece of software. + +When distributing this tweak, you must provide notices which make it clear that +the Software is originally and mainly developed by Gh0stByte, you are not associated +with AppleBetas in any way, shape, or form. If necessary, +please also state that your version of the Software has been modified and may behave +incorrectly or differently than the original Software. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4849795 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = BlackBoardHVCCAutoLogin +BlackBoardHVCCAutoLogin_FILES = Tweak.xm +BlackBoardHVCCAutoLogin_FRAMEWORKS = UIKit +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 BbStudent" + diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..7a732bf --- /dev/null +++ b/Readme.md @@ -0,0 +1,59 @@ +# Auto-login / Auto-fill for Blackboard's iOS app (Hudson Valley Community College) +====== + +## About + +This tweak will auto-fill your username and password for HVCC's single sign-on. Very helpfull if you use blackboard across multiple devices and keep having to re-login manually on your mobile. + +## Media + +![Screenshot](../media/IMG_5010.PNG "Setup Screen") +![Screenshot](../media/IMG_5011.PNG "When 'Help' is pressed") + + +## Installation + +Go to Releases and download latest deb & install with iFile, Filza, dpkg or whatever suits your fancy. + +OR + +Clone repo and compile with theos + + +## Usage + +### Setup Auto-fill + +* Select "SUNY - Hudson Valleu Community College" from the dropdown menu +* Click the "Web Login" +* Enter your username & password and hit "OK" +* Click Web Login button again and give it a second. +* Enjoy never having to type your username and password in again! + +### Resetting your login information + +* Logout if not already +* Press the help button +* Choose "Change" +* Fill out user & pass then "OK" + +## Contributing + +1. Fork it! +2. Create your feature branch: `git checkout -b add-my-uni` +3. Commit your changes: `git commit -am 'Add support for my college'` +4. Push to the branch: `git push origin add-my-uni` +5. Submit a pull request :D + +## History/Changelog + +#### 1.0.0 (1/16/2018) +* Initial Release + +## Credits + +Made by [Gh0stByte](http://twitter.com/Gh0stByte) + +## License +### Modified MIT License. READ IN FULL *BEFORE* USE +[License.md](../License.md) \ No newline at end of file diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..31fa6d8 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,91 @@ +NSString *username, *password; + +// Hook into the main view controller +%hook BBLFTWViewController + +// Hook into when the login page finishes loading +- (void)webViewDidFinishLoad:(UIWebView *)webView { + // The javascript that we're gonna execute, which will set the username & password to what we've stored + NSString *inject = [NSString stringWithFormat:@"document.getElementById('username').value = '%@';document.getElementById('password').value = '%@';", username, password]; + // Inject the JS + [webView stringByEvaluatingJavaScriptFromString:inject]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) + { + // Submit the form by pressing the button. + [webView stringByEvaluatingJavaScriptFromString:@"document.forms[\"fm1\"].submit.click();"]; + }); + %orig; +} + +%end + +// Interface so we can call our custom method +@interface BBLFTWViewController : UIViewController +-(void)getAutofillInfo; +@end + +// Hook into the login view controller +%hook BBLoginViewController + +// Hook into when the login button is pressed +-(void)loginBtnTapped { + // Grab your username and password from the userdefaults + username = [[NSUserDefaults standardUserDefaults] objectForKey:@"USERNAME"]; + password = [[NSUserDefaults standardUserDefaults] objectForKey:@"PASSWORD"]; + // If you don't have an username & password setup + if(!(username && password) || ([username isEqualToString:@""] || [password isEqualToString:@""])) { + // Setup your username & password + [self getAutofillInfo]; + } else { + // Otherwise, load up the webview + %orig; + } +} + +// Hook into when the help button is tapped +-(void)helpBtnTapped { + // Ask the user if they want to change their information + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Auto-Login" message:@"Would you like to change your login information?" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"Change" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + // If so, setup their username and pass + [self getAutofillInfo]; + }]; + [alertController addAction:confirmAction]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + // Otherwise, use the normal function for the help button + %orig; + }]; + [alertController addAction:cancelAction]; + // Present the alert + [self presentViewController:alertController animated:YES completion:nil]; +} + +// New function to get the login info +%new +-(void)getAutofillInfo { + // Ask the user to enter their input + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Auto-Login" message:@"Enter your username & password\n(Note: Information stored plaintext in the standard app defaults. To change the information, press the help button)" preferredStyle:UIAlertControllerStyleAlert]; + [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + textField.placeholder = @"Username"; + }]; + [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + textField.placeholder = @"Password"; + textField.secureTextEntry = YES; + }]; + UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + //Store the information + [[NSUserDefaults standardUserDefaults] setObject:[[alertController textFields][0] text] forKey:@"USERNAME"]; + [[NSUserDefaults standardUserDefaults] setObject:[[alertController textFields][1] text] forKey:@"PASSWORD"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + }]; + [alertController addAction:confirmAction]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + }]; + [alertController addAction:cancelAction]; + // Show the alert + [self presentViewController:alertController animated:YES completion:nil]; +} + +%end \ No newline at end of file diff --git a/control b/control new file mode 100644 index 0000000..eecdcae --- /dev/null +++ b/control @@ -0,0 +1,11 @@ +Package: ga.gh0stbyte.blackboardhvcc +Name: BlackBoard AutoLogin (HVCC) +Depends: mobilesubstrate +Version: 1.0.0 +Architecture: iphoneos-arm +Description: Auto HVCC SSO login + Allows you to login to HVCC through + the blackboard app automatically +Maintainer: Gh0stByte +Author: Gh0stByte +Section: Tweaks diff --git a/media/IMG_5010.PNG b/media/IMG_5010.PNG new file mode 100644 index 0000000..b5c8da6 Binary files /dev/null and b/media/IMG_5010.PNG differ diff --git a/media/IMG_5011.PNG b/media/IMG_5011.PNG new file mode 100644 index 0000000..5deccf2 Binary files /dev/null and b/media/IMG_5011.PNG differ diff --git a/packages/ga.gh0stbyte.blackboardhvcc_1.0.0_iphoneos-arm.deb b/packages/ga.gh0stbyte.blackboardhvcc_1.0.0_iphoneos-arm.deb new file mode 100644 index 0000000..65e85a2 Binary files /dev/null and b/packages/ga.gh0stbyte.blackboardhvcc_1.0.0_iphoneos-arm.deb differ