MiakOnline's picture
Create app.py
5e564a8 verified
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.")