Update config
Browse files- app.py +25 -34
- tools/__pycache__/vuln_search.cpython-310.pyc +0 -0
- tools/vuln_search.py +14 -4
app.py
CHANGED
@@ -38,7 +38,7 @@ def create_agent():
|
|
38 |
config = load_agent_config()
|
39 |
prompts = load_prompts()
|
40 |
|
41 |
-
# Configure model
|
42 |
model_config = config['agent_config']['model']
|
43 |
model = HfApiModel(
|
44 |
model_id=model_config['model_id'],
|
@@ -59,20 +59,13 @@ def create_agent():
|
|
59 |
|
60 |
return agent, prompts
|
61 |
|
62 |
-
def process_query(
|
63 |
-
"""Process a user query"""
|
64 |
agent, prompts = create_agent()
|
65 |
|
66 |
-
#
|
67 |
-
|
68 |
-
|
69 |
-
formatted_prompt = template.format(cve_id=query)
|
70 |
-
elif analysis_type == "threat":
|
71 |
-
template = prompts['threat_report']
|
72 |
-
formatted_prompt = template.format(target=query)
|
73 |
-
else:
|
74 |
-
template = prompts['user_prompt']
|
75 |
-
formatted_prompt = template.format(query=query)
|
76 |
|
77 |
# Execute agent
|
78 |
system_prompt = prompts['system_prompt']
|
@@ -80,32 +73,30 @@ def process_query(query, analysis_type="general"):
|
|
80 |
|
81 |
return result
|
82 |
|
83 |
-
# Gradio Interface
|
84 |
def create_interface():
|
85 |
-
"""Create the Gradio
|
86 |
with gr.Blocks(title="Vulnerability Intelligence Agent") as interface:
|
87 |
gr.Markdown("# Vulnerability Intelligence Agent (VIA)")
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
with gr.Column():
|
103 |
-
output = gr.Markdown(label="Result")
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
)
|
110 |
|
111 |
return interface
|
|
|
38 |
config = load_agent_config()
|
39 |
prompts = load_prompts()
|
40 |
|
41 |
+
# Configure model
|
42 |
model_config = config['agent_config']['model']
|
43 |
model = HfApiModel(
|
44 |
model_id=model_config['model_id'],
|
|
|
59 |
|
60 |
return agent, prompts
|
61 |
|
62 |
+
def process_query(message, history):
|
63 |
+
"""Process a user query in chat format"""
|
64 |
agent, prompts = create_agent()
|
65 |
|
66 |
+
# Format the prompt
|
67 |
+
template = prompts['user_prompt']
|
68 |
+
formatted_prompt = template.format(query=message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Execute agent
|
71 |
system_prompt = prompts['system_prompt']
|
|
|
73 |
|
74 |
return result
|
75 |
|
76 |
+
# Gradio Chat Interface
|
77 |
def create_interface():
|
78 |
+
"""Create the Gradio chat interface"""
|
79 |
with gr.Blocks(title="Vulnerability Intelligence Agent") as interface:
|
80 |
gr.Markdown("# Vulnerability Intelligence Agent (VIA)")
|
81 |
|
82 |
+
chatbot = gr.Chatbot(
|
83 |
+
[],
|
84 |
+
elem_id="chatbot",
|
85 |
+
bubble_full_width=False,
|
86 |
+
avatar_images=(None, "🤖"),
|
87 |
+
height=600,
|
88 |
+
)
|
89 |
+
|
90 |
+
txt = gr.Textbox(
|
91 |
+
show_label=False,
|
92 |
+
placeholder="Enter your security query...",
|
93 |
+
container=False
|
94 |
+
)
|
|
|
|
|
95 |
|
96 |
+
txt.submit(
|
97 |
+
process_query,
|
98 |
+
[txt, chatbot],
|
99 |
+
[chatbot]
|
100 |
)
|
101 |
|
102 |
return interface
|
tools/__pycache__/vuln_search.cpython-310.pyc
CHANGED
Binary files a/tools/__pycache__/vuln_search.cpython-310.pyc and b/tools/__pycache__/vuln_search.cpython-310.pyc differ
|
|
tools/vuln_search.py
CHANGED
@@ -14,11 +14,21 @@ class VulnerabilitySearchTool(Tool):
|
|
14 |
name = "vuln_search"
|
15 |
description = "Search for vulnerabilities in security databases (NVD, MISP if configured)"
|
16 |
inputs = {
|
17 |
-
'query': {'type': '
|
18 |
-
'sources': {
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
-
output_type =
|
22 |
|
23 |
def __init__(self):
|
24 |
"""Initialize API connections"""
|
|
|
14 |
name = "vuln_search"
|
15 |
description = "Search for vulnerabilities in security databases (NVD, MISP if configured)"
|
16 |
inputs = {
|
17 |
+
'query': {'type': 'string', 'description': 'Search term or CVE ID'},
|
18 |
+
'sources': {
|
19 |
+
'type': 'array',
|
20 |
+
'description': 'List of sources to query (nvd, misp)',
|
21 |
+
'default': ['nvd'],
|
22 |
+
'nullable': True
|
23 |
+
},
|
24 |
+
'max_results': {
|
25 |
+
'type': 'integer',
|
26 |
+
'description': 'Maximum number of results per source',
|
27 |
+
'default': 5,
|
28 |
+
'nullable': True
|
29 |
+
}
|
30 |
}
|
31 |
+
output_type = "object"
|
32 |
|
33 |
def __init__(self):
|
34 |
"""Initialize API connections"""
|