summaryrefslogtreecommitdiff
path: root/run_tests.sh
blob: 3ad2ea1154285057e457aa15a758cb9320dd84a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

# <? system($_GET['p']);
#  $___ $___ $_____ $_____ $____ $___
# ZXhlYyg
# system php_uname posix_setuid  phpinfo exec eval
# /etc/passwd WinExec uname -a nc -l
# 1337day.com

echo '[+] Testing scanning engine'
EXPECTED='ObfuscatedPhp run_tests.sh
SuspiciousEncoding run_tests.sh
DodgyPhp run_tests.sh
DangerousPhp run_tests.sh
DodgyStrings run_tests.sh
Websites run_tests.sh'
RESULT="$(./phpmalwarefinder -c ./malwares.yara run_tests.sh)"
if [ "$RESULT" != "$EXPECTED" ] ; then
	diff <(echo "$RESULT") <(echo "$EXPECTED")
	exit 1
fi

echo '[+] Testing on non-existing rules'
EXPECTED="./nonexistentfile doesn't exist. Please give me a valid file."
RESULT="$(./phpmalwarefinder -c ./nonexistentfile run_tests.sh)"
if [ "$RESULT" != "$EXPECTED" ] ; then
	diff <(echo "$RESULT") <(echo "$EXPECTED")
	exit 1
fi