Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ def defang_url(url: str) -> str:
|
|
16 |
This function replaces the protocol and dots.
|
17 |
For example:
|
18 |
https://example.com --> hxxps://example[.]com
|
19 |
-
|
20 |
-
#
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
#
|
27 |
return url.replace(".", "[.]")
|
28 |
|
29 |
st.title("URL Typosquatting Detection with URLGuardian")
|
@@ -35,7 +35,7 @@ st.markdown(
|
|
35 |
model_path = "./URLGuardian"
|
36 |
classifier = load_classifier(model_path)
|
37 |
|
38 |
-
url = st.text_input("Enter the URL:", value="
|
39 |
|
40 |
if st.button("Check Safety of the url"):
|
41 |
if url:
|
|
|
16 |
This function replaces the protocol and dots.
|
17 |
For example:
|
18 |
https://example.com --> hxxps://example[.]com
|
19 |
+
"""
|
20 |
+
# Replace the protocol
|
21 |
+
if url.startswith("https://"):
|
22 |
+
url = url.replace("https://", "hxxps://")
|
23 |
+
elif url.startswith("http://"):
|
24 |
+
url = url.replace("http://", "hxxp://")
|
25 |
|
26 |
+
# Replace periods in the rest of the URL
|
27 |
return url.replace(".", "[.]")
|
28 |
|
29 |
st.title("URL Typosquatting Detection with URLGuardian")
|
|
|
35 |
model_path = "./URLGuardian"
|
36 |
classifier = load_classifier(model_path)
|
37 |
|
38 |
+
url = st.text_input("Enter the URL:", value="example.com")
|
39 |
|
40 |
if st.button("Check Safety of the url"):
|
41 |
if url:
|