summaryrefslogtreecommitdiff
path: root/scan.sh
diff options
context:
space:
mode:
authorjvoisin2015-07-13 13:35:49 +0200
committerjvoisin2015-07-13 13:35:49 +0200
commitcba0b49eb6e2782438df1394a3d42e424d9bc968 (patch)
tree217821e9c9ee221c6664a21c0b57133d85a8e0ea /scan.sh
parentb5a5f1efe855f8d0878bfb7e74e5578cd42d38b7 (diff)
Remove useless scripts
Diffstat (limited to 'scan.sh')
-rwxr-xr-xscan.sh57
1 files changed, 0 insertions, 57 deletions
diff --git a/scan.sh b/scan.sh
deleted file mode 100755
index 3d48dc3..0000000
--- a/scan.sh
+++ /dev/null
@@ -1,57 +0,0 @@
1#/bin/bash
2
3diff_folder='/var/log/phpmalwarefinder/'
4stdout=false
5
6SCAN_CMD='./yara -r ./malwares.yara -f'
7
8show_help() {
9 cat << EOF
10Usage ${0##*/} [-dhw]
11 -d Path to the diff folder (defaults to ${diff_folder})
12 -h Show this help message
13 -w Provide a whitelist file, containing one path per line
14 -s Show diff on stdout
15EOF
16}
17
18OPTIND=1
19while getopts "hw:d:" opt; do
20 case "$opt" in
21 h)
22 show_help
23 exit 0
24 ;;
25 d)
26 diff_folder="$OPTARG"
27 ;;
28 s)
29 stdout=true
30 ;;
31 '?')
32 show_help
33 exit 1
34 ;;
35 esac
36done
37shift "$((OPTIND-1))"
38
39if [ ! -d "$diff_folder" ]; then
40 echo "[-] Invalid previous_scan directory: " "$diff_folder"
41 exit 1
42fi
43
44previous_scan="$(ls -t "$diff_folder" | head -1)"
45if [ -z "$previous_scan" ]; then
46 echo "[*] No previous scan found: This will be the first one."
47 $SCAN_CMD "$@" | sort | tee > "$diff_folder/$(date +%s)"
48 exit 0
49fi
50
51if [ ${stdout} = true ]; then
52 diff <($SCAN_CMD "$@" | sort | tee "$diff_folder/$(date +%s)") <(cat "$diff_folder"/"$previous_scan")
53else
54 $SCAN_CMD "$@" | sort > "$diff_folder/$(date +%s)"
55fi
56
57exit 0