Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import tensorflow as tf
|
| 3 |
+
import pickle
|
| 4 |
+
|
| 5 |
+
# Model ve Vectorizer'ı yükleme
|
| 6 |
+
model = tf.keras.models.load_model("xss_detection_model-3.h5")
|
| 7 |
+
|
| 8 |
+
with open("vectorizer.pkl", "rb") as file:
|
| 9 |
+
vectorizer = pickle.load(file)
|
| 10 |
+
|
| 11 |
+
# Streamlit başlığı
|
| 12 |
+
st.title("XSS Detector")
|
| 13 |
+
|
| 14 |
+
# Kullanıcı girdisi
|
| 15 |
+
user_input = st.text_area("XSS payload'ınızı buraya girin", height=100)
|
| 16 |
+
|
| 17 |
+
# Tespit butonu
|
| 18 |
+
if st.button("Tespit Et"):
|
| 19 |
+
transformed_input = vectorizer.transform([user_input]).toarray()
|
| 20 |
+
prediction = model.predict(transformed_input)
|
| 21 |
+
|
| 22 |
+
# Sonucu ekranda gösterme
|
| 23 |
+
if prediction[0] > 0.5:
|
| 24 |
+
st.write("Bu bir XSS payload!")
|
| 25 |
+
else:
|
| 26 |
+
st.write("Bu bir XSS payload DEĞİL!")
|