Dbdump
Revision as of 22:44, 20 July 2009 by Hopspitfire (talk | contribs) (New page: This is just a simple script that will find all .db3 or .db files and dump them to the /media/internal/dbdump directory as html so you can poke around easily to see if there's anything int...)
This is just a simple script that will find all .db3 or .db files and dump them to the /media/internal/dbdump directory as html so you can poke around easily to see if there's anything interesting.
<nowiki>
#!/bin/ash
SQLITE3=/usr/bin/sqlite3
FOLDER=/media/internal/dbdump
INDEX=$FOLDER/index.html
DB=1
getTables() {
$SQLITE3 $1 .tables
}
dumpTable() {
db=$1
tableName=$2
fileName=$3
$SQLITE3 $db <<EOF >> $fileName
.mode html
.header ON
.nullvalue --NULL--
select * from $tableName;
.exit
EOF
}
if [ -d $FOLDER ]
then
rm -rf $FOLDER.bak
mv $FOLDER $FOLDER.bak
fi
mkdir $FOLDER
files=`find / -name '*.db' -o -name '*.db3'`
cat <<EOF > $INDEX
<HTML><HEAD><TITLE>dbdump</TITLE></HEAD><BODY>
EOF
for db in $files
do
echo "DB:$db"
echo "
$db- " >> $INDEX
dbFolder=$FOLDER/db$DB
dbIndex=$dbFolder/index.html
mkdir $dbFolder
echo "<HTML><HEAD><TITLE>dbdump - $db</TITLE></HEAD><BODY>Tables
- " > $dbIndex
tables=`getTables $db`
for table in $tables
do
echo " - $table"
echo "<A href='db$DB/$table.html'>$table</A>" >> $INDEX
echo "<A href='$table.html'>$table</A>" >> $dbIndex
tablePage=$dbFolder/$table.html
echo "<HTML><HEAD><TITLE>dbdump - $db/$table</TITLE></HEAD><BODY>" > $tablePage
dumpTable $db $table $tablePage
echo "
<nowiki>