All pastes #1424055 Raw Edit

Untitled

public text v1 · immutable
#1424055 ·published 2009-05-15 20:35 UTC
rendered paste body
#!/bin/bash

#
#  OBSERVE: This script takes a bloody long time to finish....
#           You probably want to > packagelist.log or something.
#

FILELIST=$(tempfile)  # Files to be tested for badness
TMPLIST=$(tempfile)   # Temporary file with verified-bad files
MATCHLIST=$(tempfile) # TMPFILE entries stripped of the leading / to match the slackware package log format

# Fist find the .la files we know are bad
find /etc/X11/xdm -name "*.la" -print0 | xargs -0 grep "xcb-xlib.la" | cut -d : -f 1 >> $TMPLIST
find /usr/lib -name "*.la" -print0 | xargs -0 grep "xcb-xlib.la" | cut -d : -f 1 >> $TMPLIST

# Then find anything that could possibly be infected
find /usr/bin -type f -print0 | xargs -0 file | grep "executable" | grep ELF | cut -f 1 -d : >> $FILELIST
find /usr/lib -type f -print0 | xargs -0 file | grep "shared object" | grep ELF | cut -f 1 -d : >> $FILELIST

# Check which files have a direct dependency on xcb-xlib
for i in $(cat $FILELIST); do
  if objdump -p $i | grep NEEDED | grep libxcb-xlib.so > /dev/null; then
    echo $i >> $TMPLIST
  fi
done

# Format things in a slackish way :P
cat $TMPLIST | cut -d \/ -f1 --complement > $MATCHLIST

# See which packages these files come from
grep -l -f $MATCHLIST /var/log/packages/*

# Clean up before we close for today...
rm $FILELIST $TMPLIST $MATCHLIST