~kirkland/bogosec/trunk

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh

###########################################################
#
# Licensed Material - Property of IBM
#
# BogoSec - Source Code Security Quality Metric Calculator
#
# (C) Copyright IBM Corp. 2004-2008
#
# FILE   : configure 
#
# PURPOSE: Configure script for Bogosec
#
# HISTORY
#          07/2004 originated by Tony Petz (petz.agoston@gmail.com)
#          02/2005 Dustin Kirkland (dustin.kirkland@us.ibm.com) - search for rpm and rpmbuild binaries
###########################################################

scanners="flawfinder rats"

# By default, assume no scanners found
warn_scanner=1

echo
echo -n checking for Perl interpretter...
which perl > /dev/null 2>&1
if [ $? != 0 ]; then
	echo no
	echo
	echo You must have a Perl interpretter installed to run bogosec... Aborting...
	echo 
	exit 1
else
echo yes
fi

echo -n checking for tar...
which tar > /dev/null 2>&1
if [ $? != 0 ]; then
	echo no
	echo \* tar binary not found... you will not be able to run bogosec on tarballs.
else
echo yes
fi

echo -n checking for gunzip...
which gunzip > /dev/null 2>&1
if [ $? != 0 ]; then
	echo no
	echo \* gunzip binary not found... you will not be able to run bogosec on tar.gz\'s.
else
echo yes
fi

echo -n checking for rpm...
which rpm > /dev/null 2>&1
if [ $? != 0 ]; then
	echo no
	echo \* rpm binary not found... you will not be able to run bogosec on .src.rpm\'s.
else
echo yes
fi

echo -n checking for rpmbuild...
which rpmbuild > /dev/null 2>&1
if [ $? != 0 ]; then
	echo no
	echo \* rpmbuild binary not found... you will not be able to run bogosec on .src.rpm\'s.
else
echo yes
fi

for scanner in $scanners; do
    echo -n checking for $scanner...
    which $scanner > /dev/null 2>&1

    # If found, turn off warning
    if [ $? -eq "0" ]; then
        warn_scanner=0
	    echo yes
    else
	    echo no
    fi
done

if [ $warn_scanner -eq "1" ]; then
    echo \* One or more scanners not found... you must have at least one scanner to run bogosec
fi

echo