Skip to content
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

Is there a way to filter repeated data (Ex: Remediation) #413

Open
m4konnen opened this issue Dec 1, 2022 · 1 comment
Open

Is there a way to filter repeated data (Ex: Remediation) #413

m4konnen opened this issue Dec 1, 2022 · 1 comment

Comments

@m4konnen
Copy link

m4konnen commented Dec 1, 2022

I was wondering if there is a way to filter repeated content on the generated report.

EX:

Let's assume I registered 2 findings (Same vulnerability, like SQLI ) so the remediation is gonna be the same for both findings.
In my report I don't want it to show the same remediation twice. Is there a way I can filter it using a "condition"?

I know this is not programming, but a way to create an array variable would be useful, so I can store on it all the things that is already on the document and make a condition to check if the field is already on the array...

I'm sorry for the bad english, I did my best ;)

@Zeecka
Copy link
Collaborator

Zeecka commented Dec 14, 2022

Multiple findings from a same vulnerability may have different remediation depending of their context. But if we assume that you want to keep the first finding for each vulnerability, the answer is in your title: you need to make a "filter".
Since Pwndoc support angular parser, you can create a custom filter.

Here is a filter that keep only 1 finding with the same name:

// Keep only first finding with a given title
expressions.filters.uniqFindings = function (findings) {
    if (!findings) return findings;
    titles = [];
    filtered_findings = [];
    findings.forEach(function (f) {
        if (!(titles.includes(f.title))){
            titles.push(f.title);
            filtered_findings.push(f);
        }
    });
    return filtered_findings;
};

You can put it in report-generator.js under // *** Angular parser filters ***.

You can then use your filter like this:

{#findings | uniqFindings }
    {#remediation}
        {@text | convertHTML}
        {#images}
        {%image}
        Image – {caption}
        {/images}
    {/remediation}
{/}

I integrated this filter on pwndoc-ng, see related PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants