mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-02-14 07:12:45 +00:00
Compare commits
2 Commits
dev
...
fix/a2a-ag
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
574e0cbce7 | ||
|
|
f6cdb1ae2e |
@@ -26,28 +26,51 @@ class RemoteAgentConnection:
|
|||||||
"""Initialize connection to a remote agent"""
|
"""Initialize connection to a remote agent"""
|
||||||
self.url = url.rstrip('/')
|
self.url = url.rstrip('/')
|
||||||
self.agent_card = None
|
self.agent_card = None
|
||||||
self.client = httpx.AsyncClient(timeout=120.0)
|
self.client = httpx.AsyncClient(timeout=120.0, follow_redirects=True)
|
||||||
self.context_id = None
|
self.context_id = None
|
||||||
|
|
||||||
async def get_agent_card(self) -> Optional[Dict[str, Any]]:
|
async def get_agent_card(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Get the agent card from the remote agent"""
|
"""Get the agent card from the remote agent"""
|
||||||
|
# If URL already points to a .json file, fetch it directly
|
||||||
|
if self.url.endswith('.json'):
|
||||||
try:
|
try:
|
||||||
# Try new path first (A2A 0.3.0+)
|
response = await self.client.get(self.url)
|
||||||
response = await self.client.get(f"{self.url}/.well-known/agent-card.json")
|
|
||||||
response.raise_for_status()
|
|
||||||
self.agent_card = response.json()
|
|
||||||
return self.agent_card
|
|
||||||
except Exception:
|
|
||||||
# Try old path for compatibility
|
|
||||||
try:
|
|
||||||
response = await self.client.get(f"{self.url}/.well-known/agent.json")
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
self.agent_card = response.json()
|
self.agent_card = response.json()
|
||||||
|
|
||||||
|
# Use canonical URL from agent card if provided
|
||||||
|
if isinstance(self.agent_card, dict) and "url" in self.agent_card:
|
||||||
|
self.url = self.agent_card["url"].rstrip('/')
|
||||||
|
|
||||||
return self.agent_card
|
return self.agent_card
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to get agent card from {self.url}: {e}")
|
print(f"Failed to get agent card from {self.url}: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Try both agent-card.json (A2A 0.3.0+) and agent.json (legacy)
|
||||||
|
well_known_paths = [
|
||||||
|
"/.well-known/agent-card.json",
|
||||||
|
"/.well-known/agent.json",
|
||||||
|
]
|
||||||
|
|
||||||
|
for path in well_known_paths:
|
||||||
|
try:
|
||||||
|
response = await self.client.get(f"{self.url}{path}")
|
||||||
|
response.raise_for_status()
|
||||||
|
self.agent_card = response.json()
|
||||||
|
|
||||||
|
# Use canonical URL from agent card if provided
|
||||||
|
if isinstance(self.agent_card, dict) and "url" in self.agent_card:
|
||||||
|
self.url = self.agent_card["url"].rstrip('/')
|
||||||
|
|
||||||
|
return self.agent_card
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(f"Failed to get agent card from {self.url}")
|
||||||
|
print("Tip: If agent is at /a2a/something, use full URL: /register http://host:port/a2a/something")
|
||||||
|
return None
|
||||||
|
|
||||||
async def send_message(self, message: str | Dict[str, Any] | List[Dict[str, Any]]) -> str:
|
async def send_message(self, message: str | Dict[str, Any] | List[Dict[str, Any]]) -> str:
|
||||||
"""Send a message to the remote agent using A2A protocol"""
|
"""Send a message to the remote agent using A2A protocol"""
|
||||||
try:
|
try:
|
||||||
@@ -93,7 +116,7 @@ class RemoteAgentConnection:
|
|||||||
payload["params"]["contextId"] = self.context_id
|
payload["params"]["contextId"] = self.context_id
|
||||||
|
|
||||||
# Send to root endpoint per A2A protocol
|
# Send to root endpoint per A2A protocol
|
||||||
response = await self.client.post(f"{self.url}/", json=payload)
|
response = await self.client.post(self.url, json=payload)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ fuzzforge workflows list
|
|||||||
fuzzforge workflows info security_assessment
|
fuzzforge workflows info security_assessment
|
||||||
|
|
||||||
# Submit a workflow for analysis
|
# Submit a workflow for analysis
|
||||||
fuzzforge workflow security_assessment /path/to/your/code
|
fuzzforge workflow run security_assessment /path/to/your/code
|
||||||
|
|
||||||
|
|
||||||
# View findings when complete
|
# View findings when complete
|
||||||
@@ -150,24 +150,24 @@ fuzzforge workflows parameters security_assessment --no-interactive
|
|||||||
|
|
||||||
### Workflow Execution
|
### Workflow Execution
|
||||||
|
|
||||||
#### `fuzzforge workflow <workflow> <target-path>`
|
#### `fuzzforge workflow run <workflow> <target-path>`
|
||||||
Execute a security testing workflow with **automatic file upload**.
|
Execute a security testing workflow with **automatic file upload**.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Basic execution - CLI automatically detects local files and uploads them
|
# Basic execution - CLI automatically detects local files and uploads them
|
||||||
fuzzforge workflow security_assessment /path/to/code
|
fuzzforge workflow run security_assessment /path/to/code
|
||||||
|
|
||||||
# With parameters
|
# With parameters
|
||||||
fuzzforge workflow security_assessment /path/to/binary \
|
fuzzforge workflow run security_assessment /path/to/binary \
|
||||||
--param timeout=3600 \
|
--param timeout=3600 \
|
||||||
--param iterations=10000
|
--param iterations=10000
|
||||||
|
|
||||||
# With parameter file
|
# With parameter file
|
||||||
fuzzforge workflow security_assessment /path/to/code \
|
fuzzforge workflow run security_assessment /path/to/code \
|
||||||
--param-file my-params.json
|
--param-file my-params.json
|
||||||
|
|
||||||
# Wait for completion
|
# Wait for completion
|
||||||
fuzzforge workflow security_assessment /path/to/code --wait
|
fuzzforge workflow run security_assessment /path/to/code --wait
|
||||||
```
|
```
|
||||||
|
|
||||||
**Automatic File Upload Behavior:**
|
**Automatic File Upload Behavior:**
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ FuzzForge security testing project.
|
|||||||
fuzzforge workflows
|
fuzzforge workflows
|
||||||
|
|
||||||
# Submit a workflow for analysis
|
# Submit a workflow for analysis
|
||||||
fuzzforge workflow <workflow-name> /path/to/target
|
fuzzforge workflow run <workflow-name> /path/to/target
|
||||||
|
|
||||||
# View findings
|
# View findings
|
||||||
fuzzforge finding <run-id>
|
fuzzforge finding <run-id>
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ def execute_workflow(
|
|||||||
|
|
||||||
# Suggest --live for fuzzing workflows
|
# Suggest --live for fuzzing workflows
|
||||||
if not live and not wait and "fuzzing" in workflow.lower():
|
if not live and not wait and "fuzzing" in workflow.lower():
|
||||||
console.print(f"💡 Next time try: [bold cyan]fuzzforge workflow {workflow} {target_path} --live[/bold cyan] for real-time monitoring", style="dim")
|
console.print(f"💡 Next time try: [bold cyan]fuzzforge workflow run {workflow} {target_path} --live[/bold cyan] for real-time monitoring", style="dim")
|
||||||
|
|
||||||
# Start live monitoring if requested
|
# Start live monitoring if requested
|
||||||
if live:
|
if live:
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ def workflow_main():
|
|||||||
Execute workflows and manage workflow executions
|
Execute workflows and manage workflow executions
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
fuzzforge workflow security_assessment ./target # Execute workflow
|
fuzzforge workflow run security_assessment ./target # Execute workflow
|
||||||
fuzzforge workflow status # Check latest status
|
fuzzforge workflow status # Check latest status
|
||||||
fuzzforge workflow history # Show execution history
|
fuzzforge workflow history # Show execution history
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ FuzzForge security testing project.
|
|||||||
fuzzforge workflows
|
fuzzforge workflows
|
||||||
|
|
||||||
# Submit a workflow for analysis
|
# Submit a workflow for analysis
|
||||||
fuzzforge workflow <workflow-name> /path/to/target
|
fuzzforge workflow run <workflow-name> /path/to/target
|
||||||
|
|
||||||
# View findings
|
# View findings
|
||||||
fuzzforge finding <run-id>
|
fuzzforge finding <run-id>
|
||||||
|
|||||||
Reference in New Issue
Block a user