-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1101 from Ananya-vastare/main
Cyber Threat Intelligence Dashboard
- Loading branch information
Showing
3 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
Cybersecurity_Tools/Cyber Threat Intelligence Dashboard/Readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Cyber Threat Intelligence Dashboard | ||
|
||
## Overview | ||
The Cyber Threat Intelligence Dashboard is an interactive web application built using Streamlit that allows users to visualize and analyze cyber threat data. The dashboard provides insights into recent threats, their severity, geographic distribution, and alerts, making it a valuable tool for cybersecurity professionals. | ||
|
||
## Features | ||
- **Data Visualization**: Visualize the number of threats over time using line charts. | ||
- **Threat Information**: Display detailed information about recent threats in a table format. | ||
- **Geolocation Mapping**: Map threats geographically using scatter plots, color-coded by severity. | ||
- **Alerts Section**: View recent alerts related to vulnerabilities and other critical issues. | ||
- **Threat Classification**: Analyze threats by their severity using bar charts. | ||
- **User Filters**: Filter threats by type and download filtered data as a CSV file. | ||
|
||
## Technologies Used | ||
- Python | ||
- Streamlit | ||
- Pandas | ||
- Plotly | ||
- NumPy | ||
|
||
## Installation | ||
|
||
### Prerequisites | ||
- Python 3.7 or higher | ||
- pip (Python package manager) | ||
|
||
### Steps to Install | ||
1. Clone the repository: | ||
```bash | ||
git clone https://github.com/YourUsername/PyVerse.git | ||
``` | ||
2. Navigate to the project directory: | ||
```bash | ||
cd PyVerse/Cybersecurity_Tools/Cyber Threat Intelligence Dashboard | ||
``` | ||
3. Install the required packages: | ||
```bash | ||
pip install streamlit pandas plotly numpy | ||
``` | ||
|
||
## Usage | ||
To run the application, use the following command in your terminal: | ||
|
||
```bash | ||
streamlit run coding.py | ||
``` | ||
|
||
After executing the command, a new tab will open in your default web browser, displaying the Cyber Threat Intelligence Dashboard. | ||
|
||
## Mock Data | ||
This application generates mock threat data for demonstration purposes. You can customize the data generation logic in the `generate_mock_threat_data` function within the `coding.py` file. | ||
|
||
## Contribution | ||
Feel free to contribute to this project by forking the repository and submitting pull requests. Your contributions are welcome! | ||
|
||
## License | ||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. | ||
|
||
## Contact | ||
For any inquiries or issues, please reach out to [Your Email Address]. | ||
|
||
``` | ||
### Customization Notes | ||
- Replace `YourUsername` in the clone URL and `Your Email Address` with your actual GitHub username and email address. | ||
- If you have any additional features, installation steps, or specific usage instructions, feel free to add them to the relevant sections. | ||
- You might also consider adding a section on "Future Enhancements" if you have plans for additional features or improvements. |
114 changes: 114 additions & 0 deletions
114
Cybersecurity_Tools/Cyber Threat Intelligence Dashboard/coding.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
import streamlit as st | ||
import pandas as pd | ||
import numpy as np | ||
import plotly.express as px | ||
|
||
# Set the title of the dashboard | ||
st.title("Cyber Threat Intelligence Dashboard") | ||
|
||
# Generate mock threat data | ||
def generate_mock_threat_data(num_entries=100): | ||
np.random.seed(42) # For reproducible results | ||
dates = pd.date_range(start="2024-01-01", periods=num_entries, freq='D') | ||
descriptions = [f"Threat {i}: Description of threat." for i in range(1, num_entries + 1)] | ||
severities = np.random.choice(['Low', 'Medium', 'High', 'Critical'], num_entries) | ||
latitudes = np.random.uniform(low=-90.0, high=90.0, size=num_entries) | ||
longitudes = np.random.uniform(low=-180.0, high=180.0, size=num_entries) | ||
types = np.random.choice(['Malware', 'Phishing', 'Ransomware', 'DDoS'], num_entries) | ||
|
||
return pd.DataFrame({ | ||
'publishedDate': dates, | ||
'description': descriptions, | ||
'severity': severities, | ||
'latitude': latitudes, | ||
'longitude': longitudes, | ||
'type': types | ||
}) | ||
|
||
# Create mock data | ||
df = generate_mock_threat_data() | ||
|
||
# Display the data | ||
st.subheader("Recent Threats") | ||
st.dataframe(df) | ||
|
||
# Visualization: Plotting number of threats over time | ||
if not df.empty: | ||
df['date'] = pd.to_datetime(df['publishedDate']) | ||
threats_over_time = df.groupby(df['date'].dt.to_period('M')).size().reset_index(name='count') | ||
|
||
# Convert the Period to a string for JSON serialization | ||
threats_over_time['date'] = threats_over_time['date'].dt.strftime('%Y-%m') # Format as YYYY-MM | ||
|
||
fig = px.line(threats_over_time, x='date', y='count', title='Threats Over Time') | ||
st.plotly_chart(fig) | ||
|
||
# Search functionality | ||
search_term = st.text_input("Search for a specific threat:") | ||
if search_term: | ||
filtered_data = df[df['description'].str.contains(search_term, case=False, na=False)] | ||
st.dataframe(filtered_data) | ||
|
||
# Geolocation Mapping | ||
if 'latitude' in df.columns and 'longitude' in df.columns: | ||
st.subheader("Threats by Location") | ||
|
||
# Create a scatter map | ||
map_fig = px.scatter_geo( | ||
df, | ||
lat='latitude', | ||
lon='longitude', | ||
text='description', # Display description on hover | ||
title='Threats by Geolocation', | ||
hover_name='description', | ||
color='severity', # Color by severity | ||
size_max=15 | ||
) | ||
st.plotly_chart(map_fig) | ||
else: | ||
st.warning("Geolocation data is not available.") | ||
|
||
# Alerts Section (mock data) | ||
def generate_mock_alerts(num_alerts=5): | ||
alerts = [ | ||
{"date": f"2024-11-0{i+1}", "description": f"Critical vulnerability alert for Software {i+1}"} | ||
for i in range(num_alerts) | ||
] | ||
return pd.DataFrame(alerts) | ||
|
||
alerts_df = generate_mock_alerts() | ||
if not alerts_df.empty: | ||
st.subheader("Recent Alerts") | ||
st.dataframe(alerts_df) | ||
|
||
# Threat Classification | ||
if 'severity' in df.columns: | ||
severity_counts = df['severity'].value_counts() | ||
st.subheader("Threat Classification") | ||
st.bar_chart(severity_counts) # Visualize severity counts with a bar chart | ||
else: | ||
st.warning("Severity data is not available.") | ||
|
||
# User Input Filters | ||
threat_types = df['type'].unique().tolist() if 'type' in df.columns else [] | ||
selected_type = st.selectbox("Select Threat Type", options=['All'] + threat_types) | ||
|
||
if selected_type != 'All': | ||
filtered_df = df[df['type'] == selected_type] | ||
else: | ||
filtered_df = df | ||
|
||
# Display filtered data | ||
st.dataframe(filtered_df) | ||
|
||
# Export Data as CSV | ||
def convert_df_to_csv(df): | ||
return df.to_csv(index=False).encode('utf-8') | ||
|
||
csv = convert_df_to_csv(filtered_df) | ||
st.download_button( | ||
label="Download filtered data as CSV", | ||
data=csv, | ||
file_name='threat_data.csv', | ||
mime='text/csv', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters