tag:blogger.com,1999:blog-88451292024-03-08T05:34:54.776-04:00Tim's Random InterestsTimothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-8845129.post-311822777474629372011-03-03T23:00:00.000-04:002011-03-03T23:00:52.090-04:00Fixing KOBO's malformed databaseThis is likely to be one of many posts on the subject. I have an interest since the malformed database often rears its ugly head when using Calibre. Since I wrote the Kobo driver for Calibre and I do not believe Calibre causes the issue I have an interest in knowing more about the cause and potential fixes.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Dumping the database</span><br />
<br />
For my purposes I use sqliteman to dump the database to a file. I have not tested the script simply using the sqlite3 command but I imagine it would work.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">the script</span><br />
<br />
The script below lacks some (a lot) of features and has hard coded file names, etc but it does the job. I used python because I might want to actually use some sqlite connections at some point.<br />
<br />
The script works by attempting to interpret each row in the dump file as Unicode. If it fails the associated line and the related sql command is dropped.<br />
<br />
<pre><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#!/usr/bin/env python</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">import re</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">import string</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">import binascii</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">file = open("kobo-corrupt-nick.sql", "rb")</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">err_file = open("error.log", "w")</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">out_file = open("out.log", "w")</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">new_stmt = False</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">prev_row = ""</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">err_line = ""</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">corrupt = False</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">prev_corrupt = False</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">firstrow = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">while 1:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> line = file.readline()</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if not line:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> break</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> try:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> err_line = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if re.match("[I][N][S][E][R][T] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> elif re.match("[D][R][O][P] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> elif re.match("[C][R][E][A][T][E] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> elif re.match("[P][R][A][G][M][A] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> elif re.match("[B][E][G][I][N] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> elif re.match("[C][O][M][M][I][T] *", line):</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> else:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> new_stmt = False</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> row = row + line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if new_stmt == True:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_corrupt == False:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_row != "":</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> out_file.write(prev_row)</span>
<div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> else:</span></div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_row != "":</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> err_file.write(prev_row)</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> prev_row = row</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">
</span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> unicode(line, 'utf-8')</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> prev_corrupt = corrupt</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> except UnicodeDecodeError:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> prev_corrupt = True</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> prev_row = row</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> print line</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> continue</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> except:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> raise</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if new_stmt == True:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_corrupt == False:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_row != "":</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> out_file.write(prev_row)</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> else:</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if prev_row != "":</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> err_file.write(prev_row)</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">file.close()</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">err_file.close()</span>
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">out_file.close()</span>
<div></div></pre><div><span class="Apple-style-span" style="font-family: inherit; font-size: large;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: inherit; font-size: large;">Importing the file</span></div><div><br />
</div><div>Importing the file is straight forward, simply run:</div><div><br />
</div><div>sqlite3 KoboReader.sqlite < out.log</div><div><br />
</div><div><span class="Apple-style-span" style="font-size: large;">Validating the data</span></div><div>This is the kicker. A lack of understanding of the data relationships may prevent being able to sort out the data. I have started on some scripts that may help. For instance:</div><div><br />
</div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"></span><br />
<pre><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"></span></pre></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">select </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.title, </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> vs.volumeid, c.numshortcovers - count(vs.volumeid) diff</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">from </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> volume_shortcovers vs inner join content c on</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.contentid = vs.volumeid </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">where </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.bookid is Null</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">group by </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.title,vs.volumeid, c.numshortcovers </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">having diff <> 0</span></div></div><div></div><div><br />
</div><div>This script looks for issues where the number of rows in volume_shortcovers for each book is not the number specified by numshortcovers in the book record in the content table.</div><div><br />
</div><div>Does it mean anything? Who knows as my Kobo that has no issues also as differences.</div><div><br />
</div><div>Another sql statement attempts to rebuild those missing rows:</div><div><br />
</div><div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"></span><br />
<pre><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"></span></pre></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">insert into volume_shortcovers (volumeid, shortcoverid, VolumeIndex)</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">select </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.bookid, c.contentid, c.volumeindex</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">from content c left outer join volume_shortcovers vs on </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.bookid = vs.volumeid and </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.contentid = vs.shortcoverid and </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.volumeindex = vs.volumeindex </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">where </span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> c.bookid is not Null and</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> vs.volumeid is Null</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">order by c.bookid, c.volumeindex </span></div></div><div><span class="Apple-style-span" style="font-family: inherit;"></span></div><div><span class="Apple-style-span" style="font-family: inherit;">Is that safe? No idea but I am working on it... Running it on a database that had issues reduced the number of rows returned by the first sql query.</span></div><div><span class="Apple-style-span" style="font-family: inherit;"><br />
</span></div><div><span class="Apple-style-span" style="font-family: inherit;">As I learn more I will post it here.</span></div><div><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br />
</span></div>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-60831721114555723642010-03-10T22:23:00.001-04:002010-03-10T22:50:18.367-04:00Automatically Resize Photos for Users<b>What it does</b><br />
<b> </b> <br />
This is a script I wrote some time ago to automatically resize photos for some users. With this script, they can simply copy their digital camera photos to a directory in their home directory. When the script runs via cron it will use ImageMagick's convert utility to shrink the photo to the default size (1024x768) with a quality of 75 and <b>delete</b> the original.<br />
<br />
It will automatically create the required directories if they do not exist<br />
<br />
<b>Why</b><br />
<br />
Some users are not comfortable with using ImageMagick and few of the available gui tools are as fast at resizing multiple files. With this script, the users simply drop the files in place, wait a few minutes and the cron job resizes the files for them.<br />
<br />
It also has the added benefit of reducing the storage requirements for photos<br />
<br />
<b>Potential issues</b><br />
<br />
The script automatically <b>deletes the original</b>. This is by design don't complain to me if you lose original work.<br />
<br />
<b>ToDo</b><br />
<b> </b> <br />
The script currently meets my needs but I would probably add the ability for the user to specify a default size, quality, photo directory and the option of keeping the originals via a config file in their home directory<br />
<br />
<b>Script</b><br />
This same script is available at <a href="http://www.k12ltsp.org/mediawiki/index.php/Automatically_Resize_Photos_for_Users">http://www.k12ltsp.org/mediawiki/index.php/Automatically_Resize_Photos_for_Users</a> as it was originally posted there.<br />
<br />
<pre>#!/bin/bash
# Copyright (C) 2006 Timothy Legge
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# Resize all the files in a directory when it runs. The assumption is
# that this will be run via cron so the files dropped in the directory
# will be automatically resized at regular intervals
#
# Checking for root privelages to call script:
ROOT_UID=0 # Root has $UID 0.
if [[ "$UID" -eq "$ROOT_UID" ]] # Check to ensure user is root..
then
PASSWORD_FILE=/etc/passwd
NEW_SIZE=1024x768 # New Size
QUALITY=75 # Default jpg quality
PROCESS_DIR=Desktop/resize_photos
# Exclude the following directories
exclude_dirs="/home/ltcc3
/home/ltcc4
/home/al
/home/don"
#echo "This script will process photos in all users ~/photos directory and"
#echo "DELETE all the original photos"; echo
#echo "YOU HAVE BEEN WARNED"; echo
#echo "Comment the following line if you know what you are doing"
#exit 0 # Comment or delete line to use script
for name in $(awk 'BEGIN{FS=":"}{if ($3>500) print $1;}' < "$PASSWORD_FILE" )
do
HOME_DIR=/home/$name
if [[ ! -e "$HOME_DIR" ]];
then
continue # User does not have a home directory
fi
PHOTO_DIR=$HOME_DIR/$PROCESS_DIR
RESIZE=$PHOTO_DIR/$NEW_SIZE # Resize to most monitor resolitions
skip_dir=0
# Check to see whether the current directory is
# in the list of excluded directories
for exclude in $exclude_dirs
do
if [[ "$exclude" = "$HOME_DIR" ]]
then
# echo "Exclude : $exclude"
skip_dir=1
break # Directory is excluded break out of the loop
fi
done
# Check to see whether the directory should be skipped (in excluded list)
if [[ "$skip_dir" = "1" ]]
then
continue # Exclude directory go to next directory
else # Process the photos in the directories as normal
# Check to see whether the $PHOTO_DIR exists
# Create it if it does not
if [[ ! -e "$PHOTO_DIR" ]];
then
echo "Photo resize directory does not exist"
echo " Creating $PHOTO_DIR"
if mkdir "$PHOTO_DIR" 2>/dev/null;
then
chown $name:$name $PHOTO_DIR
echo " $PHOTO_DIR successfully created"
# Create the $RESIZE_DIR since its parent did not exist
if mkdir "$RESIZE" 3>/dev/null
then
chown $name:$name $RESIZE
echo " $RESIZE successfully created"
else
echo " ERROR: unable to create $RESIZE"
continue
fi
else
echo " ERROR: unable to create $PHOTO_DIR"
continue
fi
continue
fi
# Check to see whether the location for the resized files exists
# Create it if it does not
if [[ ! -e "$RESIZE" ]];
then
echo "Location for resized photos does not exist"
echo " Creating $RESIZE"
if mkdir "$RESIZE" 2>/dev/null;
then
chown $name:$name $RESIZE
echo " $RESIZE successfully created"
else
echo " ERROR: unable to create $RESIZE"
continue;
fi
fi
# Start Processing files
echo "Begin processing pictures in $PHOTO_DIR"
# Loop through each file in the $PHOTO_DIR
for file in $PHOTO_DIR/*
do
if [[ ! -e "$file" ]]; # Check to see if any files exist
then
echo "$file does not exist."
continue
fi
# Only process regular file types (not directories)
if [[ -f "$file" ]]
then
echo " convert "$file" -resize $NEW_SIZE -quality 75 $RESIZE/`basename "$file"`"
if convert "$file" -resize $NEW_SIZE -quality 75 "$RESIZE/`basename "$file"`" 2>/dev/null
then
if rm -f "$file" 2>/dev/null
then
echo " Successfully deleted $file"
else
echo " Error attempting to delete $file"
fi
else
echo " Error attempting to resize $file"
echo " Original file not deleted"
fi
fi
done
chown $name:$name $RESIZE/*
# Finish Processing files
echo "No resizable pictures remaining in $PHOTO_DIR"
fi # Directory not excluded - Process photos
done
else # not root
echo "Script must be run as root"
fi
exit 0
</pre>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-64294377796596433812009-11-15T21:44:00.001-04:002009-11-15T21:54:05.937-04:00Running Multiple SSD Daemons in Ubuntu<div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: x-large;"><b>Introduction</b></span><br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;">There are times when running multiple sshd daemons makes sense. One of those times is when you have a server that has both a public/external interface and an private/internal interface. A LTSP server is a perfect example of this. <br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;">LTSP servers typically have an internal network that the thin clients are on and an external network that connects to the Internet. Often, the internal users are not using strong passphrases and allowing direct ssh connection from the Internet would put you system at risk.<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><br />
<div style="font-family: Arial,Helvetica,sans-serif;">The solution is to split up the sshd configuration by interface so you can use more secure settings for the public interface.<br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;">In this setup I also create a sshd daemon for localhost (127.0.0.1) as it is used for <a href="http://www.nomachine.com/">NOMACHINE's</a> nxServer and client.<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: x-large;"><b>Setup</b></span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-size: large;">Create custom files:</span></b><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/ssh/sshd_config </span><span style="font-size: small;"></span><span style="font-size: small;">/etc/ssh/sshd_config_internal</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/ssh/sshd_config </span><span style="font-size: small;">/etc/ssh/sshd_config_localhost</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/init.d/ssh </span><span style="font-size: small;">cp /etc/init.d/ssh_internal</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/init.d/ssh </span><span style="font-size: small;">cp /etc/init.d/ssh_localhost</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/default/ssh </span><span style="font-size: small;"> /etc/default/ssh_internal</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp /etc/default/ssh </span><span style="font-size: small;"> /etc/default/ssh_localhost</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;"></span>_rsa_key </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;">_internal</span>_rsa_key</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;"></span>_rsa_key </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;">_localhost</span>_rsa_key</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;"></span>_dsa_key </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;">_internal</span>_dsa_key</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">cp </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;"></span>_dsa_key </span><span style="font-size: small;">/etc/ssh/ssh_host<span style="color: red;">_localhost</span>_dsa_key</span><br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-size: large;">Minimal Config File Changes</span></b><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">These minimum changes are required to simply make the three daemons configuration different enough to run. Later you can make modifications to increase the security of the public interface.</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Edit /etc/ssh/sshd_config</span></b></i><br />
</div><ol><li><span style="font-size: small;">Edit ListenAddress to make it the ip address of the public interface</span></li>
<li><span style="font-size: small;">Add<span style="background-color: white;"> </span><span style="background-color: white; color: red;">PidFile /var/run/sshd.pid</span></span></li>
</ol><div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Edit /etc/ssh/sshd_config</span><span style="font-size: small;">_internal</span></b></i><br />
</div><ol><li><span style="font-size: small;">Edit ListenAddress to make it the ip address of the private interface</span></li>
<li><span style="font-size: small;">Add<span style="background-color: white;"> </span><span style="background-color: white; color: red;">PidFile /var/run/sshd_internal.pid</span></span></li>
<li><span style="font-size: small;">Edit HostKey /etc/ssh/ssh_host<span style="color: red;">_internal</span>_rsa_key</span></li>
<li><span style="font-size: small;">Edit HostKey /etc/ssh/ssh_host<span style="color: red;">_internal</span>_dsa_key <br />
</span></li>
</ol><div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Edit /etc/ssh/sshd_config</span><span style="font-size: small;">_localhost</span></b></i><br />
</div><ol><li><span style="font-size: small;">Edit ListenAddress to make it 127.0.0.1</span></li>
<li><span style="font-size: small;">Add<span style="background-color: white;"> </span><span style="background-color: white; color: red;">PidFile /var/run/sshd_localhost.pid</span></span></li>
<li><span style="font-size: small;">Edit HostKey /etc/ssh/ssh_host<span style="color: red;">_localhost</span>_rsa_key</span></li>
<li><span style="font-size: small;"> Edit HostKey /etc/ssh/ssh_host<span style="color: red;">_localhost</span>_dsa_key</span></li>
</ol><div style="font-family: Arial,Helvetica,sans-serif;"></div><div style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-size: large;">Init Script Changes</span></b><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"> </span>Here, it is easier to modify one of the scripts first and then do a search and replace to create the second script but I will show all the changes:<br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Edit /etc/init.d/ssh_internal</span></b></i><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">sed -i 's/usr.sbin.sshd/usr\/sbin\/sshd_internal/g' ssh_internal_temp</span><i><b><span style="font-size: small;"> </span><span style="font-size: small;"></span></b></i><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"> </span>sed -i 's/var.run.sshd/var\/run\/sshd_internal/g' ssh_internal_temp<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sed -i 's/"sshd"/"sshd_internal"/g' ssh_internal_temp<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sed -i 's/etc.default.ssh/etc\/default\/ssh_internal/g' ssh_internal_temp<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sed -i 's/Provides:\t\tsshd/Provides:\t\tsshd_internal/g' ssh_internal_temp<br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Edit /etc/init.d/ssh_localhost</span></b></i> <br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;">sed -i 's/usr.sbin.sshd/usr\/sbin\/sshd_localhost/g' ssh_localhost_temp<br />
sed -i 's/var.run.sshd/var\/run\/sshd_localhost/g' ssh_localhost_temp <br />
sed -i 's/"sshd"/"sshd_localhost"/g' ssh_localhost_temp<br />
sed -i 's/etc.default.ssh/etc\/default\/ssh_localhost/g' ssh_localhost_temp <br />
sed -i 's/Provides:\t\tsshd/Provides:\t\tsshd_localhost/g' ssh_localhost_temp<br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><span style="color: red;">Note that there are no capital Vs in the above. It is a backslash \ followed by a forwardslash / as in "\/"</span><br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><i style="font-family: Arial,Helvetica,sans-serif;"><b><span style="color: black;">Create links to sshd</span></b></i><br />
</div><br />
<div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">ln -s /usr/sbin/sshd </span><span style="font-size: small;">/usr/sbin/sshd_internal</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">ln -s /usr/sbin/sshd </span><span style="font-size: small;">/usr/sbin/sshd_localhost</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><i><b><span style="font-size: small;">Set the new init scripts to start automatically</span></b></i><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">update-rc.d sshd_internal defaults</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;">update-rc.d sshd_localhost defaults<br />
</span><br />
</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com2tag:blogger.com,1999:blog-8845129.post-17339237491959075442009-10-14T22:49:00.002-03:002009-10-14T22:51:00.687-03:00Dansguardian, ident and Windows clientsI manage a Ubuntu, LTSP setup and recently there was an issue where the Windows XP clients that use the Dansguardian web proxy stopped working. Since the issue was noticed some days after the change that casued it I did not realize the connection.<br />
<br />
At some point I had enabled ident in the /etc/dansguardian/dansguardian.conf setting in order to record the user name of the person using the proxy. This worked as planned on the LTSP clients however the Windows XP clients stopped working. I figured it out when I noticed that the clients did not totally stop working but were in fact really slow. <br />
<br />
The Dansguardian proxy was attempting to connect to Windows XP on port 113/tcp and the firewall was blocking the access. As a workaround I simply added a port exception in the Windows XP firewall to allow the proxy to connect to port 113/tcp. Since nothing was listening on that port Dansguardian instantly received a reply that the connection was refused and the proxy worked fine (with the exception of not being able to identify the user.<br />
<br />
I now need to either find a Windows ident server or figure out how the ntlm authentication works in Dansguardian.Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-62621832269503665452009-09-21T22:01:00.003-03:002009-09-21T23:35:20.857-03:00Ubuntu and kvm virtualization - know who you are and where it runsMaybe I should have read the documentation. Might have saved me a few confused hours. I doubt it though as my issue seemed to be something straight forward enough that it is probably not documented.<br /><br />I had created a virtual machine using the Virtual Machine Manager GUI. It was a CentOS system, minimally configure that I simply wanted to clone as I needed a couple of machines to test <a href="http://www.igniterealtime.org/projects/openfire/index.jsp">Openfire</a>. Unfortunately, all my vast knowledge (Google) ;-) seemed to let me down. <br /><br />The command that should have cloned the system<br /><blockquote>sudo virt-clone -o CentOSServer -n CentOSServer2 -f /home/user/CentOS2.img --connect=qemu:///system</blockquote>failed with an error:<br /><br /><blockquote>ERROR Domain CentOSServer is not found</blockquote>Yet, the virtual machine that I was attempting to clone existed. I connected to it with the Virtual Machine Manager and was able to start it and access it without any issues.<br /><br />I tried various alternatives including specifying --connect=qemu:///session but nothing seemed to work.<br /><br />I tried virsh to connect in an attempt to use the "list -all" command. I was thinking that the gui could find the virtual machine so it had to be somewhere:<br /><blockquote>sudo virsh --connect=qemu:///session list --all</blockquote><br /><br />Unfortunately, that did not list any virtual machines. <br /><br />The answer was fairly simple once I noticed that the GUI had specified "localhost (User)" in the name of the host to which I had connected and that the virtual machines were part of. I realized that by running the commands using sudo, I was connecting with root's profile while I was running the Virtual Machine Manager as my own user profile.<br /><br />Once I realized that I should connect as my own user the "virsh list --all" command showed the virtual machine that I wanted to clone. Then, the following command cloned the system:<br /><br />sudo virt-clone -o CentOSServer -n CentOSServer2 -f /home/user/CentOS2.img --connect=qemu:///session<br /><br />I need to do a little research to understand the difference between the session and the system but it worked. Now back to <a href="http://www.igniterealtime.org/projects/openfire/index.jsp">Openfire</a><br /><br /><br /><br /><blockquote></blockquote>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-63295048718626634572009-01-16T21:42:00.005-04:002009-01-16T22:27:27.542-04:00Lock Firefox Proxy and other SettingsLocking Firefox settings in a multi-user Linux system can be a bit difficult and the information out there varies in quality. A while ago I found a script written by Andy Rabagliati of http://wizzy.org.za that automatically created the correctly formated config file and updated the Firefox settings to import the config file.<br /><br />Recently when I used it on Ubuntu I ran into issues so I modified the script to account for the way Ubuntu separates the browser from xulrunner.<br /><br />Here is a link to the updated script <a href="http://timlegge.googlepages.com/moz-lock.pl">http://timlegge.googlepages.com/moz-lock.pl.</a><br /><br />To run the script simply pass it the ip address of the proxy server as follows:<br /><blockquote>sudo ./moz-lock.pl 192.168.0.254</blockquote>There are numerous additional settings that can be enabled at the bottom of the script. Currently the following settings are enabled:<br /><ol><li>Set the cache size to 10 megs</li><li>Do not hide the tabs if only one is open</li><li>Proxy settings</li></ol>To reverse the settings simply open the all.js files that are modified (modified files are listed when the scrip runs) and remove or comment out the last line in the file or copy the backup version over the modified file,Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-4297983263565487182008-08-31T16:21:00.011-03:002008-09-01T18:02:06.891-03:00The Ultimate Hacker Key<span style="font-weight: bold;font-size:130%;" >The Ultimate Hacker Key (aka who needs a key chain)</span><br /><br />While listening to <a href="http://www.pauldotcom.com/wiki/index.php/Episode114">PaulDotCom Security Weekly 114</a> I "discovered" <a href="http://unetbootin.sourceforge.net/">UNetbootin - Universal Netboot Installer</a>. Paul talked about installing Backtrack 3 on his USB key and how easy UNetbootin was to use. A colleague of mine recently expressed an interest in having Backtrack running on a USB Key so I thought I would take a look.<br /><br /><span style="font-weight: bold;font-size:130%;" >Installing Backtrack 3<br /><br /></span>Getting Backtrack installed and ready to boot from usb is so simple using UNetbootin it almost does not require directions. But here they are:<br /><ol><li>Goto http://unetbootin.sourceforge.net/</li><li>Click Download (for windows or Linux)</li><li>Insert your USB Key<br /></li><li>Run UNetBootin</li><li>Select BackTrack from the Distribution Download</li><li>The Version populates automatically</li><li>Select the drive that is your USB key (hint: it is probably not C:\)</li><li>Click Okay</li><li>Wait</li><li>Reboot and if USB is a boot option the Backtrack menu should appear</li></ol><span style="font-weight: bold;font-size:130%;" > So who needs a Key Chain</span><br /><br />On several PaulDotCom Security Weekly podcasts, Larry referenced and <a href="http://www.pauldotcom.com/wiki/index.php?title=Episode115">described his key chain</a>. It has some pretty cool things but who needs a key chain when you have a 8 GB Kingston USB key ($19.99 CDN at FutureShop last week). It got me thinking, whether I could get all those things on one device. <span style="font-weight: bold;"><br /><br />First up - Ophcrack<br /><br /></span>Ophcrack is a free Windows password cracker based on rainbow tables. So, lets get it installed:<br /><ol><li>Plug in the USB Key<br /></li><li>Download the ophcrack LiveCD iso from http://ophcrack.sourceforge.net/download.php<br /></li><li>Mount the iso image (mount -o loop <a href="http://downloads.sourceforge.net/ophcrack/ophcrack-xp-livecd-2.0.1.iso"><span class="number">ophcrack-xp-livecd-2.0.1.iso</span></a> /mnt/cdrom)<br /></li><li>Copy the main directory to the USB key (cp -ra /mnt/cdrom/ophcrack /media/usbkey/)<br /></li><li>Copy and rename the boot directory (cp -ra /mnt/cdrom/boot /media/usbkey/bootoph)</li><li>umount /mnt/cdrom</li><li>Edit the syslinux.cfg from Backtrack 3 (vim /media/usbkey/boot/syslinux/syslinux.cfg)<br /></li><li>Comment out any extra Backtrack 3 boot images that you don't plan to use<br /></li><li>Add in the boot section from /media/usbkey/bootoph/ophcrack.cfg like:<br /><blockquote>LABEL xconf<br />MENU LABEL Ophcrack Graphic mode<br />KERNEL /bootoph/vmlinuz<br />APPEND initrd=/bootoph/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;startx changes=/slax/<br /></blockquote></li><li>Note that the /boot/ references were changed to /bootoph/</li><li>Reboot</li><br /></ol><span style="font-weight: bold;font-size:130%;" >Second - Offline NT Password & Registry Editor</span><br /><br />This is a utility to (re)set the password of any user that has a valid (local) account on your Windows NT/2k/XP/Vista etc system. You do not need to know the old password to set a new one. <span style="font-weight: bold;"><br /></span><br />This is a very small live CD so putting it on its own USB key seems like a waste.<br /><ol><li>Download the CD image from <a href="http://home.eunet.no/pnordahl/ntpasswd/bootdisk.html"><span style="text-decoration: underline; color: rgb(0, 0, 255);">http://home.eunet.no/pnordahl/ntpasswd/bootdisk.html</span></a></li><li>Unzip the zip <span style="text-decoration: underline; color: rgb(0, 0, 255);"></span>the zip file to obtain the cd080802.iso</li><li>mount the iso file (mount -o loop cd080802.iso /mnt/cdrom)</li><li>create a boot directory called bootnpwd on the USB key (mkdir /media/usbkey/bootpwd)<br /></li><li>Copy all files froom the iso to the new directory (cp -ra /mnt/cdrom/* /media/usbkey/bootnpwd)</li><li>umount /mnt/cdrom</li><li>Edit the syslinux.cfg from Backtrack 3 (vim /media/usbkey/boot/syslinux/syslinux.cfg)<br /></li><li>Add in the boot section from /media/usbkey/bootnpwd/syslinux.cfg like:<br /><blockquote>LABEL bootnwd<br />MENU LABEL Offline NT Password and Registry Editor<br />KERNEL /bootnpwd/vmlinuz<br />APPEND rw vga=1 initrd=/bootnpwd/initrd.cgz,/bootnpwd/scsi.cgz</blockquote></li><li>Note that the /boot/ references were changed to /bootnpwd/</li><li>Reboot</li></ol><span style="font-weight: bold;font-size:130%;" >To Do List</span><br /><ol><li>Add extra RainBow tables for OphCrack</li><li>Add Ubuntu or some other General Purpose Distro<br /></li></ol><span style="font-weight: bold;"><span style="font-size:130%;">Notes</span></span><br /><ol><li>For Windows users there are a number of utilities to mount an iso image as a drive. Do a Google Search or get a real OS ;-)</li><li>The instructions above are from memory and while I have read it several times to remove obvious errors some may still exist. Leave feedback with corrections but use it has a guide...<br /></li></ol><br /><h2></h2>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-72362669347708174492008-03-22T21:38:00.003-03:002008-03-22T22:11:59.267-03:00Starting mvprelay via init.dI have created a script to start and stop mvprelay via the init.d process. The script is for Ubuntu 7.10 - the Gutsy Gibbon.<br /><ol><blockquote><li>Download <a class="tr_pseudo-link" title="Click to view this file" href="http://timlegge.googlepages.com/mvprelay_init.tar.gz" target="_blank">mvprelay_init.tar.gz</a> to /tmp<br /></li><li>cd /</li><li>sudo tar xvfz /tmp<span style="text-decoration: underline;">/</span><a class="tr_pseudo-link" title="Click to view this file" href="http://timlegge.googlepages.com/mvprelay_init.tar.gz" target="_blank">mvprelay_init.tar.gz</a></li><li>vim /etc/default/mvprelay</li><ol><li>Update the MEDIA_SERVER variable with your server's IP address</li><li>save the file</li></ol><li>sudo update-rc.d mvprelay start 50 2 3 4 5 .</li><li>/etc/init.d/mvprelay start<br /></li></blockquote></ol>This process should extract the files to the correct location under /etc (/etc/init.d and /etc/default). The <span style="font-weight: bold;">update-rc.d</span> command sets mvprelay to start in run modes 2, 3, 4 , 5 and priority 50 (which should be after the dhcpd, tftp mysql servers have started).<br /><br />I have test the script, it starts, it stops, it restarts. mvpmc boots up from a cold boot. Other than that it is completely untested so your results may differ. No warranty provided, but I will help where I can.Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-49541330690160722742008-03-08T20:23:00.006-04:002008-09-01T18:45:06.673-03:00Breaking Windows with Firewire and UbuntuAdam Boileau (<a href="http://www.storm.net.nz/projects/16">http://www.storm.net.nz/projects/16</a>) recently released source code for a tool that can unlock a password locked Windows machine in seconds. While quite simple to use the documentation is not clear on how exactly it is used or how the parts work. I hope this helps:<br /><br />These instructions are for Ubuntu 7.10 - the Gutsy Gibbon:<br /><br /><span style="font-size:130%;">First install the required libraries</span>:<br /><blockquote>apt-get install libdc1394-13 libraw1394-dev swig</blockquote><span style="font-size:130%;">Second download and install Python 2.3</span>:<br /><blockquote>wget http://www.python.org/ftp/python/2.3.6/Python-2.3.6.tgz<br />tar xvfz Python-2.3.6.tgz<br />mv Python-2.3.6 python-2.3<br />cd python-2.3<br />./configure<br />make<br />sudo make install</blockquote>This will install python in /usr/local which means you need to update each script to reference this location.<br /><br /><span style="font-size:130%;">Third, Fixup the libraw1394</span>:<br /><blockquote>vim /usr/local/include/libraw1394/raw1394.h</blockquote>search for and comment out the__attribute__ ((deprecated)); and be sure to put an ending semicolon on the previous line<br /><br /><span style="font-size:130%;">Fourth, download the software from http://www.storm.net.nz/projects/16</span><br /><blockquote>wget http://www.storm.net.nz/static/files/pythonraw1394-1.0.tar.gz<br />tar xvfz pythonraw1394-1.0.tar.gz<br />cd pythonraw1394<br />wget http://www.storm.net.nz/static/files/winlockpwn<br />chmod +x ./winlockpwn<br />vim Makefile (reference /usr/local instead of /usr for python)<br />make</blockquote><span style="font-size:130%;">Fifth, load the module and set some permissions: </span><br /><blockquote>sudo modprobe raw1394<br />sudo chmod 666 /dev/raw1394</blockquote><span style="font-size:130%;">Sixth, plug into the Windows machine</span><br /><br /><span style="font-size:130%;">Seventh, load the ipod image to the firewire port</span><br /><blockquote>vim romtool (update the location of python to be /usr/local/bin/python)<br />./romtool -s 0 ipod.csr</blockquote><span style="font-size:130%;">Eighth, run businfo to check the port configurations:</span><br /><blockquote></blockquote><blockquote>vim businfo (update the location of python to be /usr/local/bin/python)<br />./businfo</blockquote>At this point you should see two nodes listed. Node 0 is the ipod image that you loaded with romtool. Node 1 is the Windows machine.<br /><br /><span style="font-size:130%;">Ninth, run the utility</span>:<br /><blockquote>vim winlockpwn (update the location of python to be /usr/local/bin/python)<br />./winlockpwn 0 1 1</blockquote>You can get more information on the <span style="font-weight: bold;">winlockpwn</span> parameters by running the command without parameters. The first parameter is the firewire port, the second is the node (in this case the node for Windows) and the third is the type of Windows password screen.<br /><br /><span style="font-size:130%;">Tenth, login to Windows</span><br /><br />Use any password you want...Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com20tag:blogger.com,1999:blog-8845129.post-87567704788151102592007-12-11T20:41:00.000-04:002007-12-11T20:50:20.483-04:00Windows Cannot Recognize Wireless USB mouseProblem: Windows Stops Recognizing USB Mouse<br /><br />Symptoms: When the USB receiver is plugged in, Windows pop pops up a message in the system tray that it is unable to recognize the USB device. This is despite the fact that plugging it into a different port may (but mostly will not) work.<br /><br />Solution:<br /><br />This is direct from "Newbie Poster" at <a href="http://www.daniweb.com/forums/post41808-5.html">http://www.daniweb.com/forums/post41808-5.html</a>. The solution worked for me despite not deleting the oem inf files or any registry entries.:<br /><br /><blockquote>I found a fix for USB devices not working, actually came from <a itxtdid="3569815" target="_blank" href="http://www.daniweb.com/forums/thread7700.html#" style="border-bottom: 0.075em solid darkgreen; font-weight: normal; font-size: 100%; text-decoration: underline; color: darkgreen; background-color: transparent; padding-bottom: 1px;" classname="iAs" class="iAs">Microsoft</a> technicians. Apparently there's a problem with the Intel USB chipsets going flakey<br /><br /><br />Step 1: Remove Hidden Devices<br /><br /><ol><li> Open a <a itxtdid="3569880" target="_blank" href="http://www.daniweb.com/forums/thread7700.html#" style="border-bottom: 0.075em solid darkgreen; font-weight: normal; font-size: 100%; text-decoration: underline; color: darkgreen; background-color: transparent; padding-bottom: 1px;" classname="iAs" class="iAs">Command Prompt</a>.</li><li>Type "set DEVMGR_SHOW_DETAILS=1" (without quotation marks) and press Enter.</li><li>Type "set DEVMGR_SHOW_NONPRESENT_DEVICES=1" (without quotation marks) and Press Enter.</li><li>Type "start devmgmt.msc" (without quotation marks) and click press Enter.</li><li>Click View. Click Show hidden devices. </li><li>Click "+" to expand devices, Unknown devices and USB devices. </li><li>Are there any devices and unknown devices (including grayed out devices)? If so, please right click it and click Uninstall them.</li></ol><br />Step 2: Remove all oem*.inf files<br /><br />=========================<br /><br />1. Click start and click run then under the run line type in the command "cmd" (without the quotation marks)<br /><br />2. In the <a itxtdid="3569881" target="_blank" href="http://www.daniweb.com/forums/thread7700.html#" style="border-bottom: 0.075em solid darkgreen; font-weight: normal; font-size: 100%; text-decoration: underline; color: darkgreen; background-color: transparent; padding-bottom: 1px;" classname="iAs" class="iAs">command line</a>, type in the following (without the quotes) and press enter after each command:<br /><br /> "cd \windows\inf"<br /> "ren infcache.1 *.old"<br /> "ren oem*.inf *.old"<br /> "del C:\windows\setupapi.log"<br /> "exit"<br /><br />Step 3: Removing all entries under HKEY_LOCAL_MACHINE/Enum/USB that start with VID using REGEDIT.<br /><br />==================================================================<br /><br />Removing the VID entries from the registry will cause them to be redetected at restart.<br /><br />CAUTION: If you have a USB keyboard, mouse, scanners, and other things you know are working, do not remove the VID entry for these devices, otherwise, Windows may not restart correctly.<br /><br />1. Click Start and click Run. Type regedit and click OK. The Registry Editor window will open.<br /><br />2. Go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\USB.<br /><br />3. Highlight and delete all the VID_.... entries for usb devices that you cannot identify. Remember not to delete the entries mentioned above.<br /><br />You may not have permssion to delete keys, do the following.<br />Permissions may be set allowing the deletion of the VID_ entries by following the steps below:<br /><br />a) Right-click the key to be deleted, and then click Permissions. The VID_... Permissions window will open.<br />b) With Everyone highlighted in the Group or User name section, select Full Control in the Permissions section.<br />c) Click Apply, and then click OK.<br /><br />5. Restart your compuer.<br /><br />Step 4: Reconnect the USB device that was not previously working. Windows should automatically rerinstall the <a itxtdid="3617829" target="_blank" href="http://www.daniweb.com/forums/thread7700.html#" style="border-bottom: 0.075em solid darkgreen; font-weight: normal; font-size: 100%; text-decoration: underline; color: darkgreen; background-color: transparent; padding-bottom: 1px;" classname="iAs" class="iAs">drivers</a>.<br /><br /><br />This worked for me and hope it helps you out. Good luck with it.</blockquote>Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-67219651801449024362007-07-29T22:11:00.000-03:002007-07-30T20:52:28.946-03:00The GrandStream BudgetTone-200 (part 2)<span style="font-weight: bold;"><span style="font-style: italic;">The Firmware Update</span></span><br /><br />I am pleased to say that this was painless and was quite simple to do. I was a little worried about it, but GrandStream seems to have done an excellent job of making it simple to perform.<br /><br /><span style="font-weight: bold;"><span style="font-style: italic;">Defining Simple</span></span><br /><blockquote>If you have the right setup, the update is painless</blockquote>The requirements for this seem simple enough. You need:<br /><ol><li>a working dhcp server</li><li>a working tftp (or http) server</li><li>the ability to configure both</li></ol>The dhcp server is not strictly necessary as long as the phone is configured with an IP address, subnet, etc.<br /><br />If you have a working setup already, the firmware update is easy. If you do not have a working setup, you need to start there.<br /><br /><span style="font-weight: bold; font-style: italic;">Instructions:</span><br /><ol><li>Download the latest firmware update</li><li>Unzip the files to the root of the tftp server</li><li>login to the phone's web interface (default admin password)</li><li>update the Firmware Upgrade and Provisioning to be <span style="font-style: italic;">Upgrade Via tftp</span></li><li>Set the <span style="font-style: italic;">Firmware Server Path</span> to the tftp server ip address<br /></li><li>Set the <span style="font-style: italic;">Config Server Path</span> to tftp server ip address</li><li>Save settings via Update button</li><li>Click Reboot</li></ol>That's it! The phone will reboot two or three times and at the end (not really evident) you can login to the phone's web site and check the <b>Software Version</b> on the Status tab.<br /><br /><span style="font-weight: bold; font-style: italic;">Alternatives</span><br /><br />I have not tried the http update of the firmware but I suspect that replacing tftp with http in the instructions above should make it possible.Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com1tag:blogger.com,1999:blog-8845129.post-79863495865205834872007-07-27T20:12:00.000-03:002007-07-30T20:55:21.953-03:00The GrandStream BudgetTone-200 (part 1)<span style="font-weight: bold;"><span style="font-style: italic;">The purchase:</span></span><br /><br />I recently purchased two GrandStream BudgetTone-200's from http://www.voipdepot.ca. This was an amazing experience and I cannot hesitate to recommend voipdepot.ca. I placed the order Wednesday at 10:21 AM and the package was delivered to my door Thursday at 10:19 AM. A couple of things makes that impressive:<br /><ol><li>It was less than 24 hours</li><li>They are located in Mississauga, Ontario</li><li>I am located in Moncton, New Brunswick</li><li>Google tells me that it is 1,544 km – about 16 hours 2 mins to drive</li></ol>Granted, they gained an hour in the time zone but I sill had my order in less than 24 hours.<br /><span style="font-style: italic;"><span style="font-weight: bold;"><br />The GrandStream BT-200; First Impressions:</span><br /></span><br />The phone itself seems to be sturdy and well designed with large buttons. I plugged in the parts, the manual says to connect all the parts and the network before the power and that makes sense. <br /><br />As soon as the power is supplied the following occurs:<br /><ol><li>a red light appears</li><li>you hear a little noise (like a speaker)</li><li><span style="font-weight: bold;">No IP</span> appears on the display</li><li>The default date and time 1900-01-01 0:00 AM appears on the display</li><li>The correct date and time (more or less) appears</li></ol>At this point, there is a dial tone and if you left the receiver and press the MENU button you find the IP Address of the phone.<br /><span style="font-style: italic;"><span style="font-weight: bold;"><br />The GrandStream BT-200; Initial Configuration:</span><br /></span><br />The first thing I noticed was that the time was off by an hour or two. It was just an annoyance but it was the first thing I tackled. Pressing the menu butting displayed a number of configurable items but nothing related to time and I also noted there did not seem to be any SIP configuration available.<br /><br />Upon reviewing the manual I noted that the phone has a web server that is used for configuration. More experience with VOIP would have probably made that obvious but it was not. I opened Firfox and entered http://192.168.2.254 (the IP address revealed by lifting the receiver and pressing MENU).<br /><br />That brought me to the <span style="font-weight: bold;">Grandstream Device Configuration</span> page and yet another review of the manual told me that <span style="font-style: italic;">"123"</span> was the user password.<br /><br />Logging in, I set the Time Zone and enabled Daylight Savings Time. Upon applying the setting it explained that a reboot was necessary. Rebooting caused my IP address to change (DHCP is the default) so I need to discover it again (Lift Receiver press MENU) to continue exploring the config.<br /><br /><span style="font-style: italic;"><span style="font-weight: bold;"><br />The GrandStream BT-200; Exploring the Configuration:</span><br /></span><br />Logging in as an "End User" (the default 123 password) allows you access to the Status and Basic Settings tabs. I clicked on the Advanced Settings and Account but received a rather unhelpful message: <span style="font-style: italic;">Access Denied Content-Type: text/html;charset=iso-8859-1 Server: Grandstream/1.10</span>. It took some time to realize that you need to login as the "Admin" (the default admin password) on the initial login page. You cannot login as an End User and then escalate to the Admin. A nice "You need to login as the Admin" page would have been helpful.<br /><br />Accessing the "Status" tab displays some information about the phone. In particular, it displays the Software Version. In my case, the installed Program-- 1.1.1.14 and Bootloader-- 1.1.1.5 versions seemed well behind the current version of the firmware displayed in the site (1.1.4.18). It seems that one of the first tasks will be to upgrade the firmware.<br /><br /><span style="font-style: italic;"><span style="font-weight: bold;"><br />The GrandStream BT-200; Initial Tests:</span><br /></span><br />Browsing through the manual, I noticed that it is possible to make IP to IP calls if you have multiple devices on the same network (subnet). To place a direct IP to IP call, first off-hook, then press the “MENU” key, then enter a 12-digit target IP address to make the call and press the SEND button. <br /><br />This is where having multiple devices really has advantages when you are trying to understand VOIP and you want to verify that the phones actually work. With this out of the way (and a nice conversation with my 2 year old with the new phones) I was ready to look at the firmware upgrade.Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0tag:blogger.com,1999:blog-8845129.post-80274743365979321402007-07-21T00:57:00.000-03:002007-07-22T22:28:00.707-03:00Migrating Evolution Contacts to GmailEvolution exports its contacts in a VCard format. You can simply select all contacts that you want to export and save a VCard. All VCards a saved in the same file.<br /><br />Getting the contacts out of VCard format and into something that is usable for GMail takes a little Perl code. The following code creates a comma separated value format file in GMails native format. It currently only supports two sections Personal and Work.<br /><br />The inspiration for this was is was based on the Linux Journal article at <a href="http://blog.ibao.net/linux/2004/07/19/export-evolution-address-book-to-gmail/">http://blog.ibao.net/linux/2004/07/19/export-evolution-address-book-to-gmail</a>but it was completely rewritten (well some cut and paste and editing) to take advantage of the GMail csv format that allows you to import your information into named sections. In addition, it properly formats the address (Canadian Standards)<br /><br />No doubt you may need to modify it for your own use. That is fine, but this code is licensed under the terms of the GNU General Public Licence<br /><br />You can download the code from: <a href="http://timlegge.googlepages.com/evol_gmail.pl">http://timlegge.googlepages.com/evol_gmail.pl</a><br /><br />You should note that an issue in GMail results in being unable to view some imported contacts. The work around is to clear your cache and restart the browser.<br /><br />I have updated the script recently to use alternative email addresses if they are available...Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com3tag:blogger.com,1999:blog-8845129.post-1098533197543889592004-10-23T13:10:00.000-03:002004-10-23T09:10:15.066-03:00Is knowledge creation unsustainable?I don't often take exception to some of the opinions people have. Well, I guess I often take exception but I am rarely moved to write about it.
<br />
<br />However, I read an article by on ft.com by Richard Epstein <a href="http://news.ft.com/cms/s/78d9812a-2386-11d9-aee5-00000e2511c8.html">"Why open source is unsustainable"</a> that essentially equates working on open source to a workers commune that produces some tangible goods.
<br />
<br />I work on the free software Etherboot project and the code that I write or borrow from other GPL developers cannot be equated to a sack of potatoes.
<br />
<br />Computer programming is essentially the creation of knowledge. Whether it is the knowledge of how to interact with a network card or how to download a file via tftp, it is documented in the source.
<br />
<br />When I write an Etherboot driver for a network card I sometimes have access to the often flawed technical specifications from a vendor. However, I have written drivers with no technical reference other than the knowledge contained in a Linux driver. The difference is that while the knowledge contained in the driver C code may differ from the technical specifications, I know that the Linux driver works.
<br />
<br />People outside the computer industry have been adding to the sum total of human knowledge for eons and I am doing my small part to help that. The fact that the knowledge can be "compiled" into an application that is useful to thousands of people is somewhat immaterial. The knowledge, unlike a sack of potatoes, lasts far past supper.
<br />
<br />The creation of knowledge may be unsustainable but I suspect we have not yet reached that limit. Timothy Leggehttp://www.blogger.com/profile/07077114053332628381noreply@blogger.com0