Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
some cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
dgonzalez committed Feb 2, 2018
1 parent 8ba3ec4 commit 48d1c0b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Gammaray

Analysis of vulnerabilities in node.js applications.

## Install

```
go get github.com/dgonzalez/gammaray
```

## Usage

Run:

```
gammaray <path-to-your-node-app>
```

And that is all. In the coming days I will make the report prettier and configurable.
18 changes: 14 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ import (
"github.com/dgonzalez/gammaray/vulnfetcher/ossvulnfetcher"
)

// OSSIndexURL URL for OSSIndex. Is not a hardcoded value to facilitate testing.
const OSSIndexURL = "https://ossindex.net/v2.0/package"

func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: gammaray <folder>")
os.Exit(1)
}

packages, err := pathrunner.Walk(os.Args[1])
if err != nil {
panic(err)
Expand All @@ -23,13 +29,17 @@ func main() {
panic(err)
}

fmt.Printf("Package: %s\n", singlePackage.Name)
if len(vulnerabilities) > 0 {
fmt.Printf("Package: %s\n", singlePackage.Name)
for _, vulnerability := range vulnerabilities {
fmt.Printf("\tCVE: %s Title: %s\n", vulnerability.CVE, vulnerability.Title)
fmt.Printf("\t- Vulnerability:\n")
fmt.Printf("\t\t- CVE: %s\n\t\tTitle: %s\n\t\tVersions: %s\n\t\tMore Info: %s",
vulnerability.CVE,
vulnerability.Title,
vulnerability.Versions,
vulnerability.References,
)
}
} else {
fmt.Printf("\tNo vulnerabilities found\n")
}

}
Expand Down
4 changes: 4 additions & 0 deletions vulnfetcher/ossvulnfetcher/osindexfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"io/ioutil"
"net/http"
"strings"

"github.com/dgonzalez/gammaray/vulnfetcher"
)
Expand All @@ -26,6 +27,7 @@ type OSSVulnerability struct {
Description string `json:"description"`
CVE string `json:"cve"`
Versions []string `json:"versions"`
References []string `json:"references"`
}

// OSSIndexFetcher fetches the node.js security vulnerabilities
Expand Down Expand Up @@ -73,6 +75,8 @@ func (n *OSSIndexFetcher) Test(name string, version string) ([]vulnfetcher.Vulne
CVE: vulnerability.CVE,
Title: vulnerability.Title,
Description: vulnerability.Description,
Versions: strings.Join(vulnerability.Versions, " "),
References: "[ " + strings.Join(vulnerability.References, " ") + " ]\n",
}
vulnerabilities = append(vulnerabilities, processedVulnerability)
}
Expand Down
2 changes: 2 additions & 0 deletions vulnfetcher/vulnfetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ type Vulnerability struct {
CVE string
Title string
Description string
Versions string
References string
}

// VulnFetcher fetches vulnerabilities
Expand Down

0 comments on commit 48d1c0b

Please sign in to comment.