Difference between revisions of "Dbdump"
Jump to navigation
Jump to search
Hopspitfire (talk | contribs) |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | This is just a simple script that will find all .db3 or .db files and dump them to the /media/internal/dbdump directory as | + | This is just a simple script that will find all .db3 or .db files and dump them to the <code>/media/internal/dbdump</code> directory as HTML, so you can easily poke around to see if there is anything interesting. |
<pre><nowiki> | <pre><nowiki> | ||
+ | |||
#!/bin/ash | #!/bin/ash | ||
− | |||
SQLITE3=/usr/bin/sqlite3 | SQLITE3=/usr/bin/sqlite3 | ||
FOLDER=/media/internal/dbdump | FOLDER=/media/internal/dbdump | ||
Line 69: | Line 69: | ||
echo "</BODY></HTML>" >> $INDEX | echo "</BODY></HTML>" >> $INDEX | ||
− | < | + | |
+ | </nowiki></pre> |
Latest revision as of 12:28, 4 September 2011
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 easily poke around to see if there is anything interesting.
#!/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 "<HR/>$db<UL>" >> $INDEX dbFolder=$FOLDER/db$DB dbIndex=$dbFolder/index.html mkdir $dbFolder echo "<HTML><HEAD><TITLE>dbdump - $db</TITLE></HEAD><BODY>Tables<UL>" > $dbIndex tables=`getTables $db` for table in $tables do echo " - $table" echo "<LI/><A href='db$DB/$table.html'>$table</A>" >> $INDEX echo "<LI/><A href='$table.html'>$table</A>" >> $dbIndex tablePage=$dbFolder/$table.html echo "<HTML><HEAD><TITLE>dbdump - $db/$table</TITLE></HEAD><BODY><TABLE border=1>" > $tablePage dumpTable $db $table $tablePage echo "</TABLE></BODY></HTML>" >> $tablePage done echo "</UL>" >> $INDEX echo "</UL>" >> $dbIndex echo "Generated: `date`" >> $dbIndex echo "</BODY></HTML>" >> $dbIndex DB=$(($DB+1)) done echo "Generated: `date`" >> $INDEX echo "</BODY></HTML>" >> $INDEX