-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV Format output is unstructured [Powershell] #3620
Comments
Try to use ";" when importing the csv to Excel. Excel by default uses the "," symbol. |
Thanks for your response. My apologies but I couldn't understand. The CSV generated by prowler already has ";" in it, shouldn't it be "," instead so that the excel is able to properly create the columns for CSV. At the moment it seems like like multiple column headers are merged. For e.g.: Interestingly, the output for same query in html table is properly structured and displayed. |
In the meantime, a workaround to get the data into Excel is to do the following instead of double-clicking the CSV file:
Or do the following in PowerShell to turn it into a comma-delimited file: |
This is a red herring, in my experience Prowler doesn't run differently under a PowerShell or regular CMD window. It's still using Python as the interpreter. The issue here is that the 'CSV' file generated by Prowler isn't actually a Comma Separated Values file, it's semicolon separated. Perhaps this was a design decision at some point by the Prowler team because the data might contain commas, and it's easier to switch to a different separator than to enclose each data field in quotes? |
Thanks for that. Also the workaround that appears to be working for me is use to use semicolon as the separator in CSV. Here's how:
Re-open the csv in excel and it should be properly structured. |
That's really cool, and might be a trivial fix for the Prowler team to implement... |
Hi! @mubashirali84 are you still having the same output running |
I think this is just an Excel option, not something native in CSV, am I right? |
Its a CSV option. Just edit the CSV in notepad or notepad++ and append seq=; at the top. You can then open that in excel and it will open with proper columns. Another option is to replace the commas with full-stops because they are used in comments and then replace semi-colons with commas. That will properly delimit the CSV too using commas though the RISK column will be with full-stops instead of commas. |
We cannot do that since we'll break the current CSV format and automations forcing customers to skip the first line.
We cannot do that either since we won't be backwards compatible, we need to use the |
Well as a workaround for me both options are ok however, the original CSV spat out by prowler should be structured and mustn't require any manual intervention. Should I be doing something additional while opening in Excel? What's the recommendation? |
I don't get this, I think this issue is specifically related with how Excel handles CSVs. As you can see in our documentation here the CSV format is structured with a common format for all the providers covered by Prowler.
I think for now you should follow the provided workarounds since it's the way to load it based on Microsoft Excel documentation https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba. |
The clue is in the name of the file format: Comma Separated Values. The problem is in the following change:
If the data contains commas, Prowler should be encapsulating it in quotes: https://csvloader.com/csv-guide/why-quotation-marks-are-used-in-csv |
Generally, the primary reason in my view for generating the CSV is to analyse the data and use it in some sort of report. I think CSV among all other formats is the best one to do that and the best way to represent the CSV data is MS Excel.
Like I said, I am doing a workaround by using sep=; on csv and it seems I will have to continue doing it. |
Exactly, that OR why use commas in RISK column anyway when it is used as a delimiter in a CSV. Why can't it be replaced by a period or some other character? Use commas where they are actually required i.e., delimiting the columns. |
Hi! @christiandavilakoobin @mubashirali84 @dstreefkerk . We have decided to include a custom delimiter and/or a new SSV (semicolon-separated values) output format in Prowler. We are closing this issue and we are going to keep track of it in this #4461. If you have any trouble when opening a CSV file output from Prowler in LibreOffice or Excel we recommend you to follow these steps:
Thanks for using Prowler 😄 🚀 |
Steps to Reproduce
prowler aws --services s3 -M csv
prowler-output.csv
Expected behavior
The HTML output looks fine. I am looking for something similar output in CSV so that it can be actioned in a report.
Actual Result with Screenshots or Logs
This how the CSV looks:
How did you install Prowler?
From pip package (pip install prowler)
Environment Resource
Prowler is running on Powershell
OS used
Windows/PowerShell
Prowler version
Prowler 3.15.3
Pip version
pip 24.0
Context
No response
The text was updated successfully, but these errors were encountered: