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

feat(commands): add search command #379

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Apr 24, 2024

What did you implement:

Until now, the ability to search within the DB was only provided through the go-cve-dictionary server.
Therefore, in this PR, we will create a search command that searches within the DB without a server.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

$ go-cve-dictionary search cve
[
  "CVE-2023-38624",
  "CVE-2024-20750",
  "CVE-2024-21101",
  "CVE-2023-27427",
  "CVE-2023-30445",
...

$ go-cve-dictionary search cve CVE-2024-3400
{
  "CveID": "CVE-2024-3400",
  "Nvds": [
    {
      "CveID": "CVE-2024-3400",
      "Descriptions": [
        {
          "Lang": "en",
          "Value": "A command injection as a result of arbitrary file creation vulnerability in the GlobalProtect feature of Palo Alto Networks PAN-OS software for specific PAN-OS versions and distinct feature configurations may enable an unauthenticated attacker to execute arbitrary code with root privileges on the firewall.\n\nCloud NGFW, Panorama appliances, and Prisma Access are not impacted by this vulnerability."
        },
...

$ go-cve-dictionary search cve CVE-2023-48783 CVE-2024-3400
{
  "CVE-2023-48783": {
    "CveID": "CVE-2023-48783",
    "Nvds": [
      {
        "CveID": "CVE-2023-48783",
        ...
      }
    ],
    "Jvns": [],
    "Fortinets": [
      {
        "AdvisoryID": "FG-IR-23-408",
        "CveID": "CVE-2023-48783",
        ...
      }
    ]
  },
  "CVE-2024-3400": {
    "CveID": "CVE-2024-3400",
    "Nvds": [
      {
        "CveID": "CVE-2024-3400",
...

$ go-cve-dictionary search cpe "cpe:/a:fortinet:fortiportal"
[
  {
    "CveID": "CVE-2017-7337",
    "Nvds": [],
    "Jvns": [],
    "Fortinets": [
      {
        "AdvisoryID": "FG-IR-17-114",
        "CveID": "CVE-2017-7337",
        "Title": "FortiPortal Multiple Vulnerabilities",
...

$ go-cve-dictionary search cpe --cveid-only "cpe:/a:fortinet:fortiportal"
{
  "Fortinet": [
    "CVE-2023-46712",
    "CVE-2023-48791",
    "CVE-2017-7339",
    "CVE-2017-7343",
    "CVE-2022-27490",
    "CVE-2017-7342",
    "CVE-2017-7731",
    "CVE-2023-41842",
    "CVE-2023-48783",
    "CVE-2024-21761",
    "CVE-2017-7337",
    "CVE-2017-7338",
    "CVE-2017-7340"
  ],
  "JVN": [],
  "NVD": [
    "CVE-2023-46712",
    "CVE-2023-48791",
    "CVE-2023-41842",
    "CVE-2023-48783",
    "CVE-2024-21761"
  ]
}

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Apr 24, 2024
@MaineK00n MaineK00n force-pushed the MaineK00n/search-cmd branch from a79f05c to 07b32f8 Compare April 24, 2024 01:16
@MaineK00n MaineK00n requested a review from shino April 24, 2024 01:20
@MaineK00n MaineK00n force-pushed the MaineK00n/search-cmd branch from 07b32f8 to 2472ab1 Compare April 24, 2024 09:04
commands/search.go Outdated Show resolved Hide resolved
@MaineK00n MaineK00n force-pushed the MaineK00n/search-cmd branch from 2472ab1 to 304f4b0 Compare April 24, 2024 10:22
@MaineK00n MaineK00n force-pushed the MaineK00n/search-cmd branch from 304f4b0 to 32dc689 Compare April 24, 2024 10:24
Copy link
Collaborator

@shino shino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!!

@MaineK00n MaineK00n marked this pull request as ready for review April 24, 2024 10:31
@MaineK00n MaineK00n merged commit d68f2ea into master Apr 24, 2024
5 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/search-cmd branch April 24, 2024 10:37
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