Skip to content

Commit

Permalink
detect war
Browse files Browse the repository at this point in the history
  • Loading branch information
1lann committed Dec 13, 2021
1 parent 796beec commit 0c32461
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func main() {
err = godirwalk.Walk(target, &godirwalk.Options{
Callback: func(osPathname string, de *godirwalk.Dirent) error {
// For each file in the directory, check if it ends in ".jar"
if filepath.Ext(osPathname) == ".jar" {
ext := strings.ToLower(filepath.Ext(osPathname))
if ext == ".jar" || ext == ".war" {
pool <- struct{}{}
// If it is, take a goroutine (thread) from the thread pool
// and check the jar.
Expand Down Expand Up @@ -192,7 +193,8 @@ func checkJar(pathToFile string, rd io.ReaderAt, size int64, depth int) (status
}

// If there is a jar in the jar, recurse into it.
if path.Ext(file.Name) == ".jar" {
ext := strings.ToLower(path.Ext(file.Name))
if ext == ".jar" || ext == ".war" {
var subStatus Status
var subDesc string
// If the jar is larger than 500 MB, this can be dangerous
Expand Down

0 comments on commit 0c32461

Please sign in to comment.