File size: 1,077 Bytes
f940ff0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
import pandas as pd
import numpy as np

def detect_anomalies(df, threshold):
    """
    Detects users with login attempts exceeding the threshold.
    Args:
    - df: DataFrame containing user activity data.
    - threshold: Number of login attempts to consider as anomalous.
    
    Returns:
    - DataFrame of detected anomalies.
    """
    anomalies = df[df['login_attempts'] > threshold]
    return anomalies

# Streamlit app layout
st.title('User and Entity Behavior Analytics (UEBA)')

# File uploader
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")

# Threshold input
threshold = st.slider("Set anomaly detection threshold", min_value=1, max_value=10, value=3)

if uploaded_file is not None:
    df = pd.read_csv(uploaded_file)
    
    if st.button('Detect Anomalies'):
        anomalies = detect_anomalies(df, threshold)
        if not anomalies.empty:
            st.write("Detected Anomalies:")
            st.dataframe(anomalies)
        else:
            st.write("No anomalies detected with the current threshold.")