7jimmy commited on
Commit
f940ff0
·
verified ·
1 Parent(s): 668fe26

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+
5
+ def detect_anomalies(df, threshold):
6
+ """
7
+ Detects users with login attempts exceeding the threshold.
8
+ Args:
9
+ - df: DataFrame containing user activity data.
10
+ - threshold: Number of login attempts to consider as anomalous.
11
+
12
+ Returns:
13
+ - DataFrame of detected anomalies.
14
+ """
15
+ anomalies = df[df['login_attempts'] > threshold]
16
+ return anomalies
17
+
18
+ # Streamlit app layout
19
+ st.title('User and Entity Behavior Analytics (UEBA)')
20
+
21
+ # File uploader
22
+ uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
23
+
24
+ # Threshold input
25
+ threshold = st.slider("Set anomaly detection threshold", min_value=1, max_value=10, value=3)
26
+
27
+ if uploaded_file is not None:
28
+ df = pd.read_csv(uploaded_file)
29
+
30
+ if st.button('Detect Anomalies'):
31
+ anomalies = detect_anomalies(df, threshold)
32
+ if not anomalies.empty:
33
+ st.write("Detected Anomalies:")
34
+ st.dataframe(anomalies)
35
+ else:
36
+ st.write("No anomalies detected with the current threshold.")