In my hyralit app, I want my navbar to be even more upwards.
As shown in the picure below, I want the space above the navbar (shown by green arrow)gone. Can anyone help me on how to do this?
import os
import time
import pandas as pd
import matplotlib.pyplot as plt
import streamlit as st
import hydralit as hy
# Shared variables for scan status
scan_over = False
scan_directory = ""
# Relative path for the CSV file
base_dir = os.path.dirname(__file__)
csv_file_path = os.path.join(base_dir, "finalReport.csv")
# Relative path for the batch file
batch_file_path = os.path.join(base_dir, "scan.bat")
# HydraApp initialization with sticky navbar and no Streamlit markers
app = hy.HydraApp(title='Vulnerability Scanner', favicon="π", hide_streamlit_markers=True, use_navbar=True, navbar_sticky=True)
# Scan Repository Page
@app.addapp(is_home=True)
def scan_repository_page():
global scan_over, scan_directory
hy.title("Scan Repository")
hy.markdown("### Easily scan your project repository for vulnerabilities!")
scan_directory = hy.text_input("Enter root directory of the project:")
if hy.button("Scan Repository", help="Start scanning the repository"):
if os.path.exists(scan_directory):
with hy.spinner("Scanning repository..."):
time.sleep(3) # Simulate a delay
os.system(f"cmd /c start {batch_file_path}")
scan_over = True
else:
hy.error("The directory does not exist. Please try again.")
if scan_over:
hy.success(
"Repository successfully scanned. Check the report by navigating to 'Scan Report'!"
)
# Scan Report Page
@app.addapp()
def scan_report_page():
hy.title("Scan Report")
hy.markdown("### Detailed report of detected vulnerabilities.")
if os.path.exists(csv_file_path):
df = pd.read_csv(csv_file_path)
# Display dataframe with reduced font size
hy.dataframe(df.style.format(na_rep="N/A").set_table_styles(
[
{'selector': 'thead th', 'props': [('font-size', '12px'), ('color', '#4CAF50')]}, # Reduced font size
{'selector': 'td', 'props': [('font-size', '12px')]} # Reduced font size for table data
]
))
else:
hy.error("CSV file not found. Please check the path.")
# CWE Pie Chart Page
@app.addapp(title="CWE Distribution", icon="π")
def cwe_pie_chart_page():
hy.title("CWE-wise Distribution")
hy.markdown("### Visual representation of vulnerabilities based on CWE ID.")
# Create a two-column layout
col1, col2 = hy.columns([1, 1]) # Equal width for both columns
if os.path.exists(csv_file_path):
df = pd.read_csv(csv_file_path)
cwe_counts = df['CWE ID'].value_counts()
# Plot the pie chart in the first column
with col1:
fig, ax = plt.subplots(figsize=(5, 5)) # Reduced pie chart size
ax.pie(cwe_counts.values, labels=cwe_counts.index, autopct='%1.1f%%', startangle=90)
ax.axis('equal')
hy.pyplot(fig)
else:
hy.error("CSV file not found. Please check the path.")
# Severity Pie Chart Page
@app.addapp(title="Severity Distribution", icon="π")
def severity_pie_chart_page():
hy.title("Severity-wise Distribution")
hy.markdown("### Analysis of vulnerabilities based on their severity.")
# Create a two-column layout
col1, col2 = hy.columns([1, 1]) # Equal width for both columns
if os.path.exists(csv_file_path):
df = pd.read_csv(csv_file_path)
severity_counts = df['Severity'].value_counts()
# Plot the pie chart in the first column
with col1:
fig, ax = plt.subplots(figsize=(5, 5)) # Reduced pie chart size
ax.pie(severity_counts.values, labels=severity_counts.index, autopct='%1.1f%%', startangle=90)
ax.axis('equal')
hy.pyplot(fig)
else:
hy.error("CSV file not found. Please check the path.")
# Run the app
if __name__ == "__main__":
app.run()