Skip to content

Eliminate warnings when no examples are present in fingerprints#402

Merged
mkienow-r7 merged 2 commits intorapid7:masterfrom
dabdine:eliminate-empty-example-warnings
Jan 28, 2022
Merged

Eliminate warnings when no examples are present in fingerprints#402
mkienow-r7 merged 2 commits intorapid7:masterfrom
dabdine:eliminate-empty-example-warnings

Conversation

@dabdine
Copy link
Copy Markdown
Contributor

@dabdine dabdine commented Jan 27, 2022

Description

A simple change to eliminate spurious warnings produced by Ruby recog_verify when no examples are present. In other words, instead of emitting these warnings:

xml/smtp_help.xml:49: WARN: 'IBM VM' has no test cases
xml/smtp_help.xml:49: WARN: 'IBM VM' is missing an example that checks for parameter 'host.name' which is derived from a capture group

The code will now emit:

xml/smtp_help.xml:49: WARN: 'IBM VM' has no test cases

For this fingerprint:

  <fingerprint pattern="^214[ -]([^ ]+) is running the IBM VM operating system$">
    <description>IBM VM</description>
    <param pos="0" name="service.vendor" value="IBM"/>
    <param pos="0" name="service.family" value="VM"/>
    <param pos="0" name="service.product" value="VM"/>
    <param pos="1" name="host.name"/>
  </fingerprint>

It will still emit the "checks for parameter" warnings when it should, however. For example, in the case where there's a legitimate missing attribute:

  <fingerprint pattern="^502[ -]5\.3\.0 Sendmail ([^ ]+) -- HELP not implemented$">
    <description>Sendmail - help not implemented variant</description>
    <example>502 5.3.0 Sendmail 8.11.2 -- HELP not implemented</example>
    <param pos="0" name="service.family" value="Sendmail"/>
    <param pos="0" name="service.product" value="Sendmail"/>
    <param pos="1" name="service.version"/>
  </fingerprint>

You'll get:

xml/smtp_help.xml:149: WARN: 'Sendmail - help not implemented variant' is missing an example that checks for parameter 'service.version' which is derived from a capture group

Motivation and Context

This clutters recog_verify output unnecessarily. As there are no examples to begin with, there's no point in mentioning whether any attributes aren't tested.

How Has This Been Tested?

  1. A run of recog_verify
  2. A run of bundle exec rake tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have updated the documentation accordingly (or changes are not required).
  • I have added tests to cover my changes (or new tests are not required).
  • All new and existing tests passed.

dabdine added a commit to dabdine/recog-java that referenced this pull request Jan 27, 2022
@mkienow-r7 mkienow-r7 self-assigned this Jan 28, 2022
@mkienow-r7 mkienow-r7 merged commit 2dbc9cc into rapid7:master Jan 28, 2022
@mkienow-r7
Copy link
Copy Markdown
Contributor

I appreciate the output being free of the spurious warnings. Thank you for the contribution @dabdine!

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

Successfully merging this pull request may close these issues.

2 participants