File: composeraudit.sh

package info (click to toggle)
graudit 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,256 kB
  • sloc: sh: 1,134; makefile: 82; php: 62; jsp: 24
file content (21 lines) | stat: -rw-r--r-- 630 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# loop through composer cache files
# cp zip to /tmp/composeraudit
# unzip
# graudit >> ~/.composer/auditreport.txt

rm ~/.composer/auditreport.txt
mkdir /tmp/composeraudit
for zf in `find ~/.composer/cache/files/ -name "*.zip"`; do
	echo "[+] Auditing: $zf"
	cp $zf /tmp/composeraudit/
	cd /tmp/composeraudit
	unzip *.zip >/dev/null
	graudit -x *.js -d fruit . > /tmp/composerreport.txt
	findings=`wc -l /tmp/composerreport.txt | cut -d' ' -f1`
	if [ $findings -ge 11 ]; then
		cat /tmp/composerreport.txt >> ~/.composer/auditreport.txt
	        echo "$findings findings"
	fi
        rm -rf /tmp/composeraudit/*
done