Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,5 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
-
from selenium import webdriver
|
3 |
-
from selenium.webdriver.chrome.service import Service
|
4 |
-
from selenium.webdriver.common.by import By
|
5 |
-
import pandas as pd
|
6 |
-
import langchain as lc
|
7 |
-
import openai
|
8 |
-
|
9 |
-
# Configure WebDriver path (locally; use custom Docker setup for Spaces)
|
10 |
-
# service = Service('/path/to/chromedriver')
|
11 |
-
# options = webdriver.ChromeOptions()
|
12 |
-
# options.add_argument("--headless")
|
13 |
-
# driver = webdriver.Chrome(service=service, options=options)
|
14 |
|
15 |
st.title("Cybersecurity Vulnerability Scanner & AI Analyzer")
|
16 |
|
@@ -18,28 +7,18 @@ url = st.text_input("Enter the target URL:")
|
|
18 |
if st.button("Scrape and Scan"):
|
19 |
if url:
|
20 |
st.write(f"Processing {url}...")
|
|
|
|
|
|
|
|
|
21 |
# Example data structure for scanned elements
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
"forms": ["http://example.com/form_action1", "http://example.com/form_action2"]
|
26 |
-
}
|
27 |
-
st.success("Scraping and scanning complete!")
|
28 |
-
st.write("Links:", scraped_data["links"])
|
29 |
-
st.write("JavaScript Files:", scraped_data["js_files"])
|
30 |
-
st.write("Forms:", scraped_data["forms"])
|
31 |
-
else:
|
32 |
-
st.warning("Please enter a valid URL.")
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
# Example of LangChain or OpenAI for analysis
|
39 |
-
llm = lc.LLMChain(llm=lc.OpenAI())
|
40 |
-
full_prompt = f"{user_prompt}\nLinks:\n{scraped_data['links']}\nJS Files:\n{scraped_data['js_files']}\nForms:\n{scraped_data['forms']}"
|
41 |
-
ai_analysis = llm.run(full_prompt)
|
42 |
-
st.write("AI Analysis:")
|
43 |
-
st.write(ai_analysis)
|
44 |
else:
|
45 |
-
st.warning("Please
|
|
|
1 |
+
from requests_html import HTMLSession
|
2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
st.title("Cybersecurity Vulnerability Scanner & AI Analyzer")
|
5 |
|
|
|
7 |
if st.button("Scrape and Scan"):
|
8 |
if url:
|
9 |
st.write(f"Processing {url}...")
|
10 |
+
session = HTMLSession()
|
11 |
+
response = session.get(url)
|
12 |
+
response.html.render() # Render JavaScript if needed
|
13 |
+
|
14 |
# Example data structure for scanned elements
|
15 |
+
links = [link.attrs['href'] for link in response.html.find('a') if 'href' in link.attrs]
|
16 |
+
js_files = [script.attrs['src'] for script in response.html.find('script') if 'src' in script.attrs]
|
17 |
+
forms = [form.attrs.get('action', 'No action') for form in response.html.find('form')]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
st.success("Scraping and scanning complete!")
|
20 |
+
st.write("Links:", links)
|
21 |
+
st.write("JavaScript Files:", js_files)
|
22 |
+
st.write("Forms:", forms)
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
else:
|
24 |
+
st.warning("Please enter a
|