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.")