diff --git a/Dockerfile b/Dockerfile index 282881e..99c22e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,14 @@ WORKDIR /app # Copy the requirements.txt file to the working directory COPY requirements.txt . +# Make sure requests is installed RUN pip install requests # Install the required Python packages RUN pip install --no-cache-dir -r requirements.txt -# Copy the entire contents of the app folder to the working directory -COPY app/ . +# Copy the entire app folder to the working directory +COPY app/ /app/ # Copy the startup script to the working directory COPY startup.sh . @@ -21,4 +22,4 @@ COPY startup.sh . RUN chmod +x startup.sh # Start the Streamlit app using the startup script -CMD ["/bin/bash", "startup.sh"] \ No newline at end of file +CMD ["/bin/bash", "startup.sh"] diff --git a/README.md b/README.md index ba2155f..a8a0282 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,30 @@ FortiGPT Troubleshooting Assistant requires no dependencies to be installed. Ins ## Installation -To install FortiGPT Troubleshooting Assistant, simply run the following command: +To run FortiGPT Troubleshooting Assistant, simply follow the steps below: +Clone the repo ``` -docker run -p 8501:8501 -e OPENAI_API_KEY=XXXXXXXXXXXXXXX gt732/fortigpt +git clone https://github.com/gt732/FortiGPT.git +``` +Change into the app directory +``` +cd FortiGPT/app/ +``` +Run the docker command. Local volumes allows you to modify the chatgpt prompts and debug commands. +This will be synced to the container. +``` +docker run -d \ + -p 8501:8501 \ + -v $(pwd)/chatgpt_prompts:/app/chatgpt_prompts \ + -v $(pwd)/debug_commands:/app/debug_commands \ + -e OPENAI_API_KEY=your_api_key \ + gt732/fortigpt ``` ## Login Screen -![alt text](https://i.imgur.com/p5kirWy.png) +![alt text](https://i.imgur.com/4Je8TrR.png) ## Demo VPN Phase1 Settings mis-match ![alt text](https://i.imgur.com/CJnhDhJ.png) diff --git a/app/app.py b/app/app.py index 9869994..5f5be5a 100644 --- a/app/app.py +++ b/app/app.py @@ -21,6 +21,21 @@ def main(): st.sidebar.write("Please fill in the following information to get started:") device_type = st.sidebar.selectbox("Device Type", ["FortiGate"]) device_ip = st.sidebar.text_input("Device IP Address") + scheme = st.sidebar.radio( + "HTTP or HTTPS?", + ( + "http", + "https", + ), + horizontal=True, + ) + scheme_port = st.sidebar.text_input( + "HTTP/HTTPS Port", + placeholder="Empty for HTTP Default: 80, HTTPS Default: 443", + ) + ssh_port = st.sidebar.text_input("SSH Port", placeholder="Empty for Default: 22") + if not ssh_port: + ssh_port = 22 device_username = st.sidebar.text_input("Device Username") device_password = st.sidebar.text_input("Device Password", type="password") # ********************************************************************************************************************** @@ -34,6 +49,8 @@ def main(): host=device_ip, username=device_username, password=device_password, + scheme=scheme, + port=scheme_port, ) fgt.login() if fgt.is_connected: @@ -151,6 +168,7 @@ def get_phase2_name(vpn_tunnel_name) -> str: "username": device_username, "password": device_password, "fast_cli": False, + "port": ssh_port, } try: with st.spinner("Connecting to device..."): diff --git a/startup.sh b/startup.sh index b57f26f..47641a3 100644 --- a/startup.sh +++ b/startup.sh @@ -4,4 +4,4 @@ pip install netmiko==3.4.0 # Start the Streamlit app -streamlit run --server.port 8501 app.py +streamlit run --server.port 8501 /app/app.py