diff --git a/web/reNgine/common_func.py b/web/reNgine/common_func.py index 82aefdc6..73f3b89f 100644 --- a/web/reNgine/common_func.py +++ b/web/reNgine/common_func.py @@ -1027,4 +1027,17 @@ def generate_gospider_params(custom_header): params.append(f' --cookie "{value}"') else: params.append(f' -H "{key}:{value}"') - return ' '.join(params) \ No newline at end of file + return ' '.join(params) + +def extract_columns(row, columns): + """ + Extract specific columns from a row based on column indices. + + Args: + row (list): The CSV row as a list of values. + columns (list): List of column indices to extract. + + Returns: + list: Extracted values from the specified columns. + """ + return [row[i] for i in columns] diff --git a/web/reNgine/tasks.py b/web/reNgine/tasks.py index 01d1e41c..640d6b24 100644 --- a/web/reNgine/tasks.py +++ b/web/reNgine/tasks.py @@ -1195,9 +1195,10 @@ def screenshot(self, ctx={}, description=None): screenshot_paths = [] with open(output_path, 'r') as file: reader = csv.reader(file) + header = next(reader) # Skip header row + indices = [header.index(col) for col in ["Protocol", "Port", "Domain", "Request Status", "Screenshot Path", " Source Path"]] for row in reader: - "Protocol,Port,Domain,Request Status,Screenshot Path, Source Path" - protocol, port, subdomain_name, status, screenshot_path, source_path = tuple(row) + protocol, port, subdomain_name, status, screenshot_path, source_path = extract_columns(row, indices) logger.info(f'{protocol}:{port}:{subdomain_name}:{status}') subdomain_query = Subdomain.objects.filter(name=subdomain_name) if self.scan: