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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
Author: lantz moore <lmoore@debian.org>
Description: hide all output from tests
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=142422
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=190978
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229869
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306263
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/chkrootkit
+++ b/chkrootkit
@@ -228,11 +228,11 @@
fi
if [ "${EXPERT}" = "t" ]; then
- expertmode_output "./chklastlog -f ${WTMP} -l ${LASTLOG}"
+ expertmode_output "./chklastlog ${QUIET_ARG} -f ${WTMP} -l ${LASTLOG}"
return 5
fi
- if ./chklastlog -f ${WTMP} -l ${LASTLOG}
+ if ./chklastlog ${QUIET_ARG} -f ${WTMP} -l ${LASTLOG}
then
if [ "${QUIET}" != "t" ]; then echo "chklastlog: nothing deleted"; fi
fi
@@ -771,6 +771,9 @@
then
if [ "${QUIET}" != "t" ]; then echo "nothing found"; fi
else
+ if [ "${QUIET}" != "t" ]; then
+ printn "The following suspicious files and directories were found:"
+ fi
echo
echo ${files}
echo ${dirs}
@@ -1428,6 +1431,11 @@
chk_login () {
STATUS=${NOT_INFECTED}
CMD=`loc login login $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1470,6 +1478,11 @@
if [ ! -x ${CMD} -a -x ${ROOTDIR}usr/bin/passwd ]; then
CMD="${ROOTDIR}usr/bin/passwd"
fi
+ if [ ! -r "${CMD}" ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1624,6 +1637,11 @@
STATUS=${NOT_INFECTED}
LS_INFECTED_LABEL="/dev/ttyof|/dev/pty[pqrs]|/dev/hdl0|\.tmp/lsfile|/dev/hdcc|/dev/ptyxx|duarawkz|^/prof|/dev/tux|/security|file\.h"
CMD=`loc ls ls $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1641,6 +1659,11 @@
STATUS=${NOT_INFECTED}
DU_INFECTED_LABEL="/dev/ttyof|/dev/pty[pqrsx]|w0rm|^/prof|/dev/tux|file\.h"
CMD=`loc du du $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1683,6 +1706,11 @@
STATUS=${NOT_INFECTED}
NETSTAT_I_L="/dev/hdl0/dev/xdta|/dev/ttyoa|/dev/pty[pqrsx]|/dev/cui|/dev/hdn0|/dev/cui221|/dev/dszy|/dev/ddth3|/dev/caca|^/prof|/dev/tux|grep|addr\.h|__bzero"
CMD=`loc netstat netstat $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1702,6 +1730,11 @@
PS_I_L="/dev/xmx|\.1proc|/dev/ttyop|/dev/pty[pqrsx]|/dev/cui|/dev/hda[0-7]|\
/dev/hdp|/dev/cui220|/dev/dsx|w0rm|/dev/hdaa|duarawkz|/dev/tux|/security|^proc\.h|ARRRGH\.so"
CMD=`loc ps ps $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1860,6 +1893,11 @@
chk_basename () {
STATUS=${NOT_INFECTED}
CMD=`loc basename basename $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1884,6 +1922,11 @@
chk_dirname () {
STATUS=${NOT_INFECTED}
CMD=`loc dirname dirname $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1952,6 +1995,11 @@
STATUS=${NOT_INFECTED}
S_L="/bin/.*sh"
CMD=`loc date date $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -1982,6 +2030,11 @@
chk_echo () {
STATUS=${NOT_INFECTED}
CMD=`loc echo echo $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2003,6 +2056,11 @@
chk_env () {
STATUS=${NOT_INFECTED}
CMD=`loc env env $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2119,6 +2177,11 @@
chk_write () {
STATUS=${NOT_INFECTED}
CMD=`loc write write $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
WRITE_ROOTKIT_LABEL="bash|elite$|vejeta|\.ark"
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2140,6 +2203,11 @@
chk_w () {
STATUS=${NOT_INFECTED}
CMD=`loc w w $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
W_INFECTED_LABEL="uname -a"
if [ "${EXPERT}" = "t" ]; then
@@ -2177,6 +2245,11 @@
chk_tar () {
STATUS=${NOT_INFECTED}
CMD=`loc tar tar $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${ls} -l ${CMD}"
@@ -2264,6 +2337,11 @@
STATUS=${NOT_INFECTED}
EGREP_INFECTED_LABEL="blah"
CMD=`loc egrep egrep $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2281,6 +2359,11 @@
STATUS=${NOT_INFECTED}
GREP_INFECTED_LABEL="givemer"
CMD=`loc grep grep $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2538,6 +2621,11 @@
STATUS=${NOT_INFECTED}
SU_INFECTED_LABEL="satori|vejeta|conf\.inv"
CMD=`loc su su $pth`
+ if [ "${?}" -ne 0 ]
+ then
+ if [ "${QUIET}" != "t" ]; then echo "not found"; fi
+ return ${NOT_FOUND}
+ fi
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
@@ -2685,7 +2773,9 @@
-x) EXPERT=t;;
- -q) QUIET=t;;
+ -q) QUIET=t
+ QUIET_ARG="-q"
+ ;;
-V) echo >&2 "chkrootkit version ${CHKROOTKIT_VERSION}"
exit 1;;
--- a/chklastlog.c
+++ b/chklastlog.c
@@ -107,6 +107,8 @@
struct stat wtmp_stat;
struct s_localpwd *localpwd;
uid_t *uid;
+ int quiet = 0;
+
char wtmpfile[128], lastlogfile[128];
memcpy(wtmpfile, WTMP_FILENAME, 127);
@@ -128,10 +130,18 @@
++argv;
memcpy(lastlogfile, *argv, 127);
}
+ else if (!memcmp("-q", *argv, 2))
+ {
+ quiet = 1;
+ }
}
- signal(SIGALRM, read_status);
- alarm(5);
+ if (!quiet)
+ {
+ signal(SIGALRM, read_status);
+ alarm(5);
+ }
+
for (i=0; i<MAX_ID; i++)
userid[i]=FALSE;
|