Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import msoffcrypto | |
| import io | |
| st.set_page_config(page_title="AliMiak XLS Recovery", layout="centered") | |
| st.title("π AliMiak_XLS_Recovery_App") | |
| st.markdown("**For personal Excel (.xlsx) file recovery β lost password support**") | |
| uploaded_file = st.file_uploader("π Upload your locked .xlsx file", type=["xlsx"]) | |
| default_passwords = ['msexcel', 'excel', 'adore2u', 'adore', 'miak786', '123456', 'password'] | |
| user_pass_input = st.text_input("π Optional: Enter your own password guesses (comma-separated)", value="") | |
| if user_pass_input: | |
| custom_passwords = [x.strip() for x in user_pass_input.split(',')] | |
| password_list = custom_passwords + default_passwords | |
| else: | |
| password_list = default_passwords | |
| if uploaded_file and st.button("π Try Unlocking"): | |
| success = False | |
| for pwd in password_list: | |
| try: | |
| office_file = msoffcrypto.OfficeFile(uploaded_file) | |
| office_file.load_key(password=pwd) | |
| decrypted = io.BytesIO() | |
| office_file.decrypt(decrypted) | |
| st.success(f"β File unlocked with password: `{pwd}`") | |
| st.download_button("π₯ Download Decrypted File", decrypted.getvalue(), file_name="unlocked_file.xlsx") | |
| success = True | |
| break | |
| except Exception: | |
| continue | |
| if not success: | |
| st.error("β Could not unlock the file with given passwords.") | |