Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import subprocess
|
4 |
+
|
5 |
+
# Create the data
|
6 |
+
data = {
|
7 |
+
"Reference": ["Motlagh et al.", "Divakaran et al.", "Yao et al.", "Yigit et al.", "Coelho et al.", "Novelli et al.", "LLM4Security"],
|
8 |
+
"Year": [2024, 2024, 2023, 2024, 2024, 2024, 2024],
|
9 |
+
"Scope": ["Security application", "Security application", "Security application, Security of LLM", "Security application, Security of LLM", "Security application", "Security application", "Security application"],
|
10 |
+
"Dimensions": ["Task", "Task", "Model, Task", "Task", "Task, Domain specific technique", "Task, Model, Domain specific technique", "Model, Task, Domain specific technique, Data"],
|
11 |
+
"Time frame": ["2022-2023", "2020-2024", "2019-2024", "2020-2024", "2021-2023", "2020-2024", "2020-2024"],
|
12 |
+
"Papers": ["Not specified", "Not specified", 281, "Not specified", 19, "Not specified", 127]
|
13 |
+
}
|
14 |
+
|
15 |
+
# Streamlit UI
|
16 |
+
st.title("🔒 LLMs for Cyber Security: State-of-the-Art Surveys")
|
17 |
+
st.write("This app is based on the paper: [Large Language Models for Cyber Security](https://arxiv.org/pdf/2405.04760v3). It showcases LLMs in the cybersecurity landscape.")
|
18 |
+
|
19 |
+
# Display the table
|
20 |
+
df = pd.DataFrame(data)
|
21 |
+
st.write(df)
|
22 |
+
|
23 |
+
# Mermaid graph visualization for LLM in security
|
24 |
+
mermaid_code = '''
|
25 |
+
graph TD;
|
26 |
+
A[LLMs in Security] --> B[Security Application]
|
27 |
+
B --> C[Task]
|
28 |
+
B --> D[Model]
|
29 |
+
D --> E[Domain-Specific Techniques]
|
30 |
+
E --> F[Data]
|
31 |
+
'''
|
32 |
+
|
33 |
+
st.subheader("🛡️ Security Model Visualization with Mermaid")
|
34 |
+
st.markdown(f"```mermaid\n{mermaid_code}\n```")
|
35 |
+
|
36 |
+
# Scrollable content for additional insights
|
37 |
+
st.markdown("""
|
38 |
+
<style>
|
39 |
+
.scrollable-content {
|
40 |
+
height: 200px;
|
41 |
+
overflow-y: scroll;
|
42 |
+
}
|
43 |
+
</style>
|
44 |
+
<div class="scrollable-content">
|
45 |
+
<h3>Scroll Through for More Insights:</h3>
|
46 |
+
<ul>
|
47 |
+
<li>2022-2023: Not specified by Motlagh et al.</li>
|
48 |
+
<li>2020-2024: Yigit and Divakaran focusing on tasks and models.</li>
|
49 |
+
<li>Coelho introduces domain-specific techniques from 2021 to 2023.</li>
|
50 |
+
</ul>
|
51 |
+
</div>
|
52 |
+
""", unsafe_allow_html=True)
|
53 |
+
|
54 |
+
# Simulate running a security audit using pip-audit
|
55 |
+
st.subheader("🔍 Run Python Dependency Security Audit")
|
56 |
+
|
57 |
+
# Define a button for auditing
|
58 |
+
if st.button('Run pip-audit for Security Check'):
|
59 |
+
with st.spinner('Running security audit...'):
|
60 |
+
result = subprocess.run(['pip-audit'], capture_output=True, text=True)
|
61 |
+
st.code(result.stdout)
|
62 |
+
|
63 |
+
# AI Tips for Reducing Security Risks with Pair Programming
|
64 |
+
st.subheader("🤖 AI Pair Programming: Security Recommendations")
|
65 |
+
st.markdown("""
|
66 |
+
- **Reduce Code Complexity**: AI can recommend code simplification strategies.
|
67 |
+
- **Minimize Attack Surface**: AI can simulate attacks and highlight vulnerable points.
|
68 |
+
- **Automate Security Scans**: Use tools like `pip-audit` for continuous CVE checks.
|
69 |
+
""")
|
70 |
+
|
71 |
+
# Add Azure deployment details (not operational in this demo)
|
72 |
+
st.subheader("Azure Deployment Information")
|
73 |
+
st.write("""
|
74 |
+
- **Azure Container Apps**: Easily deploy and scale your app with Azure Container Apps.
|
75 |
+
- **Azure Container Registry**: Store and manage container images.
|
76 |
+
- **Cosmos DB**: Use Cosmos DB to store security audit results and logs.
|
77 |
+
""")
|