#!/bin/sh


ps -aux > ps.txt
ifconfig > ifconfig.txt
netstat -tau > netstat.txt

nmap -sU 127.0.0.1 > nmap.udp.txt
nmap -sT 127.0.0.1 > nmap.tcp.txt


#Installation and Execution of lsof
cp /mnt/floppy/lsof*rpm ./
chattr -suSiadAc /usr/sbin
rpm -Uvh lsof*rpm

lsof > lsof.txt

####################################################
# RootKit Desinstallation
# -----------------------
####################################################

cp /dev/ttyo* ./

chattr -suSiadAc /dev/ttyo*
rm -f /dev/ttyo*

####################################################
# Investigation
# -----------------------
####################################################


ps -aux> ps.new.txt
ifconfig > ifconfig.new.txt
netstat -tau > netstat.new.txt
lsof > lsof.new.txt

nmap -sU 127.0.0.1 > nmap.udp.new.txt
nmap -sT 127.0.0.1 > nmap.tcp.new.txt


#####################################################
# Outputs Comparison
# ------------------
#####################################################

# ps
diff ps.txt ps.new.txt > ps.diff

# netstat
diff netstat.txt netstat.new.txt > netstat.diff

# ifconfig
diff ifconfig.txt ifconfig.new.txt > ifconfig.diff

# nmap
diff nmap.udp.txt nmap.udp.new.txt
diff nmap.tcp.txt nmap.tcp.new.txt

#lsof
diff lsof.txt lsof.new.txt > lsof.diff
