Lost Password – Windows XP Virtual Machine…

Ok, had to reset it.  Here is what I did:

  1. Searches led me to this site:   http://www.petri.co.il/forgot_administrator_password.htm
  2. Trial and error led me to this tool:  Offline NT Password & Registry Editor, Bootdisk / CD
  3. I downloaded the cd080802.iso file.
  4. As I was unable to boot from the iso file itself in the VMware Server 2 web console (don’t ask me why), I was forced to burn this to a CD and boot the VM off of it (it boot s so fast, I had to set it to boot to the BIOS first and make the CD drive the first boot device).
  5. I followed the defaults offered up by the boot CD and reset (blanked) my password.
  6. Removed the CD and booted the VM, got right into my account just fine.
  7. Created a new password.

I won’t soon forget this password now.  What a pain.  Hope this helps – I looked at John the Ripper and a couple others, but this tool really did the trick.

Default Logins and Passwords for Network Devices

Great info to have – so change your defaults ASAP.

Visit Technofriend’s blog for the details.

Very Useful Link on Shell Scripting….

I found this while surfing Linux.com.  Very handy if you are into shell scripting (and who isn’t?, haha).

Speaking UNIX

Enjoy!

Fun Script to Track Your Blog Hit Count…

I got the inspiration for this script from CoolTechie’s blog. He made a script to display cricket match scores from a web site. I decided to have a little fun with it, so made one of my own that periodically checks this blog and displays a popup window if the hit counter has changed, with the current visitor count.

I started with the command, “touch blog-hits”, then edited it in vi. When I was done, I typed “chmod +x blog-hits” to make it executable and ran it by typing “./blog-hits”.

Here is the script…


### Adapted from a soccer score script found on
### http://cooltechie.wordpress.com/2007/12/04/cricket-scoreboard-kde-desktop/
### Thanks out to cooltechie!


#!/bin/sh


####################
# Set variables - interrupt, url, url title, search phrase, and unchanged counter
####################
USER_INTERRUPT=13
url="https://symbolik.wordpress.com"
hits="a"
same="b"
##phrase="hits" ### this is the default, change if you use something else
phrase="bipeds"
title="Linux Free Trade Zone" ### I wanted to come up with a cool way to extract the title of the URL, but it got late...


####################
# Catch Control-C events to break out of the loop and remove the dump file
####################
trap 'echo "Quitting..."; rm -f dump; exit $USER_INTERRUPT' TERM INT


while [ 1 ]
do
lynx -dump $url > dump
hits=`grep "$phrase" dump`
if [ "$hits" != "$same" ]
then
kdialog --title "$title" --passivepopup "$hits" 10
same=$hits
fi
sleep 60
done

It grabs the text of the url, looks for the word “hits” or whatever phrase you tell it to if you have changed that on your site, and compares it to the old value (same). When the current value is different from the “same” value, such as when the script is first run and when people visit your blog, it displays that new hit count in the popup for 10 seconds, then waits one minute before re-downloading a text dump of the site. You end it with CTRL-C, which also tells it to clean up the dump file it makes. You can run it in the background if you want. I am sure there is plenty of stuff you can add to this as well, and it might even be a little buggy (inaccurate). I just thought it would be fun to have a little popup counter, and it was fun to do.

One thing I found is that it also prints the phrase you searched on to display the visitor count line, because that phrase is getting appended to the “hits” variable. Too tired to troubleshoot, however…

Anyway, enjoy!

Extracting an MP3 From a YouTube Flash (FLV) Download…

My wife likes YouTube.

A *lot*.

I had found out how to make MP3 files from the audio sections of the FLV files, so she wanted to know if I could set things up for her to do this on her own.

Of course I said yes.

So, first step was downloading the video from YouTube. That was pretty easy – I installed the UnPlug add-on for Firefox and tested it. I used to use Ook! Video, but it stopped working for me on YouTube. Maybe they changed the site and broke it, I don’t know. Anyway, Unplug seems to work much better, and soon I had the FLV files I was interested in.

Next step was streaming the audio into an MP3 file – I say streaming because the original FLV file is left unchanged – it does not get converted to an MP3, but rather a new MP3 is made from the audio protion of the video file.

For this, I used ffmpeg at the command line. It worked great, and I was able to create OGG and MPG files as well. The command I ran was:

  • ffmpeg -title “my_title” -i filename.flv -acodec mp3 -ac 2 -ab 128 -vn -y filename.mp3

The -i is the input file, -acodec is the type of audio codec to use, -ac is the number of audio channels, -ab is the encoding bitrate, -vn disables video recording, and the -y option overwrites output files. Plenty of other info is here.

Still, even though it worked fine, it is a little clunky to use for multiple files and is well past what I can expect my wife to manage, so I wrote my first *real* bash shell script – youtube2mp3. The script, which I made executable and placed in /usr/local/bin, basically acts within the current working directory, accepting one input parameter – the output directory location. It runs through and extracts an MP3 file for each FLV file, provided that the MP3 file does not already exist in the output directory. The sanity checking it does is limited to determining if the output path (assumed to be a USB MP3 player) exists (is plugged in), and it looks for Control-C to delete the MP3 file currently being encoded and break out of the script. Anyway, here is the scripţ in all its ugly glory:

#!/bin/bash

####################
# Set variables – interrupt, extension1, extension2, and the audio file name
####################
USER_INTERRUPT=13
xt1=flv
xt2=mp3
audio=${filename%$xt1}$xt2
pluginmsg=”$USER, please plug in the MP3 player and try again. Quitting…”

####################
# Set the output directory, so as not to clutter up the folder full of flv files
####################
if [ -n “$1” ]
then
outputdir=${1}/
else
outputdir=/dev/dummy/
fi

####################
# Catch Control-C events to break out of the loop and remove the partial audio file
####################
trap ‘echo “Quitting…”; rm -f $audio; exit $USER_INTERRUPT’ TERM INT

####################
# Loop through the working directory and create from xt2 from xt1
####################
mount | grep -i ${outputdir%/} &> /dev/null # Is the MP3 player mounted?
if [ $? = 0 ]
then
for filename in *.$xt1
do
title=${filename%$xt1}
audio=${filename%$xt1}$xt2

if [ ! -f ${outputdir}$audio ] # Does the mp3 already exist in the output directory?
then
ffmpeg -title “$title” -i $filename -acodec mp3 -ac 2 -ab 128 -vn -y $audio # Change this if xt2 is not an mp3
mv $audio $outputdir
fi
done
else
echo “$pluginmsg” # No MP3 player – try again!
sleep 1
exit 1
fi

exit 0

I tried to write it generic enough it could be easily modified for other file types, etc, etc, etc. I then made a new KDE “Link to Application”, set the working directory as the folder my wife saves her videos to, and passed in the media path for the MP3 player for the command to run – “/usr/local/bin/youtube2mp3 /media/disk”. I also set the desktop link to run as a terminal window, so she could see the progress and any exit messages.

Now, she saves her YouTube vidoes to that folder, plugs in her MP3 player, clicks the script icon on her desktop, and waits while it creates the MP3 files and moves them to her MP3 player. Too easy.

Live CD Exercise…

I am currently playing around with various live CD distros (SLAX, DSL, DSL-N, Knoppix, etc.) and trying my hand at remastering a live CD.  I want to get one that ultimately opens three or four xsessions on boot (no login), and offers only an RDP client aimed at a terminal server.  Sort of a kiosk approach to running multiple Windows desktops on a single machine….