tt / app.py
enotkrutoy's picture
Rename appw.py to app.py
bab5d1c verified
raw
history blame
2.58 kB
import streamlit as st
from components.passbeaker import PasswordCracker
import io
def crack_password(password_hash, wordlist_file, algorithm, salt, parallel, complexity, min_length, max_length, character_set, brute_force):
# Сохранение содержимого загруженного файла в локальную переменную
wordlist_content = wordlist_file.read().decode("latin-1")
# Создание экземпляра PasswordCracker
cracker = PasswordCracker(
password_hash=password_hash,
wordlist_file=wordlist_content,
algorithm=algorithm,
salt=salt,
parallel=parallel,
complexity_check=complexity
)
if brute_force:
cracker.crack_passwords_with_brute_force(min_length, max_length, character_set)
else:
cracker.crack_passwords_with_wordlist()
return cracker.get_statistics()
def main():
st.title("GVA Password Cracker")
st.sidebar.header("Settings")
password_hash = st.sidebar.text_input("Password Hash")
wordlist_file = st.sidebar.file_uploader("Upload Wordlist File", type=['txt'])
algorithm = st.sidebar.selectbox("Hash Algorithm", ["md5", "sha1", "sha256", "sha512"])
salt = st.sidebar.text_input("Salt (optional)")
parallel = st.sidebar.checkbox("Use Parallel Processing")
complexity = st.sidebar.checkbox("Check for Password Complexity")
min_length = st.sidebar.number_input("Minimum Password Length", min_value=1, value=1)
max_length = st.sidebar.number_input("Maximum Password Length", min_value=1, value=6)
character_set = st.sidebar.text_input("Character Set", "abcdefghijklmnopqrstuvwxyz0123456789")
brute_force = st.sidebar.checkbox("Perform Brute Force Attack")
if st.sidebar.button("Crack Password"):
if wordlist_file:
cracking_spinner = st.spinner("Cracking...")
with cracking_spinner:
stats = crack_password(
password_hash=password_hash,
wordlist_file=wordlist_file,
algorithm=algorithm,
salt=salt,
parallel=parallel,
complexity=complexity,
min_length=min_length,
max_length=max_length,
character_set=character_set,
brute_force=brute_force
)
st.success(stats)
st.balloons()
else:
st.error("Please upload a wordlist file.")
if __name__ == "__main__":
main()