migrated to github

This commit is contained in:
TLINDEN
2015-05-14 18:34:10 +02:00
parent f1f3230620
commit 5017b6b186
36 changed files with 5814 additions and 2 deletions

1
samples/README Normal file
View File

@@ -0,0 +1 @@
This directory contains examples how to use dbtool.

12
samples/account-db/README Normal file
View File

@@ -0,0 +1,12 @@
This is an example of how to use the new
encryption support of dbtool.
accdb is a account database tool, which
you can use (really :-) to maintain all
your accounts in one database file.
Never forget a password!
T.v. Dein <tlinden@cpan.org>

112
samples/account-db/accdb Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/sh
#
# This is a little interactive tool which helps you
# to maintain your accounts on one place.
#
# It uses an encrypted database for protecting the
# account list. The tool does not work with temporary
# files for security reasons.
#
# Just execute it. It will show you a little menu of
# all available commands. That's really easy :-)
#
# T.v. Dein <tlinden@cpan.org>
#
# the account database
db=~/.accdb
#
# check if dbtool version is 1.4 or higher
version=`dbtool -V 2>&1 | sed 's/[a-zA-Z .]*//g'`
if [ "x$version" != "x" ]; then
let res="$version < 14"
if [ "x$res" = "x1" ]; then
echo "This version of dbtool does not support encryption!"
exit 1
fi
else
echo "dbtool is not installed!"
exit 1
fi
#
# get the passphrase
echo -n "Enter passphrase: "
read PW
if [ "x$PW" = "x" ]; then
echo "empty passphrase!"
exit -1
fi
#
# store it in a local environment variable,
# so it will not appear in the process list and
# dbtool itself will not ask for it
export DB_PASSPHRASE=$PW
#
# the silly menu
function menu {
echo
echo -n "[L]ist [N]ew [S]earch [Q]uit> "
}
#
# go
echo
menu
while :
do
read command
if [ "x$command" = "xL" -o "x$command" = "xl" ]; then
echo
if [ -e $db ]; then
#
# just dump all entries out. Use a custom output
# separator for better formatting with sed :-)
dbtool -d $db -p -D -F "<22>" | sed 's/<2F>/ => /'
fi
elif [ "x$command" = "xN" -o "x$command" = "xn" ]; then
echo
echo -n "Enter entry name: "
read name
if [ "x$name" = "x" ]; then
echo "empty name!"
else
echo -n "Enter username: "
read user
echo -n "Enter password: "
read pass
#
# create a new entry, separate the key and the value
# using the pipe character, overwrite existing entry
echo "$name| Username: $user, Password: $pass" \
| dbtool -p -i -f -d $db -F "|"
echo "entry $name inserted."
fi
elif [ "x$command" = "xS" -o "x$command" = "xs" ]; then
echo -n "Enter search string: "
read string
#
# search for the given key
dbtool -p -d $db -s -k $string
elif [ "x$command" = "xQ" -o "x$command" = "xq" ]; then
echo
echo "Thanks for the fish."
echo
exit 0
fi
menu
done
#
# clear the environment variable. just in case...
unset DB_PASSPHRASE

19
samples/locate/README Normal file
View File

@@ -0,0 +1,19 @@
just an example showing what's possible
with dbtool. These two shell scripts
are doing the same job as GNU locate.
updatedb
creates a database which contains
every file (with path) of a system
along with all it's attributes.
locate
searches in this database using
user supplied regular expressions
You need to edit both scripts to suit
your system.
T.v. Dein <tlinden@cpan.org>

24
samples/locate/locate Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# simple locate alike
# written as an example how to
# use dbtool.
#
# locate searches the database
# for a file which matches a
# certain string. The parameter
# to locate can be a fully perl-
# compliant regular expression.
#
dbtool="/usr/bin/dbtool";
find="/usr/bin/find";
db="/var/local/locate.db";
sort="/bin/sort";
regex=$1;
if [ "x$regex" != "x" ]; then
$dbtool -d $db -S -k $regex -w -R;
else
echo "Usage: locate <expression>";
fi

25
samples/locate/locate~ Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
#
# simple locate alike
# written as an example how to
# use dbtool.
#
# locate searches the database
# for a file which matches a
# certain string. The parameter
# to locate can be a fully perl-
# compliant regular expression.
#
# $Id: locate,v 1.3 2001/06/26 23:00:02 scip Exp $
dbtool="/usr/bin/dbtool";
find="/usr/bin/find";
db="/var/local/locate.db";
sort="/bin/sort";
regex=$1;
if [ "x$regex" != "x" ]; then
$dbtool -d $db -S -k $regex -w -R;
else
echo "Usage: locate <expression>";
fi

19
samples/locate/updatedb Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
#
# simple locate alike
# written as an example how to
# use dbtool.
#
# updatedb creates the database
# which is then used by locate
# to search for a certain string.
#
dbtool="/usr/bin/dbtool";
find="/usr/bin/find";
db="/var/local/locate.db";
egrep="/bin/egrep";
cp="/bin/cp"
$cp /dev/null $db;
$find / -ls | $egrep -v "^\/proc|dev|tmp" | $dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$";

21
samples/locate/updatedb~ Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
#
# simple locate alike
# written as an example how to
# use dbtool.
#
# updatedb creates the database
# which is then used by locate
# to search for a certain string.
#
# $Id: updatedb,v 1.2 2001/06/26 23:00:02 scip Exp $
#
dbtool="/usr/bin/dbtool";
find="/usr/bin/find";
db="/var/local/locate.db";
egrep="/bin/egrep";
cp="/bin/cp"
$cp /dev/null $db;
$find / -ls | $egrep -v "^\/proc|dev|tmp" | $dbtool -d $db -i -f -R -t "^(.+?) (\/.*)$";

11
samples/uback/README Normal file
View File

@@ -0,0 +1,11 @@
uback is a backup script which uses dbtool to
maintain catalog databases of the files which
have backed up.
Download uback from the following location:
ftp://www.0x49.org/scip/Scripts/uback-1.2.tar.gz
T.v. Dein <tlinden@cpan.org>