diff --git a/README.md b/README.md index c842c39..a9a366b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ $ docker-index sbom --image * `--oci-dir ` can point to a local image in OCI directory format * `--output ` allows to store the generated SBOM in a local file * `--include-cves` will include all detected CVEs in generated output +### `scanner.sh` + +To scan all of local images , use the following command: +```shell +./checker.sh +``` ### `docker-index cve` diff --git a/docker-index b/docker-index new file mode 100755 index 0000000..545c2d1 Binary files /dev/null and b/docker-index differ diff --git a/scanner.sh b/scanner.sh new file mode 100644 index 0000000..9f95001 --- /dev/null +++ b/scanner.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#written by rezshar +#The easiest way to scan all local images +./docker-index 2>&1 > /dev/null +Val1=$(echo $?) + if [ "$?" -ne 0 ] + then + echo "Installing docker-index" + echo "please wait ..." + ./install.sh +# else +# echo "OK!" + fi + +if [ ! -d /var/lib/docker/image/overlay2/imagedb/content/sha256/ ]; then +DOCKERPATH=$(docker info | grep "Docker Root Dir" | sed 's/^.*: //') +ls $DOCKERPATH/image/overlay2/imagedb/content/sha256/ -1 > temp +else +ls /var/lib/docker/image/overlay2/imagedb/content/sha256/ -1 > temp +fi + +file="temp" +while read -r line +do + printf 'Line: %s\n' "$line" + current=$line +echo "Scanning $current" +./docker-index cve --image "$current" DSA-2022-0001 +echo "Lets go for another Images :)" +done < $file +echo "Enjoy"