mirror of
				https://github.com/inAudible-NG/audible-activator.git
				synced 2025-11-04 04:10:42 +01:00 
			
		
		
		
	Added two factor auth featuer
* Added a command line option to activate two factor auth
* Added a question on the command line for the user to input the two factor auth
    * Because the chrome driver may take some time to launch, the two factor auth step takes place after the web page has been loaded.
			
			
This commit is contained in:
		@@ -69,6 +69,10 @@ def fetch_activation_bytes(username, password, options):
 | 
				
			|||||||
        search_box = driver.find_element_by_id('ap_password')
 | 
					        search_box = driver.find_element_by_id('ap_password')
 | 
				
			||||||
        search_box.send_keys(password)
 | 
					        search_box.send_keys(password)
 | 
				
			||||||
        search_box.submit()
 | 
					        search_box.submit()
 | 
				
			||||||
 | 
					        if options.two_factor:
 | 
				
			||||||
 | 
					            search_box = driver.find_element_by_id('auth-mfa-otpcode')
 | 
				
			||||||
 | 
					            search_box.send_keys(raw_input("Enter Two-Step Verification Code: "))
 | 
				
			||||||
 | 
					            search_box.submit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Step 2
 | 
					    # Step 2
 | 
				
			||||||
    driver.get(base_url + 'player-auth-token?playerType=software&bp_ua=y&playerModel=Desktop&playerId=%s&playerManufacturer=Audible&serial=' % (player_id))
 | 
					    driver.get(base_url + 'player-auth-token?playerType=software&bp_ua=y&playerModel=Desktop&playerId=%s&playerManufacturer=Audible&serial=' % (player_id))
 | 
				
			||||||
@@ -126,23 +130,14 @@ if __name__ == "__main__":
 | 
				
			|||||||
                      dest="player_id",
 | 
					                      dest="player_id",
 | 
				
			||||||
                      default=None,
 | 
					                      default=None,
 | 
				
			||||||
                      help="Player ID in hex (for debugging, not for end users)",)
 | 
					                      help="Player ID in hex (for debugging, not for end users)",)
 | 
				
			||||||
    parser.add_option("--username",
 | 
					    parser.add_option("-t", "--two-factor",
 | 
				
			||||||
                      action="store",
 | 
					                      action="store_true",
 | 
				
			||||||
                      dest="username",
 | 
					                      dest="two_factor",
 | 
				
			||||||
                      default=False,
 | 
					                      default=False,
 | 
				
			||||||
                      help="Audible username, use along with the --password option")
 | 
					                      help="Use this option to enable two factor authentication",)
 | 
				
			||||||
    parser.add_option("--password",
 | 
					 | 
				
			||||||
                      action="store",
 | 
					 | 
				
			||||||
                      dest="password",
 | 
					 | 
				
			||||||
                      default=False,
 | 
					 | 
				
			||||||
                      help="Audible password")
 | 
					 | 
				
			||||||
    (options, args) = parser.parse_args()
 | 
					    (options, args) = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if options.username and options.password:
 | 
					    username = raw_input("Username: ")
 | 
				
			||||||
        username = options.username
 | 
					    password = getpass("Password: ")
 | 
				
			||||||
        password = options.password
 | 
					 | 
				
			||||||
    else:
 | 
					 | 
				
			||||||
        username = raw_input("Username: ")
 | 
					 | 
				
			||||||
        password = getpass("Password: ")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fetch_activation_bytes(username, password, options)
 | 
					    fetch_activation_bytes(username, password, options)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user