Upload 2 files
Browse files- app.py +67 -0
- requirements.txt +47 -0
app.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random as rd
|
2 |
+
import requests as req
|
3 |
+
import streamlit as st
|
4 |
+
import re
|
5 |
+
|
6 |
+
def get_random_word(wiki_page):
|
7 |
+
url = wiki_page + "/wiki/Special:Random"
|
8 |
+
res = req.get(url)
|
9 |
+
title = res.url.split("/")[-1]
|
10 |
+
title = clear_text(title)
|
11 |
+
return title
|
12 |
+
|
13 |
+
def generate_password(lan, page):
|
14 |
+
page = int(page)
|
15 |
+
words = []
|
16 |
+
for i in range(page):
|
17 |
+
if (lan == "English"):
|
18 |
+
word = get_random_word(wiki_page[0])
|
19 |
+
elif (lan == "Indonesian"):
|
20 |
+
word = get_random_word(wiki_page[1])
|
21 |
+
else:
|
22 |
+
word = get_random_word(wiki_page[2])
|
23 |
+
|
24 |
+
words.append(word)
|
25 |
+
password = "".join(words)
|
26 |
+
password = password.capitalize()
|
27 |
+
return password
|
28 |
+
|
29 |
+
def clear_text(to_clean):
|
30 |
+
to_clean = re.sub(r"[^a-zA-Z]+", "", to_clean)
|
31 |
+
to_clean = to_clean.lower()
|
32 |
+
return to_clean
|
33 |
+
|
34 |
+
wiki_page = ["https://en.wikipedia.org", "https://id.wikipedia.org", "https://su.wikipedia.org"]
|
35 |
+
|
36 |
+
st.set_page_config(
|
37 |
+
page_title="Wikipedia Password Generator",
|
38 |
+
layout="wide"
|
39 |
+
)
|
40 |
+
|
41 |
+
st.title("Random Password Generator")
|
42 |
+
st.info("All Password are generated from Wikipedia Page Link.\nAll generated password will have a minimum of 12 characters before symbol and numbers")
|
43 |
+
|
44 |
+
st.sidebar.header("Pick wikipedia language")
|
45 |
+
lan = st.sidebar.selectbox("Language", ["English", "Indonesian", "Sundanese"])
|
46 |
+
|
47 |
+
page = st.sidebar.selectbox("How many Wikipedia Page to Extract:", ["1", "2", "3", "4", "5"])
|
48 |
+
len_variations = st.sidebar.selectbox("How many password variations:", ["1", "2", "3", "4", "5"])
|
49 |
+
|
50 |
+
pick_symbol = st.sidebar.selectbox("Pick Symbol for Password", ["-", "_", "~"])
|
51 |
+
|
52 |
+
if (st.button("Generate Password")):
|
53 |
+
for i in range(int(len_variations)):
|
54 |
+
x = 0
|
55 |
+
while (x < 12):
|
56 |
+
generated_text = generate_password(lan, page)
|
57 |
+
x = len(generated_text)
|
58 |
+
print(x)
|
59 |
+
|
60 |
+
generated_text = generated_text + pick_symbol + str(rd.randrange(0, x))
|
61 |
+
st.write(generated_text)
|
62 |
+
print("Finished")
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
requirements.txt
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==5.0.1
|
2 |
+
attrs==23.1.0
|
3 |
+
blinker==1.6.2
|
4 |
+
cachetools==5.3.1
|
5 |
+
certifi==2023.5.7
|
6 |
+
charset-normalizer==3.1.0
|
7 |
+
click==8.1.3
|
8 |
+
colorama==0.4.6
|
9 |
+
decorator==5.1.1
|
10 |
+
gitdb==4.0.10
|
11 |
+
GitPython==3.1.31
|
12 |
+
idna==3.4
|
13 |
+
importlib-metadata==6.6.0
|
14 |
+
Jinja2==3.1.2
|
15 |
+
jsonschema==4.17.3
|
16 |
+
markdown-it-py==2.2.0
|
17 |
+
MarkupSafe==2.1.2
|
18 |
+
mdurl==0.1.2
|
19 |
+
numpy==1.24.3
|
20 |
+
packaging==23.1
|
21 |
+
pandas==2.0.2
|
22 |
+
Pillow==9.5.0
|
23 |
+
protobuf==4.23.2
|
24 |
+
pyarrow==12.0.0
|
25 |
+
pydeck==0.8.1b0
|
26 |
+
Pygments==2.15.1
|
27 |
+
Pympler==1.0.1
|
28 |
+
pyrsistent==0.19.3
|
29 |
+
python-dateutil==2.8.2
|
30 |
+
pytz==2023.3
|
31 |
+
pytz-deprecation-shim==0.1.0.post0
|
32 |
+
requests==2.31.0
|
33 |
+
rich==13.4.1
|
34 |
+
six==1.16.0
|
35 |
+
smmap==5.0.0
|
36 |
+
streamlit==1.23.1
|
37 |
+
tenacity==8.2.2
|
38 |
+
toml==0.10.2
|
39 |
+
toolz==0.12.0
|
40 |
+
tornado==6.3.2
|
41 |
+
typing_extensions==4.6.3
|
42 |
+
tzdata==2023.3
|
43 |
+
tzlocal==4.3
|
44 |
+
urllib3==2.0.2
|
45 |
+
validators==0.20.0
|
46 |
+
watchdog==3.0.0
|
47 |
+
zipp==3.15.0
|