Update app.py
Browse files
app.py
CHANGED
|
@@ -3,11 +3,12 @@ import pandas as pd
|
|
| 3 |
import numpy as np
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
import seaborn as sns
|
| 6 |
-
from wordlist_generator import generate_wordlist #
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
import os
|
| 9 |
|
| 10 |
-
|
|
|
|
| 11 |
access_token = os.getenv("HUGGINGFACE_ACCESS_TOKEN")
|
| 12 |
|
| 13 |
# Page configuration
|
|
@@ -41,68 +42,72 @@ include_numbers = st.sidebar.checkbox("Include Numbers", value=True)
|
|
| 41 |
# Display wordlist generation results
|
| 42 |
st.header("Generated Wordlist Preview")
|
| 43 |
|
| 44 |
-
#
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
#
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
st.
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
# Visualize wordlist statistics (for example, word length distribution)
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
ax.
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
# Advanced Feature - Analyzing Wordlist Security
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
entropy
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
# Additional Analysis (Average Word Length)
|
| 103 |
-
st.header("Additional Analysis: Average Word Length")
|
| 104 |
-
avg_word_length = np.mean(word_lengths)
|
| 105 |
-
st.write(f"Average Word Length: {avg_word_length:.2f} characters")
|
| 106 |
|
| 107 |
# Footer
|
| 108 |
st.markdown("---")
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
import seaborn as sns
|
| 6 |
+
from wordlist_generator import generate_wordlist # A mock-up function for your project
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
import os
|
| 9 |
|
| 10 |
+
# Load environment variables from .env file
|
| 11 |
+
load_dotenv()
|
| 12 |
access_token = os.getenv("HUGGINGFACE_ACCESS_TOKEN")
|
| 13 |
|
| 14 |
# Page configuration
|
|
|
|
| 42 |
# Display wordlist generation results
|
| 43 |
st.header("Generated Wordlist Preview")
|
| 44 |
|
| 45 |
+
# Handle the generation process
|
| 46 |
+
try:
|
| 47 |
+
# Call to a mock-up function for wordlist generation (you will replace this with your actual logic)
|
| 48 |
+
wordlist = generate_wordlist(
|
| 49 |
+
size=wordlist_size,
|
| 50 |
+
min_length=min_length,
|
| 51 |
+
max_length=max_length,
|
| 52 |
+
special_chars=include_special_chars,
|
| 53 |
+
numbers=include_numbers
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
# Show the first 20 items in the wordlist
|
| 57 |
+
st.write(f"Preview of {wordlist_size} words:")
|
| 58 |
+
st.dataframe(pd.DataFrame(wordlist[:20], columns=["Generated Words"])) # Display as a table for better interaction
|
| 59 |
+
|
| 60 |
+
# Provide a download link for the full wordlist
|
| 61 |
+
st.markdown("### Download Full Wordlist")
|
| 62 |
+
csv_data = pd.Series(wordlist).to_csv(index=False).encode()
|
| 63 |
+
st.download_button(
|
| 64 |
+
label="Download Wordlist as CSV",
|
| 65 |
+
data=csv_data,
|
| 66 |
+
file_name="reconninja_wordlist.csv",
|
| 67 |
+
mime="text/csv"
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
except Exception as e:
|
| 71 |
+
st.error(f"Error generating wordlist: {e}")
|
| 72 |
|
| 73 |
# Visualize wordlist statistics (for example, word length distribution)
|
| 74 |
+
if wordlist:
|
| 75 |
+
st.header("Wordlist Statistics")
|
| 76 |
+
|
| 77 |
+
# Calculate the word lengths
|
| 78 |
+
word_lengths = [len(word) for word in wordlist]
|
| 79 |
+
word_length_df = pd.DataFrame(word_lengths, columns=["Word Length"])
|
| 80 |
+
|
| 81 |
+
# Create a histogram to show the distribution of word lengths
|
| 82 |
+
fig, ax = plt.subplots(figsize=(8, 6))
|
| 83 |
+
sns.histplot(word_length_df["Word Length"], kde=True, bins=20, ax=ax)
|
| 84 |
+
ax.set_title("Word Length Distribution")
|
| 85 |
+
ax.set_xlabel("Word Length")
|
| 86 |
+
ax.set_ylabel("Frequency")
|
| 87 |
+
st.pyplot(fig)
|
| 88 |
|
| 89 |
# Advanced Feature - Analyzing Wordlist Security
|
| 90 |
+
if wordlist:
|
| 91 |
+
st.header("Analyze Wordlist Security")
|
| 92 |
+
|
| 93 |
+
# Slider for password entropy calculation
|
| 94 |
+
entropy_slider = st.slider(
|
| 95 |
+
"Select Entropy Multiplier",
|
| 96 |
+
min_value=1.0,
|
| 97 |
+
max_value=10.0,
|
| 98 |
+
value=3.0,
|
| 99 |
+
step=0.1
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
# Simulate password entropy calculation (simple calculation for demonstration)
|
| 103 |
+
entropy = np.log2(len(wordlist) ** entropy_slider)
|
| 104 |
+
st.write(f"Estimated Entropy: {entropy:.2f} bits")
|
| 105 |
+
|
| 106 |
+
# Showcase a mock security analysis (this would be expanded in your actual app)
|
| 107 |
+
if entropy < 50:
|
| 108 |
+
st.warning("Low entropy detected! This wordlist might be vulnerable to brute-force attacks.")
|
| 109 |
+
else:
|
| 110 |
+
st.success("Good entropy! This wordlist is secure against most brute-force attempts.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
# Footer
|
| 113 |
st.markdown("---")
|