From c60fa2be42ff7813c035fa0c1f6cb9e8af0cdfcf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:20:44 +0000 Subject: [PATCH] Improve parse_results logic for better code clarity Co-authored-by: GilbertKrantz <90319182+GilbertKrantz@users.noreply.github.com> --- sqlmapcli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sqlmapcli.py b/sqlmapcli.py index f9c079aac..bc08d094d 100755 --- a/sqlmapcli.py +++ b/sqlmapcli.py @@ -119,16 +119,18 @@ class SQLMapCLI: if "sqlmap identified the following injection point" in output: # Extract injection details lines = output.split('\n') - param = None # Initialize to avoid undefined reference + current_param = 'Unknown' # Default parameter name + for i, line in enumerate(lines): if "Parameter:" in line: - param = line.split("Parameter:")[1].strip() - if "Type:" in line: + current_param = line.split("Parameter:")[1].strip() + elif "Type:" in line: vuln_type = line.split("Type:")[1].strip() + # Check if next line contains the title if i + 1 < len(lines) and "Title:" in lines[i + 1]: title = lines[i + 1].split("Title:")[1].strip() vulns.append({ - 'parameter': param if param is not None else 'Unknown', + 'parameter': current_param, 'type': vuln_type, 'title': title })